pluto/core/templates/partials/platform-trades.html

82 lines
2.9 KiB
HTML
Raw Normal View History

2023-03-10 00:23:05 +00:00
{% load cache %}
{% load cachalot cache %}
{% get_last_invalidation 'core.Platform' as last %}
{% include 'mixins/partials/notify.html' %}
{# cache 600 objects_platform_trades request.user.id object_list type last #}
{% for platform_name, trade_map in object_list.items %}
<h2 class="title is-4">{{ platform_name }}</h2>
<table
class="table is-fullwidth is-hoverable"
hx-target="#{{ context_object_name }}-table"
id="{{ context_object_name }}-table"
hx-swap="outerHTML"
hx-trigger="{{ context_object_name_singular }}Event from:body"
hx-get="{{ list_url }}">
<thead>
<th>id</th>
<th>buyer</th>
<th>seller</th>
<th>amount</th>
<th>crypto</th>
<th>provider</th>
<th>type</th>
<th>actions</th>
</thead>
{% for item in trade_map.values %}
<tr>
<td>
<a
class="has-text-grey"
onclick="window.prompt('Copy to clipboard: Ctrl+C, Enter', '{{ item.data.contact_id }}/');">
<span class="icon" data-tooltip="Copy to clipboard">
<i class="fa-solid fa-copy" aria-hidden="true"></i>
</span>
</a>
</td>
<td data-tooltip="{{ item.data.buyer.name }}
Trades: {{ item.data.buyer.trade_count }}
Last online: {{ item.data.buyer.last_online }}">{{ item.data.buyer.username }}</td>
<td data-tooltip="{{ item.data.seller.name }}
Trades: {{ item.data.seller.trade_count }}
Last online: {{ item.data.seller.last_online }}">{{ item.data.seller.username }}</td>
<td>{{ item.data.amount }} {{ item.data.currency }}</td>
<td>{{ item.data.amount_xmr }} XMR</td>
<td>{{ item.data.advertisement.payment_method }}</td>
<td>{{ item.data.advertisement.trade_type }}</td>
<td>
<div class="buttons">
<button
hx-headers='{"X-CSRFToken": "{{ csrf_token }}"}'
hx-get="{# url 'platform_update' type=type pk=item.id #}"
hx-trigger="click"
hx-target="#{{ type }}s-here"
hx-swap="innerHTML"
class="button">
<span class="icon-text">
<span class="icon">
<i class="fa-solid fa-pencil"></i>
</span>
</span>
</button>
<button
hx-headers='{"X-CSRFToken": "{{ csrf_token }}"}'
hx-delete="{# url 'platform_delete' type=type pk=item.id #}"
hx-trigger="click"
hx-target="#modals-here"
hx-swap="innerHTML"
hx-confirm="Are you sure you wish to delete {{ item.name }}?"
class="button">
<span class="icon-text">
<span class="icon">
<i class="fa-solid fa-xmark"></i>
</span>
</span>
</button>
</div>
</td>
</tr>
{% endfor %}
</table>
{% endfor %}
{# endcache #}