<?php ob_start(); ?>
<div class="card">
  <div class="toolbar">
    <h2>Dashboard</h2>
    <div class="filters">
      <form method="get" style="display:flex;gap:8px;align-items:center">
        <input type="hidden" name="controller" value="dashboard"><input type="hidden" name="action" value="index">
        <select name="month"><?php for($m=1;$m<=12;$m++): ?><option value="<?=$m?>" <?=($m==$month?'selected':'')?>><?=date('F', mktime(0,0,0,$m,1))?></option><?php endfor; ?></select>
        <select name="year"><?php for($y=date('Y')-5;$y<=date('Y')+1;$y++): ?><option value="<?=$y?>" <?=($y==$year?'selected':'')?>><?=$y?></option><?php endfor; ?></select>
        <button type="submit">Go</button>
      </form>
    </div>
  </div>
  <div style="display:flex;gap:18px;flex-wrap:wrap;margin-top:12px">
    <div style="flex:1;min-width:180px" class="card"><h4>This month income</h4><p style="font-size:18px">&#8377; <?=number_format($incomeSum,2)?></p></div>
    <div style="flex:1;min-width:180px" class="card"><h4>This month expense</h4><p style="font-size:18px">&#8377; <?=number_format($expenseSum,2)?></p></div>
    <div style="flex:1;min-width:180px" class="card"><h4>Net</h4><p style="font-size:18px">&#8377; <?=number_format($incomeSum-$expenseSum,2)?></p></div>
  </div>
</div>
<?php $content = ob_get_clean(); include __DIR__ . '/../layout.php'; ?>
