Update reports page

parent 6d547630
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
...@@ -52,7 +52,7 @@ ...@@ -52,7 +52,7 @@
<label for="start_date" class="form-label">Start Date</label> <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 }}"> <input type="date" class="form-control" id="start_date" name="start_date" value="{{ filters.start_date }}">
</div> </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> <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 }}"> <input type="time" class="form-control" id="start_time" name="start_time" value="{{ filters.start_time }}">
</div> </div>
...@@ -60,7 +60,7 @@ ...@@ -60,7 +60,7 @@
<label for="end_date" class="form-label">End Date</label> <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 }}"> <input type="date" class="form-control" id="end_date" name="end_date" value="{{ filters.end_date }}">
</div> </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> <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 }}"> <input type="time" class="form-control" id="end_time" name="end_time" value="{{ filters.end_time }}">
</div> </div>
...@@ -94,47 +94,79 @@ ...@@ -94,47 +94,79 @@
</div> </div>
</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">
<div class="card-body"> <div class="card-body">
{% if reports %} {% if clients %}
<div class="table-responsive"> <div class="table-responsive">
<table class="table table-striped table-hover"> <table class="table table-striped table-hover">
<thead> <thead>
<tr> <tr>
<th>Sync ID</th> <th>Client Name</th>
<th>Client</th> <th>Client ID</th>
<th>Sync Timestamp</th>
<th>Date Range</th>
<th>Total Payin</th> <th>Total Payin</th>
<th>Total Payout</th> <th>Total Payout</th>
<th>Balance</th> <th>Balance</th>
<th>CAP Balance</th>
<th>Total Bets</th> <th>Total Bets</th>
<th>Total Matches</th> <th>Total Matches</th>
<th>CAP Redistribution Balance</th>
<th>Actions</th> <th>Actions</th>
</tr> </tr>
</thead> </thead>
<tbody> <tbody>
{% for report in reports %} {% for client in clients %}
<tr> <tr>
<td><code>{{ report.sync_id }}</code></td> <td>{{ client.token_name }}</td>
<td>{{ report.client_id }}</td> <td><code>{{ client.client_id }}</code></td>
<td>{{ report.sync_timestamp.strftime('%Y-%m-%d %H:%M:%S') if report.sync_timestamp else '' }}</td> <td class="text-end">{{ "{:,.2f}".format(client.total_payin) }}</td>
<td>{{ report.date_range }}</td> <td class="text-end">{{ "{:,.2f}".format(client.total_payout) }}</td>
<td class="text-end">{{ "{:,.2f}".format(report.total_payin) if report.total_payin else '0.00' }}</td> <td class="text-end {% if client.balance >= 0 %}text-success{% else %}text-danger{% endif %}">
<td class="text-end">{{ "{:,.2f}".format(report.total_payout) if report.total_payout else '0.00' }}</td> {{ "{:,.2f}".format(client.balance) }}
<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> </td>
<td class="text-center">{{ client.total_bets }}</td>
<td class="text-center">{{ client.total_matches }}</td>
<td class="text-end text-info"> <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>
<td class="text-center">{{ report.total_bets }}</td>
<td class="text-center">{{ report.total_matches }}</td>
<td> <td>
<a href="{{ url_for('main.report_detail', sync_id=report.id) }}" class="btn btn-sm btn-info"> <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> View <i class="fas fa-eye"></i> Details
</a> </a>
</td> </td>
</tr> </tr>
...@@ -177,13 +209,13 @@ ...@@ -177,13 +209,13 @@
<p class="text-center text-muted"> <p class="text-center text-muted">
Showing {{ pagination.per_page * (pagination.page - 1) + 1 }} to Showing {{ pagination.per_page * (pagination.page - 1) + 1 }} to
{{ min(pagination.per_page * pagination.page, pagination.total) }} of {{ min(pagination.per_page * pagination.page, pagination.total) }} of
{{ pagination.total }} reports {{ pagination.total }} clients
</p> </p>
{% endif %} {% endif %}
{% else %} {% else %}
<div class="text-center py-5"> <div class="text-center py-5">
<i class="fas fa-file-alt fa-3x text-muted mb-3"></i> <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> <p class="text-muted">Try adjusting your filters or wait for clients to sync reports.</p>
</div> </div>
{% endif %} {% endif %}
...@@ -197,20 +229,20 @@ ...@@ -197,20 +229,20 @@
function toggleCustomDateRange() { function toggleCustomDateRange() {
var dateRange = document.getElementById('date_range').value; var dateRange = document.getElementById('date_range').value;
var customDateFields = document.getElementById('custom-date-fields'); var customDateFields = document.getElementById('custom-date-fields');
var customTimeFields = document.getElementById('custom-time-fields');
var customDateFieldsEnd = document.getElementById('custom-date-fields-end'); 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') { if (dateRange === 'custom') {
customDateFields.style.display = 'block'; customDateFields.style.display = 'block';
customTimeFields.style.display = 'block';
customDateFieldsEnd.style.display = 'block'; customDateFieldsEnd.style.display = 'block';
customTimeFieldsEnd.style.display = 'block'; timeFields.style.display = 'block';
timeFieldsEnd.style.display = 'block';
} else { } else {
customDateFields.style.display = 'none'; customDateFields.style.display = 'none';
customTimeFields.style.display = 'none';
customDateFieldsEnd.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