<?php
$this->load->view('partials/report_start', $this->data);
$report = isset($report) ? $report : array();
$barcode = isset($barcode) ? $barcode : '';
?>
<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">Issue / return history for one 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> transaction(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' => array(
          'S.No' => 'S.No.',
          'ID No' => 'ID_No',
          'Name' => 'Name',
          'Designation' => 'Designation',
          'Acc No' => 'Acc_No',
          'Title' => 'Title',
          'Issue Date' => 'Issue_Date',
          'Renewal Count' => 'Renewal_Count',
          'Last Renewed' => 'lastreneweddate',
          'Due Date' => 'Due_Date',
          'Return Date' => 'Return_Date',
          'Status' => 'Current_Status',
      ),
      'rows' => $report,
      'table_id' => 'singleBookTable',
  ));
  ?>
<?php } ?>
</form>
<?php $this->load->view('partials/report_end'); ?>
