<?php defined('BASEPATH') OR exit('No direct script access allowed'); ?>
<?php
	$current_period = isset($filters['period']) ? (string)$filters['period'] : '';
	$current_employee = isset($filters['employee_id']) ? (int)$filters['employee_id'] : 0;
	$current_group = isset($filters['group_id']) ? (int)$filters['group_id'] : 0;
?>
<form method="get" class="filter-panel panel" style="padding:16px; margin-bottom:18px;">
	<select name="employee_id">
		<option value="0">Todos los empleados</option>
		<?php foreach ((array) $all_employees as $employee) { ?>
			<option value="<?php echo (int)$employee['person_id']; ?>" <?php echo $current_employee === (int)$employee['person_id'] ? 'selected' : ''; ?>>
				<?php echo htmlspecialchars($employee['full_name'], ENT_QUOTES, 'UTF-8'); ?>
			</option>
		<?php } ?>
	</select>
	<select name="group_id">
		<option value="0">Todos los grupos</option>
		<?php foreach ((array) $groups as $group) { ?>
			<option value="<?php echo (int)$group['id']; ?>" <?php echo $current_group === (int)$group['id'] ? 'selected' : ''; ?>>
				<?php echo htmlspecialchars($group['name'], ENT_QUOTES, 'UTF-8'); ?>
			</option>
		<?php } ?>
	</select>
	<input type="month" name="period" value="<?php echo htmlspecialchars($current_period, ENT_QUOTES, 'UTF-8'); ?>" />
	<button class="btn" type="submit">Aplicar filtros</button>
	<a class="btn btn-outline" href="<?php echo current_url(); ?>">Limpiar</a>
</form>
