society-self-service/sstreasury/jinja2/sstreasury/claim_list.html

118 lines
3.8 KiB
HTML

{% extends 'sstreasury/base.html' %}
{#
Society Self-Service
Copyright © 2018–2023 Yingtong Li (RunasSudo)
Copyright © 2023 MUMUS Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>.
#}
{% block title %}Your reimbursement claims{% endblock %}
{% macro listclaims(claims) %}
<table class="ui selectable celled table">
<thead>
<tr>
<th class="eleven wide">Purpose</th>
<th class="four wide">Status</th>
<th class="one wide">View</th>
</tr>
</thead>
<tbody>
{% for claim in claims %}
<tr>
<td class="selectable"><a href="{{ url('claim_view', kwargs={'id': claim.id}) }}">{{ claim.purpose }}</a></td>
<td class="selectable"><a href="{{ url('claim_view', kwargs={'id': claim.id}) }}">{{ claim.get_state_display() }}</a></td>
<td>
<a href="{{ url('claim_view', kwargs={'id': claim.id}) }}" class="ui tiny primary icon button"><i class="eye icon"></i></a>
</td>
</tr>
{% endfor %}
</tbody>
</table>
{% endmacro %}
{% block maincontent %}
<h1>Your reimbursement claims</h1>
<form class="ui form" method="GET">
<div class="fields">
<div class="eight wide field">
<label>State</label>
<select class="ui dropdown" name="state">
<option value="all"{% if request.GET.get('state', 'all') == 'all' %} selected{% endif %}>All states</option>
{% for state in import('sstreasury.models').ClaimState %}
<option value="{{ state._value_ }}"{% if request.GET.get('state', 'all') == state._value_|string %} selected{% endif %}>{{ state.description }}</option>
{% endfor %}
</select>
</div>
<div class="five wide field">
<label>Year</label>
<input name="year" value="{{ request.GET.get('year', '') }}">
</div>
<div class="three wide field">
<label>&nbsp;</label>
<button type="submit" class="ui primary labeled icon button" style="width:100%"><i class="filter icon"></i>Filter</button>
</div>
</div>
</form>
{% if not claims_action and not claims_open and not claims_closed %}
<p>There are no reimbursement claims matching the selected criteria. To create a claim, click <a href="{{ url('claim_new') }}">Create new claim</a>.</p>
{% endif %}
{% if claims_action %}
<h2>Claims requiring action</h2>
{{ listclaims(claims_action) }}
{% endif %}
{% if claims_open %}
<h2>Open claims</h2>
{{ listclaims(claims_open) }}
{% endif %}
{% if claims_closed %}
<h2>Closed claims</h2>
{{ listclaims(claims_closed) }}
{% endif %}
<div style="text-align:center;padding-top:1em">
<div class="ui pagination menu">
{% if page.has_previous() %}
<a class="item" href="?page={{ page.previous_page_number() }}&state={{ request.GET.get('state', 'all') }}&year={{ request.GET.get('year', '') }}">&lsaquo; Prev</a>
{% endif %}
<a class="active item">Page {{ page.number }} of {{ page.paginator.num_pages }}</a>
{% if page.has_next() %}
<a class="item" href="?page={{ page.next_page_number() }}&state={{ request.GET.get('state', 'all') }}&year={{ request.GET.get('year', '') }}">Next &rsaquo;</a>
{% endif %}
</div>
</div>
{% endblock %}
{% block head %}
{{ super() }}
{% endblock %}
{% block script %}
{{ super() }}
<script>
$('.ui.dropdown').dropdown();
</script>
{% endblock %}