EVOLUTION-NINJA
Edit File: sa_vendor_list.php
<?php $this->load->view('includes/sa_header');?> <section class="mid_work_one"> <div class="container-fluid"> <div class="row middle_container"> <div class="row list_h4_search" style="border-bottom: 1px solid #555;margin-bottom:20px;"> <h4>List of Vendors</h4> <button type="button" style="float:right;margin-right: 6%;" onclick="doit('xlsx')"; class="btn btn-primary btn-sm">Export</button> </div> <div class="table1 table-responsive"> <table class="table prio_table dataTable no-footer"> <thead> <tr> <th>Sl No.</th> <th style="width:200px;">Company Name</th> <th>Contact Person</th> <th>Email Id</th> <th>Phone No.</th> <th>Clients</th> <th>Industrial Segment</th> <th>Company Profile</th> <!-- <th>Action</th> --> </tr> </thead> <tbody> <?php foreach($vendor as $key => $value) { ?> <tr class="row_del<?php echo $value['user_id']; ?>"> <td><?php echo $key+1; ?></td> <td><?php echo $value['company_name']; ?></td> <td><?php echo $value['first_name'];?></td> <td><?php echo $value['email'];?></td> <td><?php echo $value['mobile_no'];?></td> <td><a href="#" onclick="client_list(<?php echo $value['user_id'];?>);"><?php echo $value['client_count'];?></a></td> <td><select name=""> <?php $segment=json_decode($value['industries']); ?> <?php if(!empty($segment)){ if(in_array("1",$segment)) { ?> <option value="Aerospace & Defense">Aerospace & Defense</option> <?php } } ?> <?php if(!empty($segment)){ if(in_array("2",$segment)) { ?> <option value="Agriculture & Mining">Agriculture & Mining</option> <?php } } ?> <?php if(!empty($segment)){ if(in_array("3",$segment)) { ?> <option value="Automotive">Automotive</option> <?php } } ?> <?php if(!empty($segment)){ if(in_array("4",$segment)) { ?> <option value="Building Materials, Clay & Glass">Building Materials, Clay & Glass</option> <?php } } ?> <?php if(!empty($segment)){ if(in_array("5",$segment)) { ?> <option value="Insurance">Insurance</option> <?php } } ?> </select></td> <td><a class="btn btn-warning btn-xs" href="<?php echo base_url('/sa-vendor-profile'); ?>/<?php echo $value['user_id']; ?>">View </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('update-vendor'); ?>/<?php echo $value['user_id']; ?>"><span class="fa fa-pencil-square-o" aria-hidden="true"></span></a>--> </td> </tr> <?php } ?> </tbody> </table> </div> <div class="table1 table-responsive" style="display: none;"> <table class="" id="headerTable"> <thead> <tr> <th>Sl No.</th> <th style="width:200px;">Company Name</th> <th>Contact Person</th> <th>Email Id</th> <th>Phone No.</th> <th>Clients</th> <th>Industrial Segment</th> </tr> </thead> <tbody> <?php foreach($vendor as $key => $value) { ?> <tr> <td><?php echo $key+1; ?></td> <td><?php echo $value['company_name']; ?></td> <td><?php echo $value['first_name'];?></td> <td><?php echo $value['email'];?></td> <td><?php echo $value['mobile_no'];?></td> <td><a href="#" onclick="client_list(<?php echo $value['user_id'];?>);"><?php echo $value['client_count'];?></a></td> <td><select name=""> <?php $segment=json_decode($value['industries']); ?> <?php if(!empty($segment)){ if(in_array("1",$segment)) { ?> <option value="Aerospace & Defense">Aerospace & Defense</option> <?php } } ?> <?php if(!empty($segment)){ if(in_array("2",$segment)) { ?> <option value="Agriculture & Mining">Agriculture & Mining</option> <?php } } ?> <?php if(!empty($segment)){ if(in_array("3",$segment)) { ?> <option value="Automotive">Automotive</option> <?php } } ?> <?php if(!empty($segment)){ if(in_array("4",$segment)) { ?> <option value="Building Materials, Clay & Glass">Building Materials, Clay & Glass</option> <?php } } ?> <?php if(!empty($segment)){ if(in_array("5",$segment)) { ?> <option value="Insurance">Insurance</option> <?php } } ?> </select></td> </tr> <?php } ?> </tbody> </table> </div> </div> </div> </section> <div class="modal fade" id="myModal" role="dialog"> <div class="modal-dialog"> <!-- 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> </body> </html> <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_del'+id).hide(); } } }); } else { $(".sweet-alert").hide(); $(".sweet-overlay").hide(); } }); } var datatable; var tbody = $('#table_body'); datatable = $('.table').DataTable({ }); jQuery(document).ready(function($) { $('.ul_menu li.dropdown').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); }); }); function client_list(id){ $('#myModal').modal('show'); $.ajax({ url:"<?php echo site_url("vendor-client-list")?>", type:"POST", data:{id:id}, success:function(response) { response=jQuery.parseJSON(response); var content=''; $.each(response,function(i,val){ content+='<p>'+val.company_name+'</p>'; }); $('.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; text-align:center; } .prio_table > tbody > tr > td { background: #f0fffc; color:#000 !important; text-align:center; } @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/shim.min.js');?>"></script> <script type="text/javascript" src="<?php echo base_url('assets/js/xlsx.full.min.js');?>"></script> <script type="text/javascript" src="<?php echo base_url('assets/js/Blob.js');?>"></script> <script type="text/javascript" src="<?php echo base_url('assets/js/FileSaver.js');?>"></script> <script> function doit(type, fn, dl) { var elt = document.getElementById('headerTable'); var wb = XLSX.utils.table_to_book(elt, {sheet:"Sheet JS"}); return dl ? XLSX.write(wb, {bookType:type, bookSST:true, type: 'base64'}) : XLSX.writeFile(wb, fn || ('vendor.' + (type || 'xlsx'))); } </script> <script type="text/javascript"> function tableau(pid, iid, fmt, ofile) { if(typeof Downloadify !== 'undefined') Downloadify.create(pid,{ swf: 'downloadify.swf', downloadImage: 'download.png', width: 100, height: 30, filename: ofile, data: function() { return doit(fmt, ofile, true); }, transparent: false, append: false, dataType: 'base64', onComplete: function(){ alert('Your File Has Been Saved!'); }, onCancel: function(){ alert('You have cancelled the saving of this file.'); }, onError: function(){ alert('You must put something in the File Contents or there will be nothing to save!'); } }); else document.getElementById(pid).innerHTML = ""; } tableau('biff8btn', 'xportbiff8', 'biff8', 'test.xls'); tableau('odsbtn', 'xportods', 'ods', 'test.ods'); tableau('fodsbtn', 'xportfods', 'fods', 'test.fods'); tableau('xlsbbtn', 'xportxlsb', 'xlsb', 'test.xlsb'); tableau('xlsxbtn', 'xportxlsx', 'xlsx', 'test.xlsx'); </script>