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

  if(isset($_REQUEST['del']))
{
    $cw_id = base64_decode($_REQUEST['del']);
    $ex = $obj->delete_careerwork($cw_id);
    echo '<script>window.location="career_works.php"</script>';
}
   ?>
<style>
   th {
   width: 20%;
   }
</style>
<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 fa-border-style"></i> &nbsp; Carrer Section
            <a href="add_career_work.php" class="btn btn-primary btn-sm float-right">Add</a>
         </div>
         <div class="card-body">
             <div class="table-responsive">
                    <table class="table table-bordered" id="dataTable" width="100%" cellspacing="0">
                        <thead>
                            <tr>
                         <th>Background</th>
                         <th>Section Title</th>
                         <th>Title</th>
                         <th>Action</th>
                            </tr>
                        </thead>
                        <tbody>
                            <?php
                            $ex = $obj->view_careerwork();
                            while($row=mysqli_fetch_array($ex))
                            {
                            ?>
                            <tr>
                         <td><img  width="100" src="<?php echo $row['cw_img'];?>"></td>
                           <td><?php echo $row['cw_sec_title'];?></td>
                        <td><?php echo $row['cw_title'];?></td>
                        
                                <td>
                                    <a href="add_career_work.php?edit=<?php echo base64_encode($row['cw_id']);?>" class="edit_right btn btn-primary btn-sm"><i class="fas fa-edit"></i></a>
                                    <a href="career_works.php?del=<?php echo base64_encode($row['cw_id']);?>" class="btn btn-danger btn-sm delete_right"><i class="fas fa-trash"></i></a>
                                </td>
                            </tr>
                            <?php } ?>
                        </tbody>
                    </table>
                </div>
         </div>
      </div>
   </div>
</main>
<?php require_once("footer.php");?>