Update reports page

parent 6d547630
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
......@@ -52,7 +52,7 @@
<label for="start_date" class="form-label">Start Date</label>
<input type="date" class="form-control" id="start_date" name="start_date" value="{{ filters.start_date }}">
</div>
<div class="col-md-1" id="custom-time-fields" style="display: none;">
<div class="col-md-1" id="time-fields">
<label for="start_time" class="form-label">Start Time</label>
<input type="time" class="form-control" id="start_time" name="start_time" value="{{ filters.start_time }}">
</div>
......@@ -60,7 +60,7 @@
<label for="end_date" class="form-label">End Date</label>
<input type="date" class="form-control" id="end_date" name="end_date" value="{{ filters.end_date }}">
</div>
<div class="col-md-1" id="custom-time-fields-end" style="display: none;">
<div class="col-md-1" id="time-fields-end">
<label for="end_time" class="form-label">End Time</label>
<input type="time" class="form-control" id="end_time" name="end_time" value="{{ filters.end_time }}">
</div>
......@@ -94,47 +94,79 @@
</div>
</div>
<!-- Reports Table -->
<!-- Summary Blocks -->
<div class="row mb-4">
<div class="col-md-3">
<div class="card bg-primary text-white">
<div class="card-body">
<h6 class="card-title mb-2">Total Payin</h6>
<h3 class="mb-0">{{ "{:,.2f}".format(totals.total_payin if totals.total_payin else 0.00) }}</h3>
</div>
</div>
</div>
<div class="col-md-3">
<div class="card bg-info text-white">
<div class="card-body">
<h6 class="card-title mb-2">Total Payout</h6>
<h3 class="mb-0">{{ "{:,.2f}".format(totals.total_payout if totals.total_payout else 0.00) }}</h3>
</div>
</div>
</div>
<div class="col-md-3">
<div class="card {% if totals.total_balance >= 0 %}bg-success{% else %}bg-danger{% endif %} text-white">
<div class="card-body">
<h6 class="card-title mb-2">Balance</h6>
<h3 class="mb-0">{{ "{:,.2f}".format(totals.total_balance if totals.total_balance else 0.00) }}</h3>
</div>
</div>
</div>
<div class="col-md-3">
<div class="card bg-warning text-white">
<div class="card-body">
<h6 class="card-title mb-2">CAP Redistribution Balance</h6>
<h3 class="mb-0">{{ "{:,.2f}".format(totals.cap_balance if totals.cap_balance else 0.00) }}</h3>
</div>
</div>
</div>
</div>
<!-- Clients Table -->
<div class="card">
<div class="card-body">
{% if reports %}
{% if clients %}
<div class="table-responsive">
<table class="table table-striped table-hover">
<thead>
<tr>
<th>Sync ID</th>
<th>Client</th>
<th>Sync Timestamp</th>
<th>Date Range</th>
<th>Client Name</th>
<th>Client ID</th>
<th>Total Payin</th>
<th>Total Payout</th>
<th>Balance</th>
<th>CAP Balance</th>
<th>Total Bets</th>
<th>Total Matches</th>
<th>CAP Redistribution Balance</th>
<th>Actions</th>
</tr>
</thead>
<tbody>
{% for report in reports %}
{% for client in clients %}
<tr>
<td><code>{{ report.sync_id }}</code></td>
<td>{{ report.client_id }}</td>
<td>{{ report.sync_timestamp.strftime('%Y-%m-%d %H:%M:%S') if report.sync_timestamp else '' }}</td>
<td>{{ report.date_range }}</td>
<td class="text-end">{{ "{:,.2f}".format(report.total_payin) if report.total_payin else '0.00' }}</td>
<td class="text-end">{{ "{:,.2f}".format(report.total_payout) if report.total_payout else '0.00' }}</td>
<td class="text-end {% if (report.total_payin - report.total_payout) >= 0 %}text-success{% else %}text-danger{% endif %}">
{{ "{:,.2f}".format(report.total_payin - report.total_payout) if report.total_payin and report.total_payout else '0.00' }}
<td>{{ client.token_name }}</td>
<td><code>{{ client.client_id }}</code></td>
<td class="text-end">{{ "{:,.2f}".format(client.total_payin) }}</td>
<td class="text-end">{{ "{:,.2f}".format(client.total_payout) }}</td>
<td class="text-end {% if client.balance >= 0 %}text-success{% else %}text-danger{% endif %}">
{{ "{:,.2f}".format(client.balance) }}
</td>
<td class="text-center">{{ client.total_bets }}</td>
<td class="text-center">{{ client.total_matches }}</td>
<td class="text-end text-info">
{{ "{:,.2f}".format(report.cap_compensation_balance) if report.cap_compensation_balance else '0.00' }}
{{ "{:,.2f}".format(client.cap_balance) }}
</td>
<td class="text-center">{{ report.total_bets }}</td>
<td class="text-center">{{ report.total_matches }}</td>
<td>
<a href="{{ url_for('main.report_detail', sync_id=report.id) }}" class="btn btn-sm btn-info">
<i class="fas fa-eye"></i> View
<a href="{{ url_for('main.client_report_detail', client_id=client.client_id, **filters) }}" class="btn btn-sm btn-info">
<i class="fas fa-eye"></i> Details
</a>
</td>
</tr>
......@@ -175,15 +207,15 @@
</ul>
</nav>
<p class="text-center text-muted">
Showing {{ pagination.per_page * (pagination.page - 1) + 1 }} to
{{ min(pagination.per_page * pagination.page, pagination.total) }} of
{{ pagination.total }} reports
Showing {{ pagination.per_page * (pagination.page - 1) + 1 }} to
{{ min(pagination.per_page * pagination.page, pagination.total) }} of
{{ pagination.total }} clients
</p>
{% endif %}
{% else %}
<div class="text-center py-5">
<i class="fas fa-file-alt fa-3x text-muted mb-3"></i>
<h4 class="text-muted">No reports found</h4>
<h4 class="text-muted">No clients found</h4>
<p class="text-muted">Try adjusting your filters or wait for clients to sync reports.</p>
</div>
{% endif %}
......@@ -197,20 +229,20 @@
function toggleCustomDateRange() {
var dateRange = document.getElementById('date_range').value;
var customDateFields = document.getElementById('custom-date-fields');
var customTimeFields = document.getElementById('custom-time-fields');
var customDateFieldsEnd = document.getElementById('custom-date-fields-end');
var customTimeFieldsEnd = document.getElementById('custom-time-fields-end');
var timeFields = document.getElementById('time-fields');
var timeFieldsEnd = document.getElementById('time-fields-end');
if (dateRange === 'custom') {
customDateFields.style.display = 'block';
customTimeFields.style.display = 'block';
customDateFieldsEnd.style.display = 'block';
customTimeFieldsEnd.style.display = 'block';
timeFields.style.display = 'block';
timeFieldsEnd.style.display = 'block';
} else {
customDateFields.style.display = 'none';
customTimeFields.style.display = 'none';
customDateFieldsEnd.style.display = 'none';
customTimeFieldsEnd.style.display = 'none';
timeFields.style.display = 'none';
timeFieldsEnd.style.display = 'none';
}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment