<?php $this->load->view('includes/header'); ?>
<!-- PAGE TITLE -->
<div class="page-title">                    
  <h2><span ></span><?php echo $heading_title; ?></h2>
   <?php echo anchor("sitepanel/kisan_mitra/add/", "<span><i class='fa fa-plus'></i>Add Block Head</span>", 'class="btn btn-primary pull-right" '); ?></div>
</div>
<div class="row">
  <?php echo form_open("sitepanel/kisan_mitra", 'id="myForm" method="get"'); ?>
  <div class="col-md-8">
    <div class="panel panel-default">
      <div class="panel-body">
        <div class="table-responsive">

          <table  width="100%" align="center" bgcolor="#999999" border="0" cellspacing="1" cellpadding="3" >
            <tr bgcolor="#FFFFFF">
              <td colspan="3" width="100%" colspan="2" align="left"><strong style="font-size:14px">Search</strong></td>
            </tr>
            <tr bgcolor="#FFFFFF">
              <td width="30%" align="" ><strong>Keyword (Name, Email, Mobile No.)</strong></td>
              <td width="40%">
                <input type="text" name="keyword" />&nbsp;
                <input type="hidden" name="action" value="Seach" />
              </td>
              <td width="30%" colspan="2"><input type="submit" value="Search" /></td>
            </tr>
          </table>

        </div>
      </div>
    </div>
  </div>
  <div class="col-md-4">
    <div class="panel panel-default">
      <div class="panel-body">
        <div class="table-responsive">
          Records Per Page : <?php echo display_record_per_page(); ?> </div>
      </div>
    </div>
  </div>
  <?php echo form_close(); ?>
</div>

<!-- PAGE CONTENT WRAPPER -->
<div class="page-content-wrap">                
  <div class="row">
    <div class="col-md-12">
      <!-- START DEFAULT DATATABLE -->
      <div class="panel panel-default">
        <div class="panel-body">
          <div class="table-responsive">
            <?php
            if (count($pagelist) > 0) {
              echo form_open("sitepanel/kisan_mitra/", 'id="data_form"');
              ?>
              <table class="table datatable" id="my_data">
                <?php
                $atts = array(
                  'width' => '800',
                  'height' => '550',
                  'scrollbars' => 'yes',
                  'status' => 'yes',
                  'resizable' => 'yes',
                  'screenx' => '0',
                  'screeny' => '0'
              );
              ?>
                <thead>
                  <tr>
                    <th width="31" style="text-align: center;">
                      <input type="checkbox" onclick="$('input:checkbox').not(this).prop('checked', this.checked);" /></th>
                    <th>Name</th>
                    <th>Username</th>
                    <th>Password</th>
                    <th>District Head</th>
                    <th>Reg. Date</th>
                    <th>Status</th>
                    <th>Actions</th>
                  </tr>
                </thead>
                <tbody>
                  <?php
                  foreach ($pagelist as $catKey => $pageVal) {
                    ?>    
                    <tr>
                      <td><input type="checkbox" name="arr_ids[]" value="<?php echo $pageVal['admin_id']; ?>" /></td>
                      <td>
                        <?php echo '<b>Name : </b>'.$pageVal['admin_name']; ?><br />
                        <?php echo '<b>Email : </b>'.$pageVal['admin_email']; ?> <br />
                        <?php echo '<b>Mobile No. : </b>'.$pageVal['phone']; ?>             
                        <br /> <br /> 
                        <?php echo anchor_popup('sitepanel/kisan_mitra/details/' . $pageVal['admin_id'], 'View Details!', $atts); ?>
                        <?php /*<br /><br />
                        <?php //echo anchor_popup('sitepanel/kisan_mitra/ip_details/' . $pageVal['admin_id'], 'View Login Details!', $atts); ?>
                        <?php echo '<a href="'.site_url().'sitepanel/kisan_sahayak?kisan_mitra_id='.$pageVal['admin_id'].'" target="_blank">View Kisan Sahayak!</a>'; ?>&nbsp;
                        */ ?>
                        </td>
                      <td><?php echo $pageVal['admin_username']; ?></td>
                      <td><?php echo $pageVal['admin_password']; ?><?php //echo $this->safe_encrypt->decode($pageVal['password']); ?></td>
                      <td>
                      <?php //echo get_db_field_value("wps_admin","admin_name","where admin_id='".$pageVal['parent_admin_id']."'"); ?>
                      <?php echo get_db_field_value("wps_admin","admin_name","where admin_id='".$pageVal['district_head_id']."'"); ?>
                      </td>
                      <td><?php echo getDateFormat($pageVal['account_created_date'], 7); ?></td>
                      <td><?php echo ($pageVal['status'] == '1') ? "Active" : "Inactive"; ?></td>
                       <td><?php echo anchor("sitepanel/kisan_mitra/edit/".$pageVal['admin_id'], "Edit", 'class="btn btn-primary pull-right" '); ?></td> 
                    </tr>
                  <?php } ?>
                </tbody>
              </table>
              <table class="list" width="100%"> 
              <tr><td align="right"><?php echo $page_links; ?></td></tr>
                <tr>
                  <td align="left" style="padding:5px">
                    <input name="status_action" type="submit"  value="Activate" class="button2" id="Activate" onClick="return validcheckstatus('arr_ids[]', 'Activate', 'Record', 'u_status_arr[]');"/>
                    <input name="status_action" type="submit" class="button2" value="Deactivate" id="Deactivate"  onClick="return validcheckstatus('arr_ids[]', 'Deactivate', 'Record', 'u_status_arr[]');"/>
                    <input name="status_action" type="submit" class="button2" id="Delete" value="Delete"  onClick="return validcheckstatus('arr_ids[]', 'delete', 'Record');"/>
                    
                    <?php //echo form_dropdown("set_as", $this->config->item('member_set_as_config'), $this->input->post('set_as'), 'style="width:120px;" onchange="return onclickgroup()"'); ?>
                    <?php //echo form_dropdown("unset_as", $this->config->item('member_unset_as_config'), $this->input->post('unset_as'), 'style="width:120px;" onchange="return onclickgroup()"'); ?>
                  </td>
                </tr>
                </tbody>
              </table>
              <?php echo form_close(); ?>

            <?php } else { ?>
              <center><strong><?php echo "No Record(s) Found!"; ?></strong></center>
            <?php } ?>
          </div>
        </div>
      </div>
      <!-- END DEFAULT DATATABLE -->
    </div>
  </div>                                
</div>
<!-- PAGE CONTENT WRAPPER -->                                
</div>    
<!-- END PAGE CONTENT -->
</div>
<!-- END PAGE CONTAINER -->       
<!-- MESSAGE BOX-->
<div class="message-box animated fadeIn" data-sound="alert" id="mb-signout">
  <div class="mb-container">
    <div class="mb-middle">
      <div class="mb-title"><span class="fa fa-sign-out"></span> Log <strong>Out</strong> ?</div>
      <div class="mb-content">
        <p>Are you sure you want to log out?</p>                    
        <p>Press No if you want to continue work. Press Yes to logout current user.</p>
      </div>
      <div class="mb-footer">
        <div class="pull-right">
          <a href="pages-login.html" class="btn btn-success btn-lg">Yes</a>
          <button class="btn btn-default btn-lg mb-control-close">No</button>
        </div>
      </div>
    </div>
  </div>
</div>
<!-- END MESSAGE BOX-->
<?php $this->load->view('includes/footer'); ?>
<script type="text/javascript">
  function onclickgroup() {
    if (validcheckstatus('arr_ids[]', 'set', 'record', 'u_status_arr[]')) {
      $('#data_form').submit();
    }
  }
</script>
<script type="text/javascript">

  $('#pagesize').change(function () {
    $('#myForm').submit();
  });

  $('#my_data').dataTable({
    "bInfo": false, //Dont display info e.g. "Showing 1 to 4 of 4 entries"
    "paging": false, //Dont want paging                
    "bPaginate": false, //Dont want paging 
    "searching": false,
    "sort": false,
  })
</script>