<?php
$this->load->view('partials/report_start', $this->data);
$report = isset($report) ? $report : array();
$cardnumber = isset($cardnumber) ? $cardnumber : '';
?>
<form method="post">
  <div class="row filter-row align-items-end mb-3">
    <div class="col-md-4">
      <div class="form-group mb-0">
        <label>Cardnumber</label>
        <input type="text" class="form-control" name="cardnumber" value="<?php echo htmlspecialchars($cardnumber); ?>" required placeholder="Enter cardnumber">
      </div>
    </div>
    <div class="col-md-5">
      <p class="mb-0 text-muted small mt-4">Lookup one patron by cardnumber (same fields as User Report).</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> user record(s) for <strong><?php echo htmlspecialchars($cardnumber); ?></strong></p>
  <?php $this->load->view('partials/report_exports'); ?>
</div>
  <?php
  $this->load->view('partials/report_datatable', array(
      'columns' => array(
          'Cardnumber' => 'cardnumber',
          'Name' => 'Name',
          'Phone' => 'INT_Phone',
          'Enrollment Date' => 'dateenrolled',
          'Expiry Date' => 'dateexpiry',
          'Designation' => 'Designation',
          'Division' => 'Division',
          'Retired Transferred' => 'Retired_Transferred',
          'Category' => 'Category_Description',
      ),
      'rows' => $report,
      'table_id' => 'searchUserTable',
      'empty_message' => 'No user found for this cardnumber.',
  ));
  ?>
<?php } ?>
</form>
<?php $this->load->view('partials/report_end'); ?>
