update admin summary
This commit is contained in:
1 parent
c24f7d5810
commit
7cdd89ef2c
4 files changed
+102
-5
No files matched your search
@@ -448,6 +448,20 @@ def admin_dashboard():
|
|||||||
recent_sessions = sessions[:8]
|
recent_sessions = sessions[:8]
|
||||||
recent_events = list(reversed(events[-20:]))
|
recent_events = list(reversed(events[-20:]))
|
||||||
|
|
||||||
|
admin_totals = {
|
||||||
|
"cash_in_cents": sum(session.total_cash_in_cents for session in sessions),
|
||||||
|
"paid_out_cents": sum(session.total_paid_out_cents for session in sessions),
|
||||||
|
"still_owed_cents": sum(
|
||||||
|
session.total_current_due_cents for session in sessions
|
||||||
|
),
|
||||||
|
"players_owe_cents": sum(
|
||||||
|
session.total_player_owes_cents for session in sessions
|
||||||
|
),
|
||||||
|
"open_balance_cents": sum(
|
||||||
|
session.total_open_balance_cents for session in sessions
|
||||||
|
),
|
||||||
|
}
|
||||||
|
|
||||||
return render_template(
|
return render_template(
|
||||||
"admin_dashboard.html",
|
"admin_dashboard.html",
|
||||||
open_sessions=open_sessions,
|
open_sessions=open_sessions,
|
||||||
@@ -455,6 +469,7 @@ def admin_dashboard():
|
|||||||
recent_events=recent_events,
|
recent_events=recent_events,
|
||||||
player_names=unique_player_names(events),
|
player_names=unique_player_names(events),
|
||||||
session_label=session_label,
|
session_label=session_label,
|
||||||
|
admin_totals=admin_totals,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -1069,6 +1069,31 @@ td a:hover {
|
|||||||
display: none;
|
display: none;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.admin-cash-grid {
|
||||||
|
display: grid;
|
||||||
|
gap: 1rem;
|
||||||
|
grid-template-columns: repeat(5, minmax(0, 1fr));
|
||||||
|
margin-bottom: 1rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
@media (max-width: 1200px) {
|
||||||
|
.admin-cash-grid {
|
||||||
|
grid-template-columns: repeat(3, minmax(0, 1fr));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@media (max-width: 760px) {
|
||||||
|
.admin-cash-grid {
|
||||||
|
grid-template-columns: repeat(2, minmax(0, 1fr));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@media (max-width: 520px) {
|
||||||
|
.admin-cash-grid {
|
||||||
|
grid-template-columns: 1fr;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@media (max-width: 1100px) {
|
@media (max-width: 1100px) {
|
||||||
.payout-summary-grid {
|
.payout-summary-grid {
|
||||||
grid-template-columns: repeat(2, minmax(0, 1fr));
|
grid-template-columns: repeat(2, minmax(0, 1fr));
|
||||||
|
|||||||
@@ -146,6 +146,18 @@ class SessionSummary:
|
|||||||
def total_player_owes_cents(self) -> int:
|
def total_player_owes_cents(self) -> int:
|
||||||
return sum(entry.player_owes_cents for entry in self.entries)
|
return sum(entry.player_owes_cents for entry in self.entries)
|
||||||
|
|
||||||
|
@property
|
||||||
|
def total_cash_in_cents(self) -> int:
|
||||||
|
return sum(entry.buy_in_cents for entry in self.entries)
|
||||||
|
|
||||||
|
@property
|
||||||
|
def total_paid_out_cents(self) -> int:
|
||||||
|
return sum(entry.paid_cents for entry in self.entries)
|
||||||
|
|
||||||
|
@property
|
||||||
|
def total_open_balance_cents(self) -> int:
|
||||||
|
return self.total_current_due_cents - self.total_player_owes_cents
|
||||||
|
|
||||||
|
|
||||||
@dataclass
|
@dataclass
|
||||||
class PlayerStats:
|
class PlayerStats:
|
||||||
|
|||||||
@@ -115,6 +115,39 @@
|
|||||||
</section>
|
</section>
|
||||||
</section>
|
</section>
|
||||||
|
|
||||||
|
<section class="grid admin-cash-grid">
|
||||||
|
<article class="panel stat-card">
|
||||||
|
<span>Cash in</span>
|
||||||
|
<strong>{{ admin_totals.cash_in_cents | money }}</strong>
|
||||||
|
</article>
|
||||||
|
|
||||||
|
<article class="panel stat-card">
|
||||||
|
<span>Paid out</span>
|
||||||
|
<strong>{{ admin_totals.paid_out_cents | money }}</strong>
|
||||||
|
</article>
|
||||||
|
|
||||||
|
<article class="panel stat-card">
|
||||||
|
<span>Still owed</span>
|
||||||
|
<strong class="{{ 'negative' if admin_totals.still_owed_cents > 0 else 'positive' }}">
|
||||||
|
{{ admin_totals.still_owed_cents | money }}
|
||||||
|
</strong>
|
||||||
|
</article>
|
||||||
|
|
||||||
|
<article class="panel stat-card">
|
||||||
|
<span>Players owe</span>
|
||||||
|
<strong class="{{ 'negative' if admin_totals.players_owe_cents > 0 else '' }}">
|
||||||
|
{{ admin_totals.players_owe_cents | money }}
|
||||||
|
</strong>
|
||||||
|
</article>
|
||||||
|
|
||||||
|
<article class="panel stat-card">
|
||||||
|
<span>Open balance</span>
|
||||||
|
<strong class="{% if admin_totals.open_balance_cents > 0 %}negative{% elif admin_totals.open_balance_cents < 0 %}positive{% endif %}">
|
||||||
|
{{ admin_totals.open_balance_cents | money }}
|
||||||
|
</strong>
|
||||||
|
</article>
|
||||||
|
</section>
|
||||||
|
|
||||||
<section class="panel">
|
<section class="panel">
|
||||||
<div class="panel-header">
|
<div class="panel-header">
|
||||||
<div>
|
<div>
|
||||||
@@ -126,10 +159,13 @@
|
|||||||
<table>
|
<table>
|
||||||
<thead>
|
<thead>
|
||||||
<tr>
|
<tr>
|
||||||
<th>Date</th>
|
<th>Session</th>
|
||||||
<th>Players</th>
|
<th>Players</th>
|
||||||
<th>Buy-ins</th>
|
<th>Cash in</th>
|
||||||
<th>Cash-outs</th>
|
<th>Paid out</th>
|
||||||
|
<th>Still owed</th>
|
||||||
|
<th>Players owe</th>
|
||||||
|
<th>Open balance</th>
|
||||||
<th>Status</th>
|
<th>Status</th>
|
||||||
<th>Action</th>
|
<th>Action</th>
|
||||||
</tr>
|
</tr>
|
||||||
@@ -143,8 +179,17 @@
|
|||||||
</a>
|
</a>
|
||||||
</td>
|
</td>
|
||||||
<td>{{ session.entries|length }}</td>
|
<td>{{ session.entries|length }}</td>
|
||||||
<td>{{ session.total_buy_in_cents | money }}</td>
|
<td>{{ session.total_cash_in_cents | money }}</td>
|
||||||
<td>{{ session.total_cash_out_cents | money }}</td>
|
<td>{{ session.total_paid_out_cents | money }}</td>
|
||||||
|
<td class="{{ 'negative' if session.total_current_due_cents > 0 else 'positive' }}">
|
||||||
|
{{ session.total_current_due_cents | money }}
|
||||||
|
</td>
|
||||||
|
<td class="{{ 'negative' if session.total_player_owes_cents > 0 else '' }}">
|
||||||
|
{{ session.total_player_owes_cents | money }}
|
||||||
|
</td>
|
||||||
|
<td class="{% if session.total_open_balance_cents > 0 %}negative{% elif session.total_open_balance_cents < 0 %}positive{% endif %}">
|
||||||
|
{{ session.total_open_balance_cents | money }}
|
||||||
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<span class="status-badge status-{{ session.status }}">
|
<span class="status-badge status-{{ session.status }}">
|
||||||
{{ session.status }}
|
{{ session.status }}
|
||||||
|
|||||||
Reference in new issue
Block a user