implement rollover tracking + simple view session summary
This commit is contained in:
1 parent
3248731f51
commit
c24f7d5810
8 files changed
+348
-113
No files matched your search
@@ -15,8 +15,15 @@
|
||||
<h2>Add to the ledger</h2>
|
||||
|
||||
<label>
|
||||
<span>Session date</span>
|
||||
<input type="date" name="session_date" required>
|
||||
<span>Open session</span>
|
||||
<select name="session_id" required>
|
||||
<option value="">Select session</option>
|
||||
{% for session in open_sessions %}
|
||||
<option value="{{ session.session_id }}">
|
||||
{{ session_label(session) }}
|
||||
</option>
|
||||
{% endfor %}
|
||||
</select>
|
||||
</label>
|
||||
|
||||
<label>
|
||||
@@ -34,8 +41,10 @@
|
||||
<select name="event_type" required>
|
||||
<option value="buyin">Buy-in</option>
|
||||
<option value="front">Front</option>
|
||||
<option value="rollover_in">Rollover in</option>
|
||||
<option value="cashout">Cash-out</option>
|
||||
<option value="paid">Paid out</option>
|
||||
<option value="rollover_out">Rollover out</option>
|
||||
<option value="note">Note only</option>
|
||||
</select>
|
||||
</label>
|
||||
@@ -54,9 +63,9 @@
|
||||
</form>
|
||||
|
||||
<section class="grid">
|
||||
<form class="panel form-card" method="post" action="{{ url_for('admin_session_state') }}">
|
||||
<form class="panel form-card" method="post" action="{{ url_for('admin_open_session') }}">
|
||||
<p class="eyebrow">Session state</p>
|
||||
<h2>Open or close a session</h2>
|
||||
<h2>Open a new session</h2>
|
||||
|
||||
<label>
|
||||
<span>Session date</span>
|
||||
@@ -64,8 +73,7 @@
|
||||
</label>
|
||||
|
||||
<div class="button-row">
|
||||
<button class="primary-button" type="submit" name="state" value="open">Open session</button>
|
||||
<button class="secondary-button" type="submit" name="state" value="closed">Close session</button>
|
||||
<button class="primary-button" type="submit">Open session</button>
|
||||
</div>
|
||||
</form>
|
||||
|
||||
@@ -130,8 +138,8 @@
|
||||
{% for session in recent_sessions %}
|
||||
<tr>
|
||||
<td>
|
||||
<a href="{{ url_for('session_detail', session_date=session.session_date) }}">
|
||||
{{ session.session_date | pretty_date }}
|
||||
<a href="{{ url_for('session_detail', session_id=session.session_id) }}">
|
||||
{{ session_label(session) }}
|
||||
</a>
|
||||
</td>
|
||||
<td>{{ session.entries|length }}</td>
|
||||
@@ -144,7 +152,7 @@
|
||||
</td>
|
||||
<td>
|
||||
<form method="post" action="{{ url_for('admin_session_state') }}" class="inline-action-form">
|
||||
<input type="hidden" name="session_date" value="{{ session.session_date }}">
|
||||
<input type="hidden" name="session_id" value="{{ session.session_id }}">
|
||||
{% if session.status == "open" %}
|
||||
<button class="table-action-button" type="submit" name="state" value="closed">Close</button>
|
||||
{% else %}
|
||||
|
||||
@@ -14,8 +14,9 @@
|
||||
<article class="panel stat-card"><span>Win %</span><strong>{{ "%.1f"|format(player.win_pct) }}%</strong></article>
|
||||
<article class="panel stat-card"><span>ROI</span><strong>{{ "%.1f"|format(player.roi_pct) }}%</strong></article>
|
||||
<article class="panel stat-card"><span>Total invested</span><strong>{{ player.total_invested_cents | money }}</strong></article>
|
||||
<article class="panel stat-card"><span>Paid Buy-ins</span><strong>{{ player.total_buy_in_cents | money }}</strong></article>
|
||||
<article class="panel stat-card"><span>Paid Buy-in</span><strong>{{ player.total_buy_in_cents | money }}</strong></article>
|
||||
<article class="panel stat-card"><span>Fronted</span><strong>{{ player.total_front_cents | money }}</strong></article>
|
||||
<!--<article class="panel stat-card"><span>Rolled in</span><strong>{{ player.total_rollover_in_cents | money }}</strong></article>-->
|
||||
<article class="panel stat-card"><span>Cash-outs</span><strong>{{ player.total_cash_out_cents | money }}</strong></article>
|
||||
<article class="panel stat-card"><span>Sessions</span><strong>{{ player.sessions_played }}</strong></article>
|
||||
<article class="panel stat-card">
|
||||
@@ -84,6 +85,11 @@
|
||||
<div class="table-wrap">
|
||||
<table>
|
||||
<tbody>
|
||||
<tr><th>Paid Buy-ins</th><td>{{ player.total_buy_in_cents | money }}</td></tr>
|
||||
<tr><th>Fronted</th><td>{{ player.total_front_cents | money }}</td></tr>
|
||||
<tr><th>Rolled In</th><td>{{ player.total_rollover_in_cents | money }}</td></tr>
|
||||
<tr><th>Total Invested</th><td>{{ player.total_invested_cents | money }}</td></tr>
|
||||
<tr><th>Rolled Out</th><td>{{ player.total_rollover_out_cents | money }}</td></tr>
|
||||
<tr><th>Winning Sessions</th><td>{{ player.winning_sessions }}</td></tr>
|
||||
<tr><th>Losing Sessions</th><td>{{ player.losing_sessions }}</td></tr>
|
||||
<tr><th>Break-even Sessions</th><td>{{ player.break_even_sessions }}</td></tr>
|
||||
|
||||
@@ -5,16 +5,21 @@
|
||||
<div style="display: flex; justify-content: space-between;">
|
||||
<div>
|
||||
<p class="eyebrow">Session detail</p>
|
||||
<h1>{{ session.session_date | pretty_date }}</h1>
|
||||
<h1>{{ session_label(session) }}</h1>
|
||||
<p class="muted-text">Current totals are derived from the event log for this date.</p>
|
||||
</div>
|
||||
|
||||
<div style="align-content: center;">
|
||||
<div style="align-self: center;">
|
||||
{% if prev_session %}
|
||||
<a class="secondary-button" href="{{ url_for('session_detail', session_date=prev_session.session_date) }}">Previous Session</a>
|
||||
<a class="secondary-button" href="{{ url_for('session_detail', session_id=prev_session.session_id) }}">
|
||||
Previous Session
|
||||
</a>
|
||||
{% endif %}
|
||||
|
||||
{% if next_session %}
|
||||
<a class="secondary-button" href="{{ url_for('session_detail', session_date=next_session.session_date) }}">Next Session</a>
|
||||
<a class="secondary-button" href="{{ url_for('session_detail', session_id=next_session.session_id) }}">
|
||||
Next Session
|
||||
</a>
|
||||
{% endif %}
|
||||
</div>
|
||||
</div>
|
||||
@@ -22,8 +27,13 @@
|
||||
|
||||
<section class="grid payout-summary-grid">
|
||||
<article class="panel stat-card">
|
||||
<span>Total payout due</span>
|
||||
<strong>{{ session.total_payout_due_cents | money }}</strong>
|
||||
<span>Gross payout</span>
|
||||
<strong>{{ session.total_gross_payout_cents | money }}</strong>
|
||||
</article>
|
||||
|
||||
<article class="panel stat-card">
|
||||
<span>Total rolled out</span>
|
||||
<strong>{{ session.total_rollover_out_cents | money }}</strong>
|
||||
</article>
|
||||
|
||||
<article class="panel stat-card">
|
||||
@@ -32,17 +42,12 @@
|
||||
</article>
|
||||
|
||||
<article class="panel stat-card">
|
||||
<span>Total remaining</span>
|
||||
<strong class="{{ 'negative' if session.total_remaining_cents > 0 else 'positive' }}">
|
||||
{{ session.total_remaining_cents | money }}
|
||||
<span>Still owed</span>
|
||||
<strong class="{{ 'negative' if session.total_current_due_cents > 0 else 'positive' }}">
|
||||
{{ session.total_current_due_cents | money }}
|
||||
</strong>
|
||||
</article>
|
||||
|
||||
<article class="panel stat-card">
|
||||
<span>Total fronted</span>
|
||||
<strong>{{ session.total_front_cents | money }}</strong>
|
||||
</article>
|
||||
|
||||
<article class="panel stat-card">
|
||||
<span>Players still owe</span>
|
||||
<strong class="{{ 'negative' if session.total_player_owes_cents > 0 else '' }}">
|
||||
@@ -51,12 +56,22 @@
|
||||
</article>
|
||||
</section>
|
||||
|
||||
|
||||
<section class="panel results-panel results-panel-full">
|
||||
<div class="panel-header">
|
||||
<div>
|
||||
<p class="eyebrow">Results</p>
|
||||
<h2>Player totals</h2>
|
||||
</div>
|
||||
|
||||
<div class="table-toolbar">
|
||||
<button type="button" class="secondary-button table-view-toggle is-active" data-view="compact">
|
||||
Compact
|
||||
</button>
|
||||
<button type="button" class="secondary-button table-view-toggle" data-view="full">
|
||||
Full details
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="table-scroll table-scroll-open">
|
||||
@@ -64,13 +79,16 @@
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Player</th>
|
||||
<th>Buy-in</th>
|
||||
<th>Fronted</th>
|
||||
<th>Cash-out</th>
|
||||
<th>In</th>
|
||||
<th class="detail-col">Fronted</th>
|
||||
<th class="detail-col">Rolled in</th>
|
||||
<th>Out</th>
|
||||
<th>Net</th>
|
||||
<th class="detail-col">Gross due</th>
|
||||
<th class="detail-col">Paid</th>
|
||||
<th class="detail-col">Rolled out</th>
|
||||
<th>Still owed</th>
|
||||
<th>Status</th>
|
||||
<th>Paid</th>
|
||||
<th>Remaining</th>
|
||||
<th>Notes</th>
|
||||
</tr>
|
||||
</thead>
|
||||
@@ -82,21 +100,41 @@
|
||||
{{ entry.player_name }}
|
||||
</a>
|
||||
</td>
|
||||
<td>{{ entry.buy_in_cents | money }}</td>
|
||||
<td>{{ entry.front_cents | money }}</td>
|
||||
|
||||
<td>{{ entry.invested_cents | money }}</td>
|
||||
<td class="detail-col">{{ entry.front_cents | money }}</td>
|
||||
<td class="detail-col">{{ entry.rollover_in_cents | money }}</td>
|
||||
<td>{{ entry.cash_out_cents | money }}</td>
|
||||
|
||||
<td class="{{ 'positive' if entry.net_cents > 0 else 'negative' if entry.net_cents < 0 else '' }}">
|
||||
{{ entry.net_cents | money }}
|
||||
</td>
|
||||
|
||||
<td class="detail-col">
|
||||
{% if entry.player_owes_cents > 0 %}
|
||||
—
|
||||
{% else %}
|
||||
{{ entry.gross_payout_cents | money }}
|
||||
{% endif %}
|
||||
</td>
|
||||
|
||||
<td class="detail-col">{{ entry.paid_cents | money }}</td>
|
||||
<td class="detail-col">{{ entry.rollover_out_cents | money }}</td>
|
||||
|
||||
<td class="{% if entry.player_owes_cents > 0 %}negative{% elif entry.current_due_cents > 0 %}negative{% else %}positive{% endif %}">
|
||||
{% if entry.player_owes_cents > 0 %}
|
||||
Owes {{ entry.player_owes_cents | money }}
|
||||
{% else %}
|
||||
{{ entry.current_due_cents | money }}
|
||||
{% endif %}
|
||||
</td>
|
||||
|
||||
<td>
|
||||
<span class="status-badge status-{{ entry.payout_status }}">
|
||||
{{ entry.payout_status }}
|
||||
</span>
|
||||
</td>
|
||||
<td class="{{ 'positive' if entry.paid_cents > 0 else '' }}">{{ entry.paid_cents | money }}</td>
|
||||
<td class="{{ 'negative' if entry.payout_remaining_cents > 0 else '' }}">
|
||||
{{ entry.payout_remaining_cents | money }}
|
||||
</td>
|
||||
|
||||
<td>
|
||||
{% if entry.notes %}
|
||||
<ul class="note-list">
|
||||
@@ -270,4 +308,28 @@
|
||||
});
|
||||
}
|
||||
</script>
|
||||
|
||||
<script>
|
||||
const sessionTable = document.querySelector('.session-results-table');
|
||||
const viewButtons = document.querySelectorAll('.table-view-toggle');
|
||||
|
||||
if (sessionTable && viewButtons.length) {
|
||||
sessionTable.classList.add('compact');
|
||||
|
||||
viewButtons.forEach((button) => {
|
||||
button.addEventListener('click', () => {
|
||||
const view = button.dataset.view;
|
||||
|
||||
viewButtons.forEach((btn) => btn.classList.remove('is-active'));
|
||||
button.classList.add('is-active');
|
||||
|
||||
if (view === 'full') {
|
||||
sessionTable.classList.remove('compact');
|
||||
} else {
|
||||
sessionTable.classList.add('compact');
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
</script>
|
||||
{% endblock %}
|
||||
@@ -31,7 +31,7 @@
|
||||
<tbody>
|
||||
{% for session in sessions %}
|
||||
<tr>
|
||||
<td><a href="{{ url_for('session_detail', session_date=session.session_date) }}">{{ session.session_date | pretty_date }}</a></td>
|
||||
<td><a href="{{ url_for('session_detail', session_id=session.session_id) }}">{{ session_label(session) }}</a></td>
|
||||
<td><span class="status-badge status-{{ session.status }}">
|
||||
{{ session.status }}
|
||||
</span></td>
|
||||
|
||||
Reference in new issue
Block a user