EVOLUTION-NINJA
Edit File: sa_admin_list.php
<?php $this->load->view('includes/sa_header');?> <section class="mid_work_one"> <div class="container"> <div class="row middle_container"> <button type="button" style="float:right;margin-right: 1%;" onclick="doit('xlsx')" class="btn btn-primary btn-sm">Export</button> <h4 class="list_head" style="border-bottom: 1px solid #555;margin-bottom:20px;">List of iAdmins</h4> <div class="table1 table-responsive"> <table class="table prio_table dataTable no-footer"> <thead> <tr> <th>Sl No</th> <th>Name</th> <th>Email Id</th> <th>Designation</th> <th>Contact Number</th> <th>Clients</th> <th>Action</th> </tr> </thead> <tbody> <?php foreach($user as $key => $value) { ?> <tr class="row<?php echo $value['user_id'];?>"> <td><?php echo $key+1; ?></td> <td><?php echo $value['first_name']; ?></td> <td><?php echo $value['email']; ?></td> <td><?php echo $value['designation']; ?></td> <td><?php echo $value['mobile_no']; ?></td> <td> <a href="#" onclick="client_list(<?php echo $value['user_id'];?>);"><?php echo $value['client']; ?></a> </td> <td><button type="button" class="btn btn-danger btn-xs"><span class="fa fa-trash" onclick="delete_iadmin(<?php echo $value['user_id']; ?>);" aria-hidden="true"></span></button>  <a class="btn btn-info btn-xs" href="<?php echo base_url('edit-iadmin'); ?>/<?php echo $value['user_id']; ?>"><span class="fa fa-pencil-square-o" aria-hidden="true"></span></a></td> </tr> <?php } ?> </tbody> </table> </div> </div> </div> </section> <div class="modal fade" id="myModal" role="dialog"> <div class="modal-dialog modal-lg"> <!-- Modal content--> <div class="modal-content"> <div class="modal-header"> <button type="button" class="close" data-dismiss="modal">×</button> <h4 class="modal-title">List of Client</h4> </div> <div class="modal-body"> <div class="client"></div> </div> <div class="modal-footer"> <button type="button" class="btn btn-default" data-dismiss="modal">Close</button> </div> </div> </div> </div> </div> </body> </html> <script type="text/javascript"> var datatable; var tbody = $('#table_body'); datatable = $('.table').DataTable({ }); /* jQuery(document).ready(function($) { $('.head_menu_li').hover(function() { $(this).find('.dropdown-menu').stop(true, true).delay(200).fadeIn(500); }, function() { $(this).find('.dropdown-menu').stop(true, true).delay(200).fadeOut(500); }); });*/ </script> <script type="text/javascript"> function delete_iadmin(id) { var id = id; swal({ title: "Are you sure?", text: "You will not be able to recover this data!", type: "warning", showCancelButton: true, confirmButtonColor: "#DD6B55", confirmButtonText: "Yes, delete it!", cancelButtonText: "No, cancel plz!", closeOnConfirm: false, closeOnCancel: false }, function(isConfirm){ if (isConfirm) { $(".sweet-alert").hide(); $(".sweet-overlay").hide(); $.ajax({ url:"<?php echo site_url("sa-vendor-delete")?>", type:"POST", data:{id:id}, success:function(response) { response=jQuery.parseJSON(response); console.log(response); if(response.result == 1) { toastr["success"]("Deleted successfully"); $('.row'+id).hide(); } } }); } else { $(".sweet-alert").hide(); $(".sweet-overlay").hide(); } }); } function client_list(id){ $('#myModal').modal('show'); $.ajax({ url:"<?php echo site_url("iadmin-client-list")?>", type:"POST", data:{id:id}, success:function(response) { response=jQuery.parseJSON(response); var content=''; content+='<div class="table-responsive" id="table_resp">'; content+='<table class="table">'; content+='<thead>'; content+='<th>Company Name</th>'; content+='<th>Contact Person</th>'; content+='<th>Email Id</th>'; content+='<th>Phone Number</th>'; content+='<th>Industrial Segment</th>'; content+='<th>Registration Date</th>'; content+='<th colspan="2">Expiry Date</th>'; content+='</thead>'; content+='<tbody>'; $.each(response,function(i,val){ var date = new Date(val.date_of_creation); var Month=new Array("01", "02", "03","04", "05", "06", "07", "08", "09", "10", "11", "12"); var day = date.getDate(); var month = date.getMonth(); var year=date.getFullYear(); var edate = new Date(val.date_of_expiry); var eMonth=new Array("01", "02", "03","04", "05", "06", "07", "08", "09", "10", "11", "12"); var eday = edate.getDate(); var emonth = edate.getMonth(); var eyear=edate.getFullYear(); content+='<tr>'; content+='<td>'+val.cname+'</td>'; content+='<td>'+val.first_name+'</td>'; content+='<td>'+val.email+'</td>'; content+='<td>'+val.mobile_no+'</td>'; content+='<td>'; var res=jQuery.parseJSON(val.industries); var arr=[]; $.each(res,function(i,va){ arr.push(va); }); content+='<select name="">'; if(arr[0]=='1'){ content+='<option value="Aerospace & Defense">Aerospace & Defense</option>'; } if(arr[1]=='2'){ content+='<option value="Agriculture & Mining">Agriculture & Mining</option>'; }if(arr[2]=='3') { content+='<option value="Automotive">Automotive</option>'; }if(arr[3]=='4'){ content+='<option value="Building Materials, Clay & Galss">Building Materials, Clay & Galss</option>'; }if(arr[4]=='5'){ content+='<option value="Insurance">Insurance</option>'; } content+='</select>'; content+='</td>'; content+='<td>'+day+"-"+Month[month]+"-"+year+'</td>'; content+='<td>'+eday+"-"+eMonth[emonth]+"-"+eyear+'</td>'; content+='</tr>'; }); content+='</tbody>'; content+='</table>'; content+='</div>'; $('.client').html(content); } }); } </script> <style type="text/css"> #table_resp { overflow-x: auto !important; } .prio_table > thead > tr > th { background: #abf3ad !important; border-bottom: 1px solid #61b79c !important; border-top: 1px solid #61b79c !important; color:#000 !important; } .prio_table > tbody > tr > td { background: #f0fffc; color:#000 !important; } @media only screen and (min-width:320px) and (max-width:640px) { .table1 { width:100%; overflow-x: scroll !important; } } @media only screen and (min-width:641px) and (max-width:991px) { .table1 { width:100%; overflow-x: scroll !important; } } @media only screen and (min-width:992px) and (max-width:1258px) { .table1 { width:100%; overflow-x: scroll !important; } } </style> <script type="text/javascript" src="<?php echo base_url('assets/js/xlsx.full.min.js');?>"></script> <script> function doit(type) { var elt = document.querySelector('.table1'); // Update the selector to target your table var wb = XLSX.utils.table_to_book(elt, {sheet:"Sheet1"}); return XLSX.writeFile(wb, 'iAdmin.xlsx'); } </script>