<?php
// Shared date filter for reports - expects $dateFrom, $dateTo from GET
$dateFrom = $_GET['date_from'] ?? date('Y-m-d', strtotime('-30 days'));
$dateTo = $_GET['date_to'] ?? date('Y-m-d');
?>
<div class="report-filters">
  <form method="get" class="row g-3 align-items-end">
    <div class="col-md-3">
      <label class="form-label">From Date</label>
      <input type="date" name="date_from" class="form-control" value="<?php echo htmlspecialchars($dateFrom); ?>">
    </div>
    <div class="col-md-3">
      <label class="form-label">To Date</label>
      <input type="date" name="date_to" class="form-control" value="<?php echo htmlspecialchars($dateTo); ?>">
    </div>
    <div class="col-md-4 d-flex gap-2">
      <button type="submit" class="btn btn-dark">Apply Filter</button>
      <a href="?" class="btn btn-outline-secondary">Reset</a>
    </div>
  </form>
</div>
