<div id="page-wrapper">
<div class="container-fluid">
<div class="table widget">
    <div class="row">
                    <div class="col-lg-12">
                        <h3 class="page-header">
                            Survey List
                        </h3>
                         
                    </div>
                  
                    <div class="col-lg-4 pull-left">   
                             <div class="input-group"> 
                             <input type="text" name="search" id="search" placeholder="Enter Name or Username" class="form-control" style="width:70%;" onchange="search_faq();">      
                                <button onclick="search_faq();" class="input-group-addon btn btn-primary" style="width:30%; height:34px; border:0;">Search</button>
                             </div>
                    </div>
							
                   <!--<div class="col-lg-3 pull-right">
                      <a href="<?php echo site_url('user/user_form')?>" class="btn btn-primary pull-right" ><i class="fa fa-plus"></i> Add</a>
                    </div>-->
                    
    </div><br>

<!--<div class="col-lg-9"> -->
	<div class="widget">
    <div id="filters" style="margin-bottom:20px;">

 
		<div class="users" id="update-div">
			<table id="partner_details" class="display table table-striped table-bordered" cellspacing="0" width="100%">
        <thead>
            <tr>
              <th></th>
                <th>Sl.No.</th>
                <th>Name</th>
        <th>Taluk</th>
        <th>Grama Panchayath</th>
      
          <th>Date</th>     
     <th>Action</th>   
               

      <!--          <th> <label>
   <input type="checkbox" id="selectall"/>
    <span class="custom-check"></span>
   Select All
  </label>  <button onclick="select_all_approve_partner();" class="input-group-addon btn btn-primary" style="width:35%; height:26px; border:0;">Approve</button></th>

               <!-- <th><input type="checkbox" id="selectall" value=""> &nbsp  <button onclick="select_all_approve_partner();" class="input-group-addon btn btn-primary" style="width:35%; height:26px; border:0;padding: 0px;">Approve</button></th>-->

            </tr>
        </thead>
    </table>
   
   		</div>
      
    </div>
</div>
</div>
</div>
</div>

<script>
	//call_datatable();
</script>

                            <div id="pwdModal" class="modal fade" role="dialog">
                                <div class="modal-dialog"> 

                                <!-- Modal content-->
                                    <div class="modal-content">
                                        <div class="modal-header">
                                          <button type="button" class="close" data-dismiss="modal">&times;</button>
                                          <h3 class="modal-title text-center">Change Password</h3>
                                        </div>
                                        <div class="modal-body"> 
                                          <?php if ($this->session->flashdata('error')) { ?>
                                            <div class="alert alert-danger" role="alert"> <?php echo $this->session->flashdata('error'); ?></div>
                                          <?php } ?>
                                          <?php $attributes = array('id' => 'chng_pwd', 'name' => 'chng_pwd');
                                                echo form_open_multipart('', $attributes);
                                            ?>
                                                <div class="form-group">
                                                    <input type="password" class="form-control" name="password" maxlength="50"  id="password" required class="left"  placeholder="New Password" pattern=".{3,}" required title="Must have atleast 3 characters" onchange="this.setCustomValidity(this.validity.patternMismatch ? this.title : ''); if(this.checkValidity()) form.confirm_password.pattern = this.value;">
                                                </div>
                                                <div class="form-group">
                                                    <input type="password" class="form-control" name="confirm_pass"  maxlength="50" id="confirm_pass" class="left" required placeholder="Confirm New Password" required title="Both Passwords must be same" onchange="this.setCustomValidity(this.validity.patternMismatch ? this.title : '');">
                                                </div>
                                                <input type="hidden" name="uid" id="uid" value="" >
                                                  
                                                <div class="form-group text-center">
                                                    <input type="submit" name="submit" id="submit" value="SUBMIT" class="btn btn-primary">
                                                </div>
                                            </form>
                                            <div class="clearfix"></div>
                                            
                                            <p id="fail"></p>
                                        
                                </div>
                              </div>
                            </div>
</div>
<script src="<?php echo base_url()?>js/jquery.js"></script>
 <!-- Bootstrap Core JavaScript -->
<script src="<?php echo base_url()?>js/bootstrap.min.js"></script><link rel="stylesheet" href="<?php echo base_url();?>css/dataTables.bootstrap.min.css">
<script type="text/javascript" src="<?php echo base_url(); ?>js/jquery-ui.js"></script>
<script type="text/javascript" src="<?php echo base_url(); ?>js/jquery.dataTables.js"></script>
<script type="text/javascript" src="<?php echo base_url();?>js/dataTables.bootstrap.js"></script>
<script type="text/javascript" src="<?php echo base_url(); ?>js/pipeline.js"></script>
<script type="text/javascript">
$(document).ready(function(){

  search_faq();
  });


  
  function search_faq(){ 

    var user_type     =  $('#user_type').val();
    var search_value =  $('#search').val();
    $("#partner_details").dataTable().fnDestroy();
    call_datatable();
   
}
function call_datatable(){ 
    $("#partner_details").dataTable().fnDestroy();
    $('#partner_details').dataTable( {
        dom: 'T<"clear">lfrtip',
        bFilter: false,
        "processing": true,
        "serverSide": true,
        "stateSave": true,
       
        "ajax": $.fn.dataTable.pipeline( {
            url: "<?php echo site_url('userdata/get_usersdata_list') ?>",// get the parameters of your datatables using $_GET in your controller. Needed in order to implement filter (Search) in datatable. 
            method: 'POST',
            pages: 5, // number of pages to cache
            data: function ( d ) { 
                //d.user_type = $('#user_type').val();
                d.search_text = $('#search').val();
              //  d.districts = $('#districts').val();
              //  d.searchQuery = $('#searchQuery').val();
             //   d.searchQuery1 = $('#searchQuery1').val();
               // d.skills = $('#skills').val();
               d.<?php echo $this->security->get_csrf_token_name(); ?> = '<?php echo $this->security->get_csrf_hash(); ?>';
                
            }
        } ),
        
        "aoColumnDefs": [  
        { "bVisible": false, "aTargets":[0]}, 
        { "aTargets":[1] ,"mData": null,
         "bSortable": false, "mRender": function (data) { return data[6];}},
         { "aTargets":[2] ,"mData": null,
         "bSortable": false, "mRender": function (data) { return data[1];}},
         { "aTargets":[3] ,"mData": null,
         "bSortable": false, "mRender": function (data) { return data[3];}},
         { "aTargets":[4] ,"mData": null,
         "bSortable": false, "mRender": function (data) { return data[2];}},
         { "aTargets":[5] ,"mData": null,
         "bSortable": false, "mRender": function (data) { return data[4];}},
		
		  
      {
        "sWidth": "18%",
         "aTargets": [6],
         "mData": null,
         "bSortable": false,
         "mRender": function (data) { 
    
      return '<a class="btn fa fa-eye" href="<?php echo site_url()?>view_survey/'+data[5]+'" target="_blank" Title="View" ></i></a>';
        
     }
       }

     ],
    } ); 
}

/* 
function get_popup1(uid,rid){ 
         $.ajax({
            type: "POST",
            url: "<?php echo site_url('partner/view_partner_profile'); ?>",
            data: "user_id=" + uid +"&role_id=" + rid ,
            success: function (d)
            {
             // data=$.parseJSON(d)
              //$.each(data,function(i,e){
             //     alert(e.id);
             // });
       
              $('#test5').html(d);
            }
          });
}*/

function export_data()
{
        
        var url = "<?php echo site_url('userdata/export_data');?>"
        console.log(url);
          window.location = url;
    
} 
function activate_user(id)
{
  var response = confirm("Press 'Ok' to activate the User");
  if (response == true) {
  $.ajax({
              type: "POST",
              url: "<?php echo site_url('userdata/activate_user'); ?>",
              data: "user_id="+id+"&<?php echo $this->security->get_csrf_token_name(); ?>=<?php echo $this->security->get_csrf_hash(); ?>",
              success: function (msg)
              {
                $("#partner_details").dataTable().fnDestroy();
                call_datatable();
              }
          });
  }
}
function user_edit(id)
{
  
  $.ajax({
              type: "POST",
              url: "<?php echo site_url('userdata/edit_user'); ?>",
              data: "user_id="+id+"&<?php echo $this->security->get_csrf_token_name(); ?>=<?php echo $this->security->get_csrf_hash(); ?>",
              success: function (msg)
              { 
                // $("#partner_details").dataTable().fnDestroy();
                //call_datatable();
              }
          });
  
  
}
function get_popup(id){ 
        $("#fail").html('');
        $('#uid').val(id);
}






 </script>
