Implement link groups

This commit is contained in:
2023-03-18 10:48:07 +00:00
parent 0723f14c53
commit bbd25c7450
13 changed files with 440 additions and 71 deletions

View File

@@ -272,7 +272,10 @@
Platform Connections
</a>
<a class="navbar-item" href="{% url 'wallets' type='page' %}">
Wallets
Profit Wallets
</a>
<a class="navbar-item" href="{% url 'linkgroups' type='page' %}">
Link Groups
</a>
</div>
</div>

View File

@@ -28,6 +28,19 @@
<td>{{ item.accounts|length }}</td>
<td>
<div class="buttons">
<button
hx-headers='{"X-CSRFToken": "{{ csrf_token }}"}'
hx-get="{% url 'requisition_update' type=type aggregator_id=pk req_id=item.id %}"
hx-trigger="click"
hx-target="#modals-here"
hx-swap="innerHTML"
class="button">
<span class="icon-text">
<span class="icon has-text-black" data-tooltip="Configure">
<i class="fa-solid fa-wrench"></i>
</span>
</span>
</button>
<button
hx-headers='{"X-CSRFToken": "{{ csrf_token }}"}'
hx-delete="{% url 'req_delete' type=type pk=pk req_id=item.id %}"

View File

@@ -0,0 +1,85 @@
{% load cache %}
{% load cachalot cache %}
{% get_last_invalidation 'core.LinkGroup' as last %}
{% include 'mixins/partials/notify.html' %}
{# cache 600 objects_linkgroups request.user.id object_list type last #}
<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>user</th>
<th>name</th>
<th>platform</th>
<th>requisition</th>
<th>operator</th>
<th>enabled</th>
<th>actions</th>
</thead>
{% for item in object_list %}
<tr>
<td>
<a
class="has-text-grey"
onclick="window.prompt('Copy to clipboard: Ctrl+C, Enter', '{{ item.id }}');">
<span class="icon" data-tooltip="Copy to clipboard">
<i class="fa-solid fa-copy" aria-hidden="true"></i>
</span>
</a>
</td>
<td>{{ item.user }}</td>
<td>{{ item.name }}</td>
<td>{{ item.platform_owner_cut_percentage }}</td>
<td>{{ item.requisition_owner_cut_percentage }}</td>
<td>{{ item.operator_cut_percentage }}</td>
<td>
{% if item.enabled %}
<span class="icon">
<i class="fa-solid fa-check"></i>
</span>
{% else %}
<span class="icon">
<i class="fa-solid fa-xmark"></i>
</span>
{% endif %}
</td>
<td>
<div class="buttons">
<button
hx-headers='{"X-CSRFToken": "{{ csrf_token }}"}'
hx-get="{% url 'linkgroup_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 'linkgroup_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>
{# endcache #}

View File

@@ -1,6 +1,6 @@
{% load cache %}
{% load cachalot cache %}
{% get_last_invalidation 'core.Platform' as last %}
{% get_last_invalidation 'core.Trade' 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 %}

View File

@@ -1,8 +1,8 @@
{% load cache %}
{% load cachalot cache %}
{% get_last_invalidation 'core.Ad' as last %}
{% get_last_invalidation 'core.Wallet' as last %}
{% include 'mixins/partials/notify.html' %}
{# cache 600 objects_ads request.user.id object_list type last #}
{# cache 600 objects_wallets request.user.id object_list type last #}
<table
class="table is-fullwidth is-hoverable"
hx-target="#{{ context_object_name }}-table"