<?php
	
	defined('BASEPATH') OR exit('No direct script access allowed');
	$this->load->view("admin_includes/head");
	$this->load->view("admin_includes/header");
	$this->load->view("admin_includes/main_sidebar");

?>
    <div class="page-wrapper">
 
     <div class="container-fluid">
                <div class="row">
                    <div class="col s12">
                        <div class="card">
                            <div class="card-content">
                                <h5 class="card-title">Package Details
								
								 <a href="<?php echo base_url(); ?>index.php/newPackages" class="btn btn-primary pull-right">
								 <i class="material-icons">dashboard</i><span class="hide-menu">New Packages</span></a>
								</h5>
				
						         <table id="example" class="responsive-table display" style="width:100%">
                                    <thead>
                                        <tr>
                                            <th>Sr.No.</th>
                                            <th>Package Name</th>
                                            <th>Min User</th>
                                            <th>User Per Cost</th>
                                            <th>Duration</th>                                           
                                            <th>Action</th>
                                        </tr>
                                    </thead>
                                    <tbody>
									<?php
									$cnt = 1;
									for ($i = 0; $i < count($packages_list);$i++) {
									
									
									?>
									
									<tr class="odd gradeX">
									<td><?php echo $cnt++; ?></td>
                                        <td><?php echo $packages_list[$i]->package_name; ?></td>
                                        <td><?php echo $packages_list[$i]->user_min_limit; ?></td>
                                        <td><?php echo $packages_list[$i]->per_user_cost; ?></td>
                                        
                                        <td><?php echo $packages_list[$i]->duration."- ".$packages_list[$i]->duration_type; ?></td>
                                 
                                        <td>
                                            
                                       <a href="<?php echo base_url('index.php/editpackage/' . $packages_list[$i]->package_id); ?>" class="waves-effect waves-light btn-small"><i class="fa fa-edit"></i></a>									  
									   
										<a onclick="delete_package('<?php echo $packages_list[$i]->package_id; ?>');" class="waves-effect waves-light btn-small red" >  <i class="fa fa-trash"></i></a>
										</td>
										
									</tr>
									<?php } ?>
                                    </tbody>
                                </table>
                      
					</div>							
						</div>
					</div>
				</div>
			</div>
		</div>
	</div>
	</div>
	</div>
	</div>
<?php
	$this->load->view("admin_includes/footer");
?>				
</div><!-- ./wrapper -->	

<script type="text/javascript">
	$(document).ready(function() {	
		$('#example').dataTable();
		
	});
</script>

	<script>	
		 function delete_package(catid){	 
      /*  swal({   
            title: "Are you sure?",   
            text: "You will not be able to recover this imaginary file!",   
            type: "warning",   
            showCancelButton: true,   
            confirmButtonColor: "#DD6B55",   
            confirmButtonText: "Yes, delete it!",   
            cancelButtonText: "No, cancel plx!",   
            closeOnConfirm: false,   
            closeOnCancel: false 
        }, function(confirmButtonText){   
	
            if (confirmButtonText) {
            */
    location='<?php echo base_url('index.php/deletepackage/'); ?>'+catid;
    
            /*    swal("Deleted!", "Your imaginary file has been deleted.", "success");   
            } else {     
                swal("Cancelled", "Your imaginary file is safe :)", "error");   
            }
        });
  */
		 }
		
</script>