Show trades
parent
1e7d8f6c8d
commit
fa7ea66c65
@ -1 +1,2 @@
|
||||
from core.lib.schemas import agora_s # noqa
|
||||
from core.lib.schemas import nordigen_s # noqa
|
||||
|
@ -0,0 +1,86 @@
|
||||
from pydantic import BaseModel
|
||||
|
||||
|
||||
class ContactDataBuyerSeller(BaseModel):
|
||||
username: str
|
||||
name: str
|
||||
feedback_score: int
|
||||
trade_count: str
|
||||
last_online: str
|
||||
|
||||
|
||||
class ContactDataAd(BaseModel):
|
||||
payment_method: str
|
||||
trade_type: str
|
||||
advertiser: ContactDataBuyerSeller
|
||||
asset: str
|
||||
id: str
|
||||
|
||||
|
||||
class ContactData(BaseModel):
|
||||
buyer: ContactDataBuyerSeller
|
||||
seller: ContactDataBuyerSeller
|
||||
amount: str
|
||||
amount_xmr: str
|
||||
fee_xmr: str
|
||||
advertisement: ContactDataAd
|
||||
contact_id: str
|
||||
currency: str
|
||||
country: str
|
||||
account_info: str
|
||||
price_equation: str
|
||||
is_buying: bool
|
||||
is_selling: bool
|
||||
created_at: str
|
||||
escrowed_at: str
|
||||
funded_at: str
|
||||
canceled_at: str | None
|
||||
closed_at: str | None
|
||||
msg: str
|
||||
released_at: str | None
|
||||
payment_completed_at: str | None
|
||||
disputed_at: str | None
|
||||
arbitrated: bool
|
||||
transfer_to_seller_non_custodial_wallet_transaction_confirmations: str | None
|
||||
transfer_to_buyer_settlement_wallet_transaction_id: str | None
|
||||
transfer_to_buyer_settlement_wallet_transaction_key: str | None
|
||||
buyer_settlement_address: str | None
|
||||
buyer_settlement_fee_level: str | None
|
||||
seller_non_custodial_wallet_mnemonic: str | None
|
||||
transfer_to_seller_non_custodial_wallet_transaction_id: str | None
|
||||
|
||||
|
||||
class ContactActions(BaseModel):
|
||||
advertisement_public_view: str
|
||||
advertisement_url: str
|
||||
message_post_url: str
|
||||
messages_url: str
|
||||
release_url: str
|
||||
|
||||
|
||||
class Contact(BaseModel):
|
||||
data: ContactData
|
||||
actions: ContactActions
|
||||
|
||||
|
||||
class ResponseData(BaseModel):
|
||||
contact_count: int
|
||||
contact_list: list[Contact]
|
||||
|
||||
|
||||
class Response(BaseModel):
|
||||
data: ResponseData
|
||||
|
||||
|
||||
class Dashboard(BaseModel):
|
||||
success: bool
|
||||
message: str
|
||||
response: Response
|
||||
|
||||
|
||||
DashboardSchema = {
|
||||
"success": "success",
|
||||
"message": "message",
|
||||
"contact_count": "response.data.contact_count",
|
||||
"contact_list": "response.data.contact_list",
|
||||
}
|
@ -0,0 +1,82 @@
|
||||
{% 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 #}
|
Loading…
Reference in New Issue