Implement link group detail screen with profit simulation

This commit is contained in:
2023-03-18 14:06:50 +00:00
parent bbd25c7450
commit 8c490d6ee3
11 changed files with 292 additions and 21 deletions

View File

@@ -173,6 +173,7 @@
padding-right: 5px;
padding-left: 5px;
}
.grid-stack-item:hover .ui-resizable-handle {
display: block !important;
}
@@ -360,7 +361,7 @@
{% block outer_content %}
{% endblock %}
<section class="section">
<div class="container">
<div class="container is-widescreen">
{% block content_wrapper %}
{% block content %}
{% endblock %}

View File

@@ -10,6 +10,7 @@
<th>created</th>
<th>institution</th>
<th>accounts</th>
<th>payees</th>
<th>actions</th>
</thead>
{% for item in object_list %}
@@ -26,6 +27,11 @@
<td>{{ item.created }}</td>
<td>{{ item.institution_id }}</td>
<td>{{ item.accounts|length }}</td>
<td>
{% for payee in item.requisition.payees.all %}
{{ payee.name }}{% if not forloop.last %}, {% endif %}
{% endfor %}
</td>
<td>
<div class="buttons">
<button

View File

@@ -15,6 +15,7 @@
<th>user</th>
<th>name</th>
<th>service</th>
<th>link group</th>
<th>enabled</th>
<th>actions</th>
</thead>
@@ -32,6 +33,7 @@
<td>{{ item.user }}</td>
<td><a href="{% url 'reqs' type='page' pk=item.id %}">{{ item.name }}</a></td>
<td>{{ item.get_service_display }}</td>
<td>{{ item.link_group|default_if_none:"—" }}</td>
<td>
{% if item.enabled %}
<span class="icon">

View File

@@ -0,0 +1,130 @@
<h1 class="title">Information for link group {{ linkgroup.name }}</h1>
<div class="columns">
<div class="column">
<h1 class="title is-4">Platforms</h1>
{% include 'partials/platform-list.html' with object_list=platforms type=type %}
<h1 class="title is-4">Aggregators</h1>
{% include 'partials/aggregator-list.html' with object_list=aggregators type=type %}
<h1 class="title is-4">Requisitions</h1>
<table class="table is-fullwidth is-hoverable">
<thead>
<th>id</th>
<th>aggregator</th>
<th>payees</th>
</thead>
{% for item in requisitions %}
<tr>
<td>{{ item.id|truncatechars:20 }}</td>
<td>{{ item.aggregator.name }}</td>
<td>
{% for payee in item.payees.all %}
{{ payee.name }}{% if not forloop.last %}, {% endif %}
{% endfor %}
</td>
</tr>
{% endfor %}
</table>
</div>
<div class="column">
<h1 class="title is-4">Platform payees</h1>
<table class="table is-fullwidth is-hoverable">
<thead>
<th>name</th>
<th>address</th>
</thead>
{% for item in linkgroup.payees.platform %}
<tr>
<td>{{ item.name }}</td>
<td>{{ item.address }}</td>
</tr>
{% endfor %}
</table>
<h1 class="title is-4">Requisition payees</h1>
<table class="table is-fullwidth is-hoverable">
<thead>
<th>name</th>
<th>address</th>
</thead>
{% for item in linkgroup.payees.requisition %}
<tr>
<td>{{ item.name }}</td>
<td>{{ item.address }}</td>
</tr>
{% endfor %}
</table>
<h1 class="title is-4">Split</h1>
<table class="table is-fullwidth is-hoverable">
<thead>
<th>attribute</th>
<th>%</th>
<th>graphic</th>
</thead>
<tr>
<td>platform</td>
<td>{{ linkgroup.platform_owner_cut_percentage }}</td>
<td>
<progress class="progress" value="{{ linkgroup.platform_owner_cut_percentage }}" max="100"></progress>
</td>
</tr>
<tr>
<td>requisition</td>
<td>{{ linkgroup.requisition_owner_cut_percentage }}</td>
<td>
<progress class="progress" value="{{ linkgroup.requisition_owner_cut_percentage }}" max="100"></progress>
</td>
</tr>
<tr>
<td>operator</td>
<td>{{ linkgroup.operator_cut_percentage }}</td>
<td>
<progress class="progress" value="{{ linkgroup.operator_cut_percentage }}" max="100"></progress>
</td>
</tr>
</table>
</div>
</div>
<h1 class="title">Simulation for $1000</h1>
<p>Assuming equal throughput for platforms and requisitions.</p>
<div class="columns">
<div class="column">
<div class="content">
<ul>
{% for key, list in simulation.items %}
<li>
{{ key.0 }}: ${{ key.1 }}
<ul>
{% for item in list %}
<li>${{ item.amount }} to {{ item.name }} at <code>{{ item.address }}</code></li>
{% endfor %}
</ul>
</li>
{% endfor %}
</ul>
</div>
<h1 class="title is-4">Total for wallets</h1>
<div class="box">
{% for wallet, pay_list in pay_list.items %}
{{ wallet }}: ${{ pay_list.amount }}
<progress class="progress" value="{{ pay_list.amount }}" max="1000"></progress>
{% endfor %}
</div>
</div>
<div class="column">
<div class="box">
{% for key, list in simulation.items %}
<strong>{{ key.0 }}: ${{ key.1 }}</strong>
<progress class="progress" value="{{ key.1 }}" max="1000"></progress>
{% for item in list %}
<em>{{ item.name }}: ${{ item.amount }}</em><progress class="progress" value="{{ item.amount }}" max="{{ item.max }}"></progress>
{% endfor %}
{% endfor %}
</div>
</div>
</div>

View File

@@ -76,6 +76,15 @@
</span>
</span>
</button>
<a href="{% url 'linkgroup_info' type='page' pk=item.id %}"><button
class="button">
<span class="icon-text">
<span class="icon">
<i class="fa-solid fa-eye"></i>
</span>
</span>
</button>
</a>
</div>
</td>
</tr>

View File

@@ -1,4 +1,5 @@
{% load cache %}
{% load joinsep %}
{% load cachalot cache %}
{% get_last_invalidation 'core.Platform' as last %}
{% include 'mixins/partials/notify.html' %}
@@ -15,6 +16,8 @@
<th>user</th>
<th>name</th>
<th>service</th>
<th>payees</th>
<th>link group</th>
<th>enabled</th>
<th>actions</th>
</thead>
@@ -32,6 +35,12 @@
<td>{{ item.user }}</td>
<td>{{ item.name }}</td>
<td>{{ item.get_service_display }}</td>
<td>
{% for payee in item.payees.all %}
{{ payee.name }}{% if not forloop.last %}, {% endif %}
{% endfor %}
</td>
<td>{{ item.link_group|default_if_none:"—" }}</td>
<td>
{% if item.enabled %}
<span class="icon">