You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

94 lines
3.7 KiB

{% extends "base.html" %}
{% block title %}Payment Batches - Plutus{% endblock %}
{% block content %}
<div class="level">
<div class="level-left">
<h1 class="title">Payment Batches</h1>
</div>
</div>
{% if batches %}
<div class="table-container">
<table class="table is-fullwidth is-striped is-hoverable">
<thead>
<tr>
<th>Batch ID</th>
<th>Created</th>
<th>Total Payments</th>
<th>Payment Amount</th>
<th>Stripe Fees</th>
<th>Success Rate</th>
<th>Status</th>
<th>Actions</th>
</tr>
</thead>
<tbody>
{% for batch in batches %}
<tr>
<td>
<strong>#{{ batch.id }}</strong>
</td>
<td>{{ batch.Created.strftime('%Y-%m-%d %H:%M') if batch.Created else '-' }}</td>
<td>
<span class="tag is-info">{{ batch.payment_count or 0 }}</span>
</td>
<td>
<strong>{{ batch.total_amount | currency }}</strong>
</td>
<td>
{{ batch.total_fees | currency }}
</td>
<td>
{% if batch.payment_count and batch.payment_count > 0 %}
{% set success_rate = (batch.successful_count or 0) / batch.payment_count * 100 %}
{% if success_rate >= 90 %}
<span class="tag is-success">{{ "%.1f"|format(success_rate) }}%</span>
{% elif success_rate >= 70 %}
<span class="tag is-warning">{{ "%.1f"|format(success_rate) }}%</span>
{% else %}
<span class="tag is-danger">{{ "%.1f"|format(success_rate) }}%</span>
{% endif %}
{% else %}
<span class="tag">0%</span>
{% endif %}
</td>
<td>
<div class="tags">
{% if batch.successful_count %}
<span class="tag is-success is-small">{{ batch.successful_count }} Success</span>
{% endif %}
{% if batch.pending_count %}
<span class="tag is-warning is-small">{{ batch.pending_count }} Pending</span>
{% endif %}
{% if batch.failed_count %}
<span class="tag is-danger is-small">{{ batch.failed_count }} Failed</span>
{% endif %}
{% if batch.error_count %}
<span class="tag is-warning is-small">{{ batch.error_count }} Errors</span>
{% endif %}
{% if not batch.successful_count and not batch.failed_count %}
<span class="tag is-light is-small">No Payments</span>
{% endif %}
</div>
</td>
<td>
<a class="button is-primary is-small" href="{{ url_for('main.batch_detail', batch_id=batch.id) }}">
<span class="icon">
<i class="fas fa-eye"></i>
</span>
<span>View Details</span>
</a>
</td>
</tr>
{% endfor %}
</tbody>
</table>
</div>
{% else %}
<div class="notification is-info">
<p>No payment batches found. <a href="{{ url_for('main.index') }}">Return to dashboard</a>.</p>
</div>
{% endif %}
{% endblock %}