<?php
$this->load->view('partials/report_start', $this->data);
$report = isset($report) ? $report : array();
$basket_name = isset($basket_name) ? $basket_name : '';
?>
<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>Basket Name</label>
        <input type="text" class="form-control" name="basket_name" value="<?php echo htmlspecialchars($basket_name); ?>" required placeholder="Enter basket name">
      </div>
    </div>
    <div class="col-md-5">
      <p class="mb-0 text-muted small mt-4">Load voucher lines, then preview the CRV layout before export.</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> line(s) for basket <strong><?php echo htmlspecialchars($basket_name); ?></strong></p>
  <?php $this->load->view('partials/report_exports'); ?>
</div>
  <?php
  $this->load->view('partials/report_datatable', array(
      'columns' => array(
          'Acc No' => 'ACC_NO',
          'Author' => 'Author',
          'Title' => 'Title',
          'Publisher' => 'Publisher',
          'Year' => 'Publication_year',
          'ISBN' => 'ISBN',
          'Currency' => 'Currency_code',
          'Price' => 'RRP',
          'Discount' => 'Discount',
          'Basket' => 'Basket_Name',
      ),
      'rows' => $report,
      'table_id' => 'crvTable',
  ));
  $this->load->view('partials/report_preview');
  ?>
<?php } ?>
</form>
<?php $this->load->view('partials/report_end'); ?>
