<!DOCTYPE html>
<html lang="zh-CN" xmlns:th="http://www.thymeleaf.org"
      xmlns:layout="http://www.ultraq.net.nz/web/thymeleaf/layout"
      layout:decorator="base">
<head>
    <link rel="stylesheet" href="/static/css/applications.css" type="text/css"/>
    <!-- dataTables -->
    <link rel="stylesheet" type="text/css"
          href="/static/AdminLTE/bower_components/datatables.net-bs/css/dataTables.bootstrap.min.css"/>
    <!-- Select2 -->
    <link rel="stylesheet" type="text/css" href="/static/AdminLTE/bower_components/select2/dist/css/select2.min.css"/>
</head>
<body>
<div layout:fragment="mainbody">
    <aside class="main-sidebar">
        <section class="sidebar">
            <div class="user-panel">
                <div class="pull-left image">
                    <img src="/static/images/avatar/avatar-admin.jpg" class="img-circle" alt="User Image" />
                </div>
                <div class="pull-left info">
                    <p>Admin</p>
                    <a href="#">
                        <i class="fa fa-circle text-success"></i>
                        Online
                    </a>
                </div>
            </div>

            <!-- Search form -->
            <form action="#" method="get" class="sidebar-form">
                <div class="input-group">
                    <input type="text" name="q" class="form-control" placeholder="Search..." />
                    <span class="input-group-btn">
						<button type="submit" name="search" id="search-btn" class="btn btn-flat">
							<i class="fa fa-search"></i>
						</button>
					</span>
                </div>
            </form>

            <!-- Sidebar Menu -->
            <ul class="sidebar-menu tree" data-widget="tree">
                {% for task in app_list %}
                <li>
                    <a href="/task?id={{ task.id }}">
                        <i class="fa fa-link"></i>

                    </a>
                </li>
                {% endfor %}
            </ul>
        </section>
    </aside>

    <!-- Main Content -->
    <div class="content-wrapper" style="min-height: 691px;">
        <section class="content-header">
            <h1>全部应用</h1>

            <ol class="breadcrumb">
                <li class="active">
                    <a href="/home">
                        <i class="fa fa-dashboard"></i>
                        全部应用
                    </a>
                </li>
            </ol>
        </section>

        <!-- Main Content -->
        <section class="content container-fluid">
            <!-- 			<div id="task-list-search" class="input-group col-md-6">
                            <input type="text" class="form-control" placeholder="Search for application">
                            <span class="input-group-btn">
                                <button class="btn btn-default" type="button" id="task-search-btn">Search</button>
                            </span>
                        </div> -->

            <table id="task-list" class="table table-striped text-center" style="margin-top: 10px">
                <thead><tr>
                    <th></th>
                    <th>应用名</th>
                    <th>版本</th>
                    <th>审核状态</th>
                    <th>开始时间</th>
                    <th>结束时间</th>
                    <th>审核进度</th>
                    <th>未审核数</th>
                </tr></thead>
                <tbody>
                <th:block th:each="task : ${tasks}">

                    <tr>
                        <td><img th:src="${task.icon}" style="width: 25px; height: 25px;" /></td>
                        <td><b><a href="#" id="task-name" th:text="${task.name}">{{ task.name }}</a></b></td>
                        <td th:text="${task.version}"></td>
                        <td th:if="${task.numOfUndeal > 0}"><span  class="label label-info">审核中</span></td>
                        <td th:if="${task.numOfUndeal == 0}"><span  class="label label-success">审核结束</span></td>
                        <td th:text="${task.startTime}">{{ task.print_start_time }}</td>
                        <td th:text="${task.endTime}">{{ task.print_end_time }}</td>
                        <td style="width: 200px;">
                            <a th:href="'/task_detail?examId=' + ${task.examId} + '&amp;caseId=' + ${task.caseId}">
                                <div class="progress">
                                <div class="progress-bar progress-bar-success progress-bar-striped" role="progressbar"
                                     th:style="'width: ' + ${(1 - task.numOfUndeal*1.0/task.numOfTotalBug) * 100}+'%'"
                                     data-placement="bottom" data-toggle="tooltip" th:title="|${task.numOfTotalBug - task.numOfUndeal}份报告已经被审核|">
                                </div>

                                    <div class="progress-bar progress-bar-danger progress-bar-striped" role="progressbar"
                                         th:style="'width: ' + ${(task.numOfUndeal*1.0/task.numOfTotalBug) * 100}+'%'"
                                         data-placement="bottom" data-toggle="tooltip" th:title="|${task.numOfUndeal}份报告还未被审核|">
                                    </div>

                            </div>
                            </a>
                        </td>
                        <td><span class="badge"><a th:href="'/task_detail?examId=' + ${task.examId} + '&amp;caseId=' + ${task.caseId}" style="color: #fff;" th:text="${task.numOfUndeal}"></a></span></td>
                    </tr>
                </th:block>
                </tbody>
            </table><!-- table -->
        </section>
    </div>
</div>
</body>
</html>
<script src="/static/AdminLTE/bower_components/datatables.net/js/jquery.dataTables.min.js"></script>
<script src="/static/AdminLTE/bower_components/datatables.net-bs/js/dataTables.bootstrap.min.js"></script>
<script src="/static/AdminLTE/bower_components/select2/dist/js/select2.min.js"></script>
<script type="text/javascript">
    $(document).ready(function(){
        $('[data-toggle="tooltip"]').tooltip();

        var taskListTable = $('#task-list').DataTable({
            searching: true,
            pageLength: 25
        });
    });
</script>