<?php
$this->load->view('partials/report_start', $this->data);
$report = isset($report) ? $report : array();
$year = isset($year) ? $year : date('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>Publication Year</label>
        <input type="number" class="form-control" name="year" value="<?php echo htmlspecialchars($year); ?>" required min="1900" max="2100">
      </div>
    </div>
    <div class="col-md-6">
      <p class="mb-0 text-muted small mt-4">Publication Year Wise Report — items filtered by copyright / publisher year.</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> item(s) for year <strong><?php echo htmlspecialchars($year); ?></strong></p>
  <?php $this->load->view('partials/report_exports'); ?>
</div>
  <?php
  $this->load->view('partials/report_datatable', array(
      'columns' => array(
          'Barcode' => 'barcode',
          'D.O.Entry' => 'Date_of_Entry',
          'Call No' => 'itemcallnumber',
          'Title' => 'title',
          'Author' => 'author',
          'Item Type' => 'itype',
          'Home Branch' => 'homebranch',
          'Publisher Year' => 'Publisher_Year',
      ),
      'rows' => $report,
      'table_id' => 'publisherYearTable',
  ));
  ?>
<?php } ?>
</form>
<?php $this->load->view('partials/report_end'); ?>
