<script type="text/javascript">
    $(document).ready(function(){
<!-- page script -->
        $('.datatables').DataTable();
        $('.datetimepicker').datetimepicker({
            viewMode: 'months',
            format: 'DD-MM-YYYY'
        });

    });
    
	function newCompany()
	{
		
		window.location = "<?php echo base_url(); ?>setCompany/companySetup";
		
	}
	
	function deleteCompany(ID){
	
		var confirmDelete = confirm("<?php echo $this->lang->line('confirmDelete'); ?>");
		
		if (confirmDelete == true) {
    		
			
			$.ajax({
				type: "POST",
				url: "<?php echo base_url(); ?>setCompany/deleteCompany",
				data: {
					'ID' : ID,
				},
				dataType:'json',
				success: function(data){
					if(data.status == "success"){
						
						
						alert('Company deleted');
						location.reload();
						
					}
						
						
				}
			 });
			
			
		}
		
	
	}
	
</script>
<style>
 
</style>


			
                
                
                


<!-- Content Wrapper. Contains page content -->
<div class="content-wrapper">
    <!-- Content Header (Page header) -->
    <section class="content-header">
        <h1>
            <?php echo $this->lang->line('module'); ?>
        </h1>
        <ol class="breadcrumb">
            <li><a href="#"><i class="fa fa-home"></i> <?php echo $this->lang->line('home'); ?></a></li>
            <li><a href="#"><?php echo $this->lang->line('module'); ?></a></li>
            <li class="active"><?php echo $this->lang->line('companylist'); ?></li>
        </ol>
    </section>

    <!-- Main content -->
    <section class="content">
        


        <div class="row">
            <div class="col-md-12">
                <!-- Horizontal Form -->

                <!-- general form elements disabled -->
                <div class="box box-danger">
                    
                    
                    
                    <div class="box-header with-border ">
                        <h3  class="box-title">
                            <h3 class="pull-left"><?php echo $this->lang->line('companylist');?></h3>
                            <div style="margin-top:10px;" class="pull-right">
                            <button type="button" onclick="newCompany()" id="createCompany" name="createCompany" class="btn btn-primary btn-sm" title="Create Company"><i class="fa fa-plus"></i></button>
                            <button type="button" class="btn btn-primary btn-sm" title="Print"><span class="glyphicon glyphicon glyphicon-print"></span></button>
                            </div>
                        </h3>
                    </div><!-- /.box-header -->
                    
                    <div class="box-body">
                        <form id="frm_submit_delete_sales" method="post" action="<?php echo base_url(); ?>sales/delete_sales">
                        <table id="datatable_saleslist" class="table table-bordered table-striped datatables">
                            <thead>
                                <tr>
                                    <th class="text-center"><?php echo $this->lang->line('no'); ?></th>
                                    <th class="text-center"><?php echo $this->lang->line('companyName'); ?></th>
                                    <th class="text-center"><?php echo $this->lang->line('email'); ?></th>
                                    <th class="text-center"><?php echo $this->lang->line('phoneNo'); ?></th>
                                    <th class="text-center"><?php echo $this->lang->line('action'); ?></th>
                                </tr>
                            </thead>
                            <tbody>
                                <?php 
                                if($companyList){
                                    $i = 1;
                                    foreach ($companyList as $row){
                                ?>
                                <tr>
                                    <td class="text-center"><?php echo $i++; ?></td>
                                    <td class="text-center"><a href="<?php echo base_url()?>setCompany/companyEdit/<?php echo $row->ID; ?>"><?php echo $row->companyName; ?></a></td>
                                    <td class="text-center"><?php echo $row->email; ?></td>
                                    <td class="text-center"><?php echo $row->phoneNo; ?></td>
                                    <td class="text-center">
                                    <button type="button" onclick="confirmBox('deleteCompany(<?php echo $row->ID; ?>)', '<?php echo $this->lang->line('confirmBox'); ?>')" class="btn btn-primary btn-sm" title="Delete"><span class="glyphicon glyphicon glyphicon-trash"></span></button>
                                    </td>
                                </tr>
                                <?php 
                                    }
                                }
                                ?>


                            </tbody>
                        </table>
                        </form>
                    </div><!-- /.box-body -->
                </div><!-- /.box -->
            </div>
        </div>


    </section><!-- /.content -->
</div><!-- /.content-wrapper -->
