<?php
require_once("header.php");
require_once("menu.php");
$databaseService = new DatabaseService();
$con = $databaseService->getConnection();

if(isset($_REQUEST['del']))
{
    $co_id = base64_decode($_REQUEST['del']);
    $ex = $obj->delete_currentopening($co_id);
    echo '<script>window.location="current_openings.php"</script>';
}

?>

<div id="layoutSidenav_content">
<main class="mt-4">
    <div class="container-fluid">        
        <div class="card mb-4">
            <div class="card-header">
                <i class="fas fa-tools mr-1"></i>Current Openings
                <a href="add_current_openings.php" class="btn btn-primary btn-sm float-right add_right">Add New Opening</a>
            </div>
            <div class="card-body">
                <div class="table-responsive">
                    <table class="table table-bordered slider_logo" id="dataTable" width="100%" cellspacing="0">
                        <thead>
                            <tr>
                                
                                <th>Company Name</th>
								<th >Open</th>
								<th >City</th>
								<th >Key Responsibilities</th>
								<th >Skills Required</th>
								<th >Education</th>
							    <th style="width:100px;">Action</th>
                            </tr>
                        </thead>
                        <tbody>
                            <?php
                            $ex = $obj->get_currentopenings();
                            while($row=mysqli_fetch_array($ex))
                            {
                            ?>
                            <tr>
                                <td><?php echo ucwords($row['co_title']);?></td>
								<td><?php echo ucwords($row['co_open']);?></td>
								<td><?php echo ucwords($row['co_city']);?></td>
								<td><?php echo ucwords($row['co_responsibility']);?></td>
								<td><?php echo ucwords($row['co_skills']);?></td>
								<td><?php echo ucwords($row['co_education']);?></td>
								 <td>
                                    <a href="add_current_openings.php?edit=<?php echo base64_encode($row['co_id']);?>" class="btn btn-primary btn-sm edit_right" title="Edit"><i class="fas fa-edit"></i></a>
                                    <a href="current_openings.php?del=<?php echo base64_encode($row['co_id']);?>" class="btn btn-danger btn-sm delete_right" title="Delete"><i class="fas fa-trash"></i></a>
								</td>
                            </tr>
                            <?php } ?>
                        </tbody>
                    </table>
                </div>
            </div>
        </div>
    </div>
</main>
<script>
    var url = "current_openings.php";
</script>


<?php require_once("footer.php");?>


