user.html 6.43 KB
{% extends "base.html" %}

{% block head %}
    {{ super() }}
    {#    <link rel="stylesheet" href="http://cdn.datatables.net/1.10.7/css/jquery.dataTables.min.css">#}
    <link rel="stylesheet"
          href="http://cdn.datatables.net/plug-ins/1.10.7/integration/bootstrap/3/dataTables.bootstrap.css">
{% endblock %}

{% block scripts %}
    {{ super() }}
    <script type="text/javascript"
            src="http://cdn.datatables.net/1.10.7/js/jquery.dataTables.min.js"></script>
    <script type="text/javascript"
            src="http://cdn.datatables.net/plug-ins/1.10.7/integration/bootstrap/3/dataTables.bootstrap.js"></script>


{% endblock %}

{% block content %}
    {{ super() }}
    <div class="container">
        <div class="row">
            <div class="col-md-10 col-md-offset-1">
                <div class="jumbotron">
                    <p class="h2"><strong>My Tasks</strong></p>
                    <br>
                    <table id="datable" class="table clean table-striped table-bordered"
                           cellspacing="0"
                           width="100%">
                        <thead>
                        <tr>
                            <th><i class="fa fa-tasks"></i> Task Name</th>
                            <th><i class="fa fa-calendar-o"></i> Pub Date</th>
                            <th><i class="fa fa-calendar-o"></i> Due Date</th>
                            <th><i class="fa fa-star-half-o"></i> Priority</th>
                            <th><i class="fa fa-flag"></i> Status</th>
                            {% if current_user.is_authenticated() and current_user.username == 'admin' %}
                                <th><i class="fa fa-cogs"></i> Actions</th>
                            {% endif %}
                        </tr>
                        </thead>

                        {#        <tfoot>#}
                        {#        <tr>#}
                        {#            <th><i class="fa fa-tasks"></i> Task Name</th>#}
                        {#            <th><i class="fa fa-calendar-o"></i> Pub Date</th>#}
                        {#            <th><i class="fa fa-calendar-o"></i> Due Date</th>#}
                        {#            <th><i class="fa fa-star-half-o"></i> Priority</th>#}
                        {#            <th><i class="fa fa-flag"></i> Status</th>#}
                        {#            <th><i class="fa fa-cogs"></i> Actions</th>#}
                        {#        </tr>#}
                        {#        </tfoot>#}

                        <tbody>
                        {% for task in tasks %}
                            <tr>
                                <td align="center">
                                    <a href="{{ url_for('info', task_id = task.id) }}">{{ task.name }}</a>
                                </td>
                                <td align="center">{{ task.pubdate }}</td>
                                <td align="center">{{ task.duedate }}</td>
                                {% if task.priority ==0 %}
                                    <td align="center"
                                        class="text-success">{{ task.enum_priority[task.priority] }}</td>
                                {% elif task.priority ==1 %}
                                    <td align="center"
                                        class="text-primary">{{ task.enum_priority[task.priority] }}</td>
                                {% elif task.priority ==2 %}
                                    <td align="center"
                                        class="text-warning">{{ task.enum_priority[task.priority] }}</td>
                                {% elif task.priority ==3 %}
                                    <td align="center"
                                        class="text-danger">{{ task.enum_priority[task.priority] }}</td>
                                {% endif %}


                                {% if task.status ==0 %}
                                    <td align="center" class="text-info">
                                        {{ task.enum_status[task.status] }}
                                    </td>
                                {% elif task.status ==1 %}
                                    <td align="center" class="text-muted">
                                        {{ task.enum_status[task.status] }}
                                    </td>
                                {% elif s.status ==-1 %}
                                    <td align="center" class="text-warning">
                                        {{ s.enum_status[s.status] }}
                                    </td>
                                {% endif %}

                                {% if current_user.is_authenticated() and current_user.username == 'admin' %}
                                    <td align="center">
                                        <div class="btn-group">
                                            <button type="button" class="btn btn-success btn-sm"
                                                    aria-label="Left Align"
                                                    onclick="location.href='{{ url_for("complete", task_id = task.id) }}'">
                                                <i class="fa fa-minus"></i>
                                            </button>
                                            <button type="button" class="btn btn-primary btn-sm"
                                                    aria-label="Center Align"
                                                    onclick="location.href='{{ url_for("incomplete", task_id = task.id) }}'">
                                                <i class="fa fa-plus"></i>
                                            </button>
                                            <button type="button" class="btn btn-danger btn-sm"
                                                    aria-label="Right Align"
                                                    onclick="location.href='{{ url_for("delete_entry", task_id = task.id) }}'">
                                                <i class="fa fa-close"></i>
                                            </button>
                                        </div>
                                    </td>
                                {% endif %}
                            </tr>
                        {% endfor %}
                        </tbody>
                    </table>
                </div>
            </div>
        </div>
    </div>
{% endblock %}