add pocket money count
This commit is contained in:
@@ -78,6 +78,18 @@
|
||||
}
|
||||
return map;
|
||||
});
|
||||
let pocketMoneyByMember = $derived.by(() => {
|
||||
const ws = (summary?.weekStart as string) || todayInTz(famTz);
|
||||
const pmIds = new Set(bonusConfigs.filter((c: any) => c.isPocketMoney).map((c: any) => c.id));
|
||||
const map = new Map<string, number>();
|
||||
for (const r of rewards as any[]) {
|
||||
if (!r.bonusConfigId || !pmIds.has(r.bonusConfigId)) continue;
|
||||
if ((r.date || '').slice(0, 10) < ws) continue;
|
||||
const entry = map.get(r.memberId) || 0;
|
||||
map.set(r.memberId, entry + 1);
|
||||
}
|
||||
return map;
|
||||
});
|
||||
|
||||
// ─── Trend chart window: show current month, expand a month at a time up to 3. ───
|
||||
let trend = $derived.by(() => {
|
||||
@@ -414,6 +426,10 @@
|
||||
>{goals?.count ?? 0}</span
|
||||
>
|
||||
</div>
|
||||
<div class="stat-row">
|
||||
<span class="stat-lbl">Pocket Money</span>
|
||||
<span class="stat-val pm">{pocketMoneyByMember.get(s.memberId) ?? 0}</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{/each}
|
||||
@@ -703,6 +719,9 @@
|
||||
.stat-val.goals {
|
||||
color: #059669;
|
||||
}
|
||||
.stat-val.pm {
|
||||
color: #d97706;
|
||||
}
|
||||
|
||||
/* ── Chart ── */
|
||||
.chart-wrap {
|
||||
|
||||
Reference in New Issue
Block a user