{% extends 'wfbo/_layout.html.twig' %} {% block title %}Admin — WFBO{% endblock %} {% block wfbo_title %}Dashboard{% endblock %} {% block wfbo_content %} {# ── Overview row (static — no period filter) ── #}
{% if is_granted('ROLE_OPERATIONS') %}

Total Users

{{ totalUsers }}

Total Master Agents

{{ masterAgentCount }}

Total Agents

{{ agentCount }}

Total Sub Agents

{{ subAgentCount }}

{% endif %} {% if is_granted('ROLE_FINANCE') %}

Pending Deposits

{{ pendingDeposits }}

Review →

Pending Withdrawals

{{ pendingWithdrawals }}

Review →
{% endif %} {# Cash on Hand — ROLE_AUDITOR only (not Finance/Admin/Super-Admin). #} {% if is_granted('ROLE_AUDITOR') %}

Cash on Hand

₱{{ cashOnHand|number_format(2) }}

Today

View Report →
{% endif %} {% if is_granted('ROLE_FINANCE') %}

Wallet Balances

₱{{ walletBalancesByRole.total|number_format(2) }}

Players ₱{{ walletBalancesByRole.player|number_format(2) }}
Sub Agents ₱{{ walletBalancesByRole.subAgent|number_format(2) }}
Agents ₱{{ walletBalancesByRole.agent|number_format(2) }}
Master Agents ₱{{ walletBalancesByRole.masterAgent|number_format(2) }}
{% endif %}
{# ── Net revenue hourly trend (independent of the period filter below) ── #} {% if is_granted('ROLE_FINANCE') %}

Net Revenue Trend

{% endif %} {# ── Approved vs Rejected (10 AM to midnight) ── #} {% if is_granted('ROLE_FINANCE') %}

Approved Deposits & Withdrawals

1st Shift
2nd Shift
3rd Shift
Off Shift (12AM to 9AM)
Deposit = Deposit Approved  ·  Withdraw = Withdrawal Approved
{% endif %}
{# ── Period filter bar ── #} {% set presets = [ {key: 'today', label: 'Today'}, {key: 'yesterday', label: 'Yesterday'}, {key: 'this_week', label: 'This Week'}, {key: 'last_week', label: 'Last Week'}, {key: 'this_month', label: 'This Month'}, {key: 'last_month', label: 'Last Month'}, {key: 'this_year', label: 'This Year'}, {key: 'last_year', label: 'Last Year'}, ] %}
{% for p in presets %} {{ p.label }} {% endfor %} {# Custom month picker #}
{# JS converts 'YYYY-MM' → period=month_YYYY_MM on submit #}
{# Custom year picker #}
↻ Refresh
{# ── Financial stats row ── #} {% if is_granted('ROLE_FINANCE') or is_granted('ROLE_OPERATIONS') %}
{% if is_granted('ROLE_OPERATIONS') %}

Total Game Play

{{ stats.raceCount }}

{{ periodLabel }}

Active Players

{{ stats.activePlayers }}

{{ stats.activePlayersPercent }}% of {{ stats.playerPopulation|number_format }} players

{{ periodLabel }}

Players Registered

{{ stats.playersRegistered }}

{{ periodLabel }}

Players Logged In

{{ stats.playersLoggedIn }}

{{ periodLabel }}

{% endif %} {% if is_granted('ROLE_FINANCE') %} {% set tooltip = { betAmount: 'Total amount wagered by all players. This is turnover, not revenue.', commissions: 'Share of bets earned by agents and master agents from their referrals.', revenue: 'Actual income: Total Bets − Total Payout − Commissions.', winAmount: 'Total amount paid back to players as winnings. This cycles back from total bets.', payoutRate: 'Percentage of total bets returned to players as winnings.', } %} {% set financeCards = [ {key: 'betAmount', label: 'Total Bets', value: stats.betAmount, race: raceStats.betAmount, hl: hlStats.betAmount, cg: cgStats.betAmount, mn: mgStats.betAmount, fk: fkStats.betAmount, ez: ezStats.betAmount, pk: pkStats.betAmount, h2h: h2hStats.betAmount, lr: lrStats.betAmount}, {key: 'commissions', label: 'Commissions', value: stats.commissions, race: raceStats.commissions, hl: hlStats.commissions, cg: cgStats.commissions, mn: mgStats.commissions, fk: fkStats.commissions, ez: ezStats.commissions, pk: pkStats.commissions, h2h: h2hStats.commissions, lr: lrStats.commissions}, {key: 'revenue', label: 'Net Revenue', value: stats.revenue, race: raceStats.revenue, hl: hlStats.revenue, cg: cgStats.revenue, mn: mgStats.revenue, fk: fkStats.revenue, ez: ezStats.revenue, pk: pkStats.revenue, h2h: h2hStats.revenue, lr: lrStats.revenue}, ] %} {% for card in financeCards %}

{{ card.label }}

₱{{ card.value|number_format(2) }}

{{ periodLabel }}

VK: ₱{{ card.race|number_format(2) }} PT: ₱{{ card.hl|number_format(2) }} CG: ₱{{ card.cg|number_format(2) }} MN: ₱{{ card.mn|number_format(2) }} FK: ₱{{ card.fk|number_format(2) }} EZ: ₱{{ card.ez|default(0)|number_format(2) }} PK: ₱{{ card.pk|default(0)|number_format(2) }} H2H: ₱{{ card.h2h|default(0)|number_format(2) }} LR: ₱{{ card.lr|default(0)|number_format(2) }}
{% endfor %}

Total Payout

₱{{ stats.winAmount|number_format(2) }}

{{ periodLabel }}

VK: ₱{{ raceStats.winAmount|number_format(2) }} PT: ₱{{ hlStats.winAmount|number_format(2) }} CG: ₱{{ cgStats.winAmount|number_format(2) }} MN: ₱{{ mgStats.winAmount|number_format(2) }} FK: ₱{{ fkStats.winAmount|number_format(2) }} EZ: ₱{{ ezStats.winAmount|number_format(2) }} PK: ₱{{ pkStats.winAmount|number_format(2) }} H2H: ₱{{ h2hStats.winAmount|number_format(2) }} LR: ₱{{ lrStats.winAmount|number_format(2) }}

Payout Rate: {{ stats.winRate|number_format(2) }}%

Win vs Loss Rate

{{ periodLabel }}

Win Rate {{ stats.winRateByCount|number_format(2) }}%
VK: {{ raceWinRateByCount|number_format(2) }}% PT: {{ hlWinRateByCount|number_format(2) }}% CG: {{ cgWinRateByCount|number_format(2) }}% MN: {{ mgWinRateByCount|number_format(2) }}% FK: {{ fkWinRateByCount|number_format(2) }}% EZ: {{ ezWinRateByCount|number_format(2) }}% PK: {{ pkWinRateByCount|number_format(2) }}% H2H: {{ h2hWinRateByCount|number_format(2) }}% LR: {{ lrWinRateByCount|number_format(2) }}%
Loss Rate {{ stats.looseRateByCount|number_format(2) }}%
VK: {{ (100 - raceWinRateByCount)|round(2) }}% PT: {{ (100 - hlWinRateByCount)|round(2) }}% CG: {{ (100 - cgWinRateByCount)|round(2) }}% MN: {{ (100 - mgWinRateByCount)|round(2) }}% FK: {{ (100 - fkWinRateByCount)|round(2) }}% EZ: {{ (100 - ezWinRateByCount)|round(2) }}% PK: {{ (100 - pkWinRateByCount)|round(2) }}% H2H: {{ (100 - h2hWinRateByCount)|round(2) }}% LR: {{ (100 - lrWinRateByCount)|round(2) }}%

Deposit Requests

{{ periodLabel }}

Approved

{{ depositsApproved }}

₱{{ depositsApprovedAmount|number_format(2) }}

View →

Rejected

{{ depositsRejected }}

₱{{ depositsRejectedAmount|number_format(2) }}

View →

Withdrawal Requests

{{ periodLabel }}

Approved

{{ withdrawalsApproved }}

₱{{ withdrawalsApprovedAmount|number_format(2) }}

View →

Rejected

{{ withdrawalsRejected }}

₱{{ withdrawalsRejectedAmount|number_format(2) }}

View →
{% endif %}
{% endif %} {% endblock %} {% block javascripts %} {{ parent() }} {% endblock %}