<?php defined('BASEPATH') or exit('No direct script access allowed'); ?>
<?php init_head(); ?>

<div id="wrapper">
  <div class="content">
    <div class="row">



<div class="col-md-12 tw-mb-3">
                <h4 class="tw-my-0 tw-font-bold tw-text-xl">
                  <?php echo _l('staff_integrity'); ?>
                </h4><br>
             <div class="_buttons tw-mb-2">
                 <?php if (staff_can('create','integrity_pact')) { ?>
                <a href="<?php echo admin_url('integrity_pact/create'); ?>"
                   class="btn btn-primary">
                  <i class="fa fa-plus"></i> <?php echo _l('staff_integrity_new'); ?>
                </a>
              <?php } ?>
 <?php if (is_admin() || staff_can('view',  'hc_compliance')) { ?>
                  <a class="btn btn-success" href="<?php echo admin_url('integrity_pact/export_excel/'.$year); ?>">
                    <i class="fa fa-file-excel-o"></i> Export Excel (CSV)
                  </a>
                <?php } ?>
              


         </div>
                
            </div>



      <div class="col-md-12">

        <div class="panel_s">
          <div class="panel-body">
            <div class="tw-flex tw-justify-between tw-items-center">
           

              
            </div>

            <hr class="hr-panel-heading" />

            <!--<div class="row mbot15">-->
              <!--<div class="col-md-3">-->
              <!--  <label>Year</label>-->
              <!--  <input type="number" id="filter_year" class="form-control" value="<?php echo (int)$year; ?>">-->
              <!--</div>-->
            <!--  <div class="col-md-3 mtop25">-->
                <!--<button class="btn btn-default" id="applyFilter">Apply</button>-->
            <!--    <?php if (is_admin()) { ?>-->
            <!--      <a class="btn btn-success" href="<?php echo admin_url('integrity_pact/export_excel/'.$year); ?>">-->
            <!--        <i class="fa fa-file-excel-o"></i> Export Excel (CSV)-->
            <!--      </a>-->
            <!--    <?php } ?>-->
            <!--  </div>-->
            <!--</div>-->

            <?php render_datatable([
              'ID',
              'Staff',
              'Staff No',
              'Department',
              'Year',
              'HOD Status',
              'Status',
              'Submitted',
              'Created',
            ], 'integrity-pact'); ?>

          </div>
        </div>

      </div>
    </div>
  </div>
</div>

<?php init_tail(); ?>
<script>
$(function(){
  var table = initDataTable('.table-integrity-pact', admin_url+'integrity_pact/table', undefined, undefined, undefined, [0,'desc']);

  $('#applyFilter').on('click', function(){
    var y = $('#filter_year').val() || '';
    var url = admin_url+'integrity_pact/manage?year='+encodeURIComponent(y);
    window.location.href = url;
  });
});
</script>
