You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
85 lines
2.8 KiB
HTML
85 lines
2.8 KiB
HTML
{% extends 'base.html' %}
|
|
|
|
{% block content %}
|
|
|
|
<section id="main" class="wrapper">
|
|
<div class="container">
|
|
<header class="major">
|
|
<h2>View Items</h2>
|
|
{% if request.user.is_authenticated %}
|
|
<a href="{% url 'list_items' %}?mine=true" class="button">Your Items</a>
|
|
<a href="{% url 'list_items' %}?{{ request.GET.urlencode }}&avail=true" class="button alt">Available Items</a>
|
|
<a href="{% url 'list_items' %}" class="button alt">All Items</a>
|
|
{% endif %}
|
|
<form method="GET" enctype="multipart/form-data" action="">
|
|
{% for field in search_form %}
|
|
<div class="fieldWrapper">
|
|
{{ field.errors }}
|
|
{{ field.label_tag }} {{ field }}
|
|
{% if field.help_text %}
|
|
<p class="help">{{ field.help_text|safe }}</p>
|
|
{% endif %}
|
|
</div>
|
|
{% endfor %}
|
|
</form>
|
|
</header>
|
|
<div id="item-search"></div>
|
|
{% if items %}
|
|
<table class="table">
|
|
<tr>
|
|
<th>ID</th>
|
|
<th>Available</th>
|
|
<th>Name</th>
|
|
<th>List Date</th>
|
|
<th>Whereabouts</th>
|
|
<th>Asking Price (XMR)</th>
|
|
<th>Bids</th>
|
|
</tr>
|
|
{% for item in items %}
|
|
<tr class="{% if item.owner == request.user %}item-mine{% endif %}">
|
|
<td>#{{ item.id }}</td>
|
|
<td style="text-align:center;">
|
|
{% if item.available %}
|
|
<i class="fa fa-thumbs-up" style="color:green;"></i>
|
|
{% else %}
|
|
<i class="fa fa-thumbs-down" style="color:red;"></i>
|
|
{% endif %}
|
|
</td>
|
|
<td><a href="{% url 'get_item' item.id %}">{{ item.name }}</a></td>
|
|
<td>{{ item.list_date | date:"d M, Y H:i:s" }}</td>
|
|
<td><a href="https://duckduckgo.com/?q={{ item.whereabouts }}" target="_blank">{{ item.whereabouts }}</a></td>
|
|
<td>{{ item.ask_price_xmr }}</td>
|
|
<td>{{ item.bids.all | length }}</td>
|
|
</tr>
|
|
{% endfor %}
|
|
</table>
|
|
{% else %}
|
|
<p>No results from the search. Try again!</p>
|
|
{% endif %}
|
|
</div>
|
|
</section>
|
|
|
|
{% if items.has_other_pages %}
|
|
<ul class="pagination">
|
|
{% if items.has_previous %}
|
|
<li><a href="?{{ request.GET.urlencode }}&page={{ items.previous_page_number }}">«</a></li>
|
|
{% else %}
|
|
<li class="disabled"><span>«</span></li>
|
|
{% endif %}
|
|
{% for i in items.paginator.page_range %}
|
|
{% if items.number == i %}
|
|
<li class="active"><span>{{ i }} <span class="sr-only"></span></span></li>
|
|
{% else %}
|
|
<li><a href="?{{ request.GET.urlencode }}&page={{ i }}">{{ i }}</a></li>
|
|
{% endif %}
|
|
{% endfor %}
|
|
{% if items.has_next %}
|
|
<li><a href="?{{ request.GET.urlencode}}&page={{ items.next_page_number }}">»</a></li>
|
|
{% else %}
|
|
<li class="disabled"><span>»</span></li>
|
|
{% endif %}
|
|
</ul>
|
|
{% endif %}
|
|
|
|
{% endblock %}
|