{% extends "base.html" %}
{% block content %}


<div class="container">
    <div class="col-lg-8" style="padding-bottom: 0px;">
        <div class="row">
            <div class="form-group" style="text-align: center;">
                <div>
                    <div data-toggle="buttons" class="btn-group btn-group-toggle">
                        <label onclick="clickDataHref(this);" data-href="{{ url_for('proposals', status=0) }}" class="btn btn-success {% if status == 0 %}active{% endif %}">
                            Proposals <small>({{summary_data['statuses'][0]}})</small>
                        </label>
                        <label onclick="clickDataHref(this);" data-href="{{ url_for('proposals', status=1) }}" class="btn btn-success {% if status == 1 %}active{% endif %}">
                            Work in progress <small>({{summary_data['statuses'][1]}})</small>
                        </label>
                        <label onclick="clickDataHref(this);" data-href="{{ url_for('proposals', status=2) }}" class="btn btn-success {% if status == 2 %}active{% endif %}">
                            Completed <small>({{summary_data['statuses'][2]}})</small>
                        </label>
                    </div>
                    <div id="point-wow-left">
                        <img src="/static/point-left.png" style="margin-left: 10px;width: 60px;">
                        <span style="color: #fc4dff;font-size: 16px;font-style: italic;font-weight: bold;margin-left: 6px;">wow</span>
                    </div>
                </div>
            </div>
            {% if cat %}
            <small class="form-text text-muted" style="margin-top: -2px;">
                Results limited by category '{{cat}}'. <a href="{{ url_for('proposals', status=status) }}">Undo filter</a>.
            </small>
            <br>
            {% endif %}
        </div>
    </div>

    <div class="row">
        <div class="col-lg-8">
            {% if proposals %}
            {% for p in proposals %}
            {% if loop.index == 1 %}
            <table class="table table-proposal table-hover table-tilted" style="margin-bottom:6px;">
                <thead>
                <tr>
                    <th style="font-size: x-large;">Proposal</th>
                    <th>Username</th>
                    <th id="date">Date</th>
                    {% if status == 0 %}
                    <th style="text-align: right;">Funding</th>
                    {% else %}
                    <th></th>
                    {% endif %}
                </tr>
                </thead>
                <tbody>
                {% else %}
                {% if loop.index % 3 == 0 %}
                </tbody>
            </table>
            <table class="table table-proposal table-hover {% if (loop.index/3) % 2 == 0 %}table-tilted{% else %}table-tilted-v{% endif %}">
                <tbody>
                {% endif %}
                {% endif %}
                <tr>
                    <td><b><a href="/proposal/{{ p.id }}">{{ p.headline }}</a></b></td>
                    <td><a href="/user/{{ p.user.username }}">{{ p.user.username }}</a></td>
                    <td id="date"><small>{{ p.date_added.strftime('%Y-%m-%d %H:%M') }}</small></td>
                    <td>
                        <span style="float:right;">
                        {% if p.funds_progress >= 0.1 and status == 0 %}
                            {{p.funds_progress|int}}%
                        {% else %}
                        -
                        {% endif %}
                        </span>
                    </td>
                </tr>

                {% endfor %}
                </tbody>
            </table>
            {% else %}
            No proposals here yet.
            {% endif %}
        </div>
        {% include 'sidebar.html' %}
    </div>

    <!--<div class="col-md-12">-->

    <!--&lt;!&ndash; Pagination &ndash;&gt;-->
    <!--<ul class="pagination mb-4">-->
    <!--<li class="page-item">-->
    <!--<a class="page-link" href="#">&larr; Older</a>-->
    <!--</li>-->
    <!--<li class="page-item disabled">-->
    <!--<a class="page-link" href="#">Newer &rarr;</a>-->
    <!--</li>-->
    <!--</ul>-->
    <!--</div>-->
    <br>

</div>
<!-- /.container -->
{% endblock %}
