<?php
/* Group-by pivot selector for the Production/Quality breakdown. Included inside the card header.
 * Expects: $report, $from, $to, $f (filters), $allowedDims, $dimDefs, $by. Preserves filters on change. */
?>
<form method="GET" class="d-inline-flex align-items-center gap-1" style="margin:0">
    <input type="hidden" name="report" value="<?= e($report) ?>">
    <input type="hidden" name="from" value="<?= e($from) ?>">
    <input type="hidden" name="to" value="<?= e($to) ?>">
    <?php foreach ($f as $fk => $fv): if ($fv): ?><input type="hidden" name="<?= e($fk) ?>" value="<?= (int)$fv ?>"><?php endif; endforeach; ?>
    <span class="text-secondary">Group by</span>
    <select name="by" class="form-select form-select-sm" style="width:auto" onchange="this.form.submit()">
        <?php foreach ($allowedDims as $dk): ?><option value="<?= e($dk) ?>" <?= $by===$dk?'selected':'' ?>><?= e($dimDefs[$dk][0]) ?></option><?php endforeach; ?>
    </select>
</form>
