<?php
$this->load->view('partials/report_start', $this->data);
$this->load->helper('report');
$report = isset($report) ? $report : array();
$barcode = isset($barcode) ? $barcode : '';
$columns = isset($columns) ? $columns : array();
?>
<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>Barcode / Accession No</label>
        <input type="text" class="form-control" name="barcode" value="<?php echo htmlspecialchars($barcode); ?>" required placeholder="Enter barcode">
      </div>
    </div>
    <div class="col-md-5">
      <p class="mb-0 text-muted small mt-4">Only columns with data are shown for the matching item.</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> record(s) for <strong><?php echo htmlspecialchars($barcode); ?></strong></p>
  <?php $this->load->view('partials/report_exports'); ?>
</div>
  <?php
  $this->load->view('partials/report_datatable', array(
      'columns' => $columns,
      'rows' => $report,
      'table_id' => 'searchCatalogueTable',
      'empty_message' => 'No catalogue item found for this barcode.',
  ));
  ?>
<?php } ?>
</form>
<?php $this->load->view('partials/report_end'); ?>
