{# Live region of the Pusoy Dos monitor. Rendered inside monitor.html.twig on first
load AND standalone by WfboController::pusoyMonitorData(), re-fetched by the
pd-monitor Stimulus controller every 3s (innerHTML swap of this output only). #}
{% macro card(c) %}{{ pusoy_card(c) }}{% endmacro %}
{% macro money(v) %}₱{{ v|number_format(2) }}{% endmacro %}
{% macro ago(s) %}{{ s is null ? '—' : (s < 60 ? s ~ 's' : (s < 3600 ? (s // 60) ~ 'm' : (s // 3600) ~ 'h')) }}{% endmacro %}
{% macro awayReason(r) %}{{ {offline: 'offline', timeouts: '3 timeouts', left: 'left'}[r] ?? r }}{% endmacro %}
{% import _self as m %}
{% set k = kpis %}
{% set cards = [
{key: 'entries', label: 'Entries Today', value: m.money(k.entries), sub: k.entryCount ~ ' paid seats · ' ~ k.paidHands ~ ' hands'},
{key: 'payouts', label: 'Payouts', value: m.money(k.payouts), sub: 'pots paid to winners'},
{key: 'fee', label: 'House Fee', value: m.money(k.houseFee), sub: 'entries − payouts'},
{key: 'comm', label: 'Commission', value: m.money(k.commissions), sub: 'agents\' share'},
{key: 'revenue', label: 'Net Revenue', value: m.money(k.revenue), sub: 'incl. test: ' ~ m.money(k.revenueAll), amount: k.revenue},
{key: 'hands', label: 'Hands Dealt', value: k.handsDealt, sub: 'today, free tables incl.'},
{key: 'online', label: 'Players Online', value: counts.online, sub: counts.players ~ ' in the game'},
{key: 'tables', label: 'Open Tables', value: counts.tables, sub: counts.playingTables ~ ' playing · ' ~ counts.privateTables ~ ' private'},
{key: 'tiers', label: 'Tables by Tier', value: counts.tablesByTier.bronze ~ ' / ' ~ counts.tablesByTier.silver ~ ' / ' ~ counts.tablesByTier.gold, sub: 'bronze / silver / gold · free ' ~ counts.tablesByTier.free},
{key: 'queue', label: 'In Queue', value: counts.queued, sub: 'waiting for a seat'},
] %}
{% for c in cards %}
{{ c.label }}
{{ c.value }}
{{ c.key == 'entries' ? 'incl. test: ' ~ m.money(k.entriesAll) ~ ' · ' : '' }}{{ c.sub }}
{% endfor %}
{% for a in alerts %}
{{ a.text }}
{% endfor %}
{% set playingTables = tables|filter(t => t.status == 'playing') %}
Playing tables ({{ playingTables|length }}){{ tables|length }} open
{% if focus %}
{% set t = focus.table %}
Table #{{ t.id }} · {{ t.tier }}{{ t.private ? ' · private ' ~ t.code ~ ' · host ' ~ (t.hostName ?? '—') }} · {{ t.seatCount }} seats · {{ t.handCount }} hand{{ t.handCount == 1 ? '' : 's' }}
{% if t.handId %}Hand #{{ t.handId }} ↗{% endif %}
{% if t.canClose %}{% endif %}
✕ Close
{% if t.prize is not null %}
Pot {{ m.money(t.prize) }}
{% else %}
Free table
{% endif %}
{% if t.status == 'playing' %}
{% if t.lead %}
{% for c in t.lead.cards %}{{ m.card(c) }}{% endfor %}
{{ t.seats[t.lead.seat].name ?? '' }} · {{ (t.lead.type ?? '')|replace({'_': ' '}) }}
{% else %}
{{ t.openingPlay ? 'Opening play (' ~ pusoy_card(t.openingCard) ~ ')' : 'New lead' }}
{% endif %}
Hand #{{ t.handId }} · {{ m.ago(t.dealtAgo) }} in{{ t.deadCount ? ' · ' ~ t.deadCount ~ ' face down' }}
{% elseif t.status == 'results' %}
{% if t.deadCards is not empty %}
Face down: {% for c in t.deadCards %}{{ m.card(c) }}{% endfor %}
{% endif %}
Hand #{{ t.handId }} over{% if t.nextHandIn is not null %} · next in {{ t.nextHandIn }}s{% elseif t.private %} · host deals{% endif %}
{% else %}
Waiting · {{ t.playersHere }}/{{ t.seatCount }} here
{% if t.nextHandIn is not null %}
Dealing in {{ t.nextHandIn }}s
{% endif %}
{% endif %}
{% if t.stalledFor is not null %}
Stalled {{ t.stalledFor }}s
{% endif %}
{% for s in t.seats %}
{% if s.cardCount is not null and s.cards is empty %}
{% for i in 1..min(s.cardCount, 13) %}{% if s.cardCount > 0 %}{% endif %}{% endfor %}
{{ s.cardCount }}
{% endif %}
{% if s.cards is not empty %}
{% for c in s.cards %}{{ m.card(c) }}{% endfor %}
{% endif %}
{% if s.userId %}
{{ s.name }}{% else %}{{ s.empty ? 'Open seat' : s.name }}{% endif %}
{% if s.ip %}
{{ s.ip }}
{% endif %}
{% if s.turn %}Turn{{ t.secondsLeft is not null ? ' ' ~ t.secondsLeft ~ 's' }}{% endif %}
{% if s.placement == 1 %}Won{{ s.payout ? ' ' ~ m.money(s.payout) }}{% elseif s.placement %}#{{ s.placement }}{% endif %}
{% if s.away %}Away{{ s.awayReason ? ' · ' ~ m.awayReason(s.awayReason) }}{% elseif s.offline %}Offline {{ m.ago(s.lastSeen) }}{% endif %}
{% if s.waiting %}Waiting{% endif %}
{% if s.leaving %}Leaving{% endif %}
{% if s.short %}Low balance{% endif %}
{% endfor %}
{% else %}
{{ focusMissing ? 'That table has closed.' : 'Pick a table to watch the game' }}
Click any table in the list on the left.
{% endif %}
Live chat · all tables + lobby{{ chatEnabled ? '' : 'Chat is switched off' }}
{% set offlineLong = players|filter(p => not p.online and not p.leaving and p.lastSeen >= kickOfflineMinutes * 60)|length %}
Players in the game ({{ players|length }})
Updated {{ now|date('H:i:s') }} · refreshes every 3s