<?php
$this->load->view('partials/report_start', $this->data);
$report = isset($report) ? $report : array();
$fdate = isset($fdate) ? $fdate : date('d-m-Y', strtotime('-30 days'));
$tdate = isset($tdate) ? $tdate : date('d-m-Y');
?>
<form method="post">
  <div class="row filter-row align-items-end mb-3">
    <div class="col-md-3">
      <div class="form-group mb-0">
        <label>From Date</label>
        <input type="text" class="form-control js-date" name="fdate" value="<?php echo htmlspecialchars($fdate); ?>" required placeholder="dd-mm-yyyy" autocomplete="off">
      </div>
    </div>
    <div class="col-md-3">
      <div class="form-group mb-0">
        <label>To Date</label>
        <input type="text" class="form-control js-date" name="tdate" value="<?php echo htmlspecialchars($tdate); ?>" required placeholder="dd-mm-yyyy" autocomplete="off">
      </div>
    </div>
    <div class="col-md-3">
      <p class="mb-0 text-muted small mt-4">Reservations by reserve date range.</p>
    </div>
    <div class="col-md-3">
      <?php $this->load->view('partials/report_actions'); ?>
    </div>
  </div>
<?php if (!empty($searched)) { ?>
  <div class="report-results-toolbar">
  <p class="report-summary mb-0"><strong><?php echo count($report); ?></strong> reservation(s) from <?php echo htmlspecialchars($fdate); ?> to <?php echo htmlspecialchars($tdate); ?></p>
  <?php $this->load->view('partials/report_exports'); ?>
</div>
  <?php
  $this->load->view('partials/report_datatable', array(
      'columns' => array(
          'Cardnumber' => 'cardnumber',
          'Name' => 'patron_name',
          'Designation' => 'Designation',
          'Title' => 'title',
          'Author' => 'author',
          'Reserve Date' => 'reservedate',
          'Expiration Date' => 'expirationdate',
          'Hold Status' => 'hold_status',
      ),
      'rows' => $report,
      'table_id' => 'reservationTable',
  ));
  ?>
<?php } ?>
</form>
<?php $this->load->view('partials/report_end'); ?>
