<?php
include 'include/config.php';
include 'check.php';
?>   
<!DOCTYPE html>
<html >
  <head>
    <meta charset="UTF-8">
    <title>DataXylo Admin|Admin</title>
     <link rel="stylesheet" href="asset/sweetalert.css"/><!--for alert notification --->
      <link rel='stylesheet prefetch' href='https://netdna.bootstrapcdn.com/bootstrap/3.0.2/css/bootstrap.min.css'>
      <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/font-awesome/4.6.2/css/font-awesome.min.css">
      <link rel="stylesheet"  href="https://maxcdn.bootstrapcdn.com/font-awesome/4.5.0/css/font-awesome.min.css">

      <link href="https://rawgit.com/wenzhixin/bootstrap-table/master/src/bootstrap-table.css">
      <link rel="stylesheet" href="asset/style.css">
      <link rel="stylesheet"  href="css/left.css">
      <link rel="stylesheet" href="asset/editor.css">
      <link rel="stylesheet" href="asset/export/examples.css">
      <link rel="stylesheet" href="asset/export/bootstrap-table.css">
   
   <!--for alert notification --->
      <script src="asset/sweetalert.js"></script>
   
    <style>
        #table{ font-size: 13px; }

    </style>

  </head>

  <body>
  
  

<?php
include 'include/config.php';

if(isset($_POST['submit'])){
$job_id=$_POST['job_id'];
$job_title=$_POST['job_title'];
$job_type=$_POST['job_type'];
$work_exp=$_POST['work_exp'];
$job_loaction=$_POST['job_loaction'];
$job_description=$_POST['editor1'];


$execute="INSERT INTO `job_list`(`job_id`,`job_title`,`job_type`,`work_exp`,`job_location`,`job_description`)
VALUES ('$job_id','$job_title','$job_type','$work_exp','$job_loaction','$job_description')";



if (mysqli_query($conn, $execute)) {

 echo '<script type="text/javascript">';
  echo 'setTimeout(function () { swal("Your Job successfully Updated.","Message!","success");';
  echo '}, 500);</script>';


} else {
    echo "Error: " . $sql . "<br>" . mysqli_error($conn);
}

}



?>

    <div class="navbar-xs" >
   <div class="navbar-primary">
       <nav class="navbar navbar-static-top" role="navigation">
          <!-- Brand and toggle get grouped for better mobile display -->
          <div class="navbar-header">
              <a class="navbar-brand" href="Experiences.php"><img class="img-logo" src="images/logo.png"></a>
              <a href="#" class="rad-toggle-btn top-icon"><i class="glyphicon glyphicon-th-large"></i></a>


          </div>
          <!-- Collect the nav links, forms, and other content for toggling -->

          <ul class="nav navbar-nav navbar-right" style="padding-top: 7px;">
             <li><a title="John" href="logout.php"><span style="color: red;" class="glyphicon glyphicon-off"></span> <span class="sr-only">(current)</span></a></li>
           </ul>

      </nav>
  </div>
</div>
      <div id="wrapper" class="toggled-2">
        <!-- Sidebar -->
       <aside>
		<nav class="rad-sidebar rad-nav-min ">
            <ul style="  margin-left: -40px;">
                <li><a href="Experiences.php" class="inbox"><i class="fa fa-tachometer"><span class="icon-bg rad-bg-success"></span></i><span class="rad-sidebar-item"> Dashboard</span></a></li>

                <li><a href="Experiences.php" class="snooz"><i class="fa fa-user-plus"><span class="icon-bg rad-bg-primary"></span></i><span class="rad-sidebar-item">Applicant</span></a></li>
                <li><a href="JobPost.php" class="done"><i class="fa fa-recycle"><span class="icon-bg rad-bg-warning"></span></i><span class="rad-sidebar-item">Jobs post</span></a></li>
                <li><a href="settings.php"><i class="fa fa-wrench"><span class="icon-bg rad-bg-violet"></span></i><span class="rad-sidebar-item">Settings</span></a></li>
				</ul>
		</nav>
    </aside>
        <!-- Page Content -->
         <div class="rad-body-wrapper rad-nav-min">
            <div class="container-fluid">
                 <div  class="col-lg-12">

                      <ul class="nav nav-tabs">
                         <li class="active"><a data-toggle="tab" href="#home">Controller</a></li>
                         <li><a data-toggle="tab" href="#menu1">Job Post</a></li>
                     </ul>

                      <div class="tab-content">
                            <div id="menu1" class="tab-pane fade">
                            <h4>Post a new jobs</h4>
                            <form method="post">
							    <div class="form-group col-xs-2">
                                  <label for="usr">Job Id</label>
                                  <input type="text" class="form-control" name="job_id" required>
                                </div>
                                 <div class="form-group col-xs-4" nopadding>
                                     <label for="pwd">Job Title/ Designation:</label>
                                   <input type="text" class="form-control" name="job_title" required>
                                </div>
								<div class="form-group col-xs-2">
                                  <label for="usr">Job Type</label>
                                  <input type="text" class="form-control" name="job_type" required>
                                </div>

                                <div class="form-group col-xs-2">
								 <label for="usr">Work Experience</label>
                                  <input type="text" class="form-control" name="work_exp" required>

                                </div>
                                <div class="form-group col-xs-2">
                                  <label for="usr">Location</label>
                                  <input type="text" class="form-control" name="job_loaction" required>
                                </div>


                                <div class="form-group" >
                                <label >Job Description:</label>
                                <textarea class="form-control"  rows="5"  name="editor1" required ></textarea>
                                </div>
                                <div class="pull-right">
                                    <button type="submit" name="submit" class="btn btn-success">Update</button>
                                </div>

                           </form>

                           </div>
   <div id="home" class="tab-pane fade in active">
						   <form name="bulk_action_form"  method="post" onSubmit="return delete_confirm();"/>


                           <table data-toggle="table" id="table"
                       data-row-style="rowStyle"

                       data-show-refresh="true"
                       data-show-toggle="true"
                       data-show-columns="true"
                       data-search="true"
                       data-select-item-name="toolbar1"
                       data-pagination="true"
                       data-sort-name="name"
                       data-sort-order="desc"
                       data-single-select="false"
                       data-click-to-select="true"
                       data-maintain-selected="true"
                       data-pagination="true"
                       data-click-to-select="true"
                       data-toolbar="#toolbar"
                       

                       >
                 <thead>
                    <tr>
                        <th data-field="id" ></th>
                        <th data-field="Job ID"  data-sortable="true">Job ID</th>
                        <th data-field="Job Title" data-sortable="true">Job Title</th>
                        <th data-field="Job Type" data-sortable="true">Job Type</th>
						 <th data-field="Work Experience" data-sortable="true">Work Experience</th>
                        <th data-field="Location" data-sortable="true">Location</th>
					
						   <th>Status</th>
						<th data-field="Edit" >Edit</th>


                     

                      </tr>
                  </thead>
                  <tbody>
                     <?php $result= mysqli_query($conn,"SELECT * FROM job_list");
															while($row = mysqli_fetch_array($result)){
                                                                    $id = $row['id'];
															?>

                                                                <tr>
																    <td><input type="checkbox" name="checked_id[]" class="checkbox" value="<?php echo $row['id']; ?>"/></td>
                                                                    <td ><a style="color: #ff9000!important; font-weight:bold" href='javascript:void(0);'><?php echo $row['job_id']; ?></a></td>
                                                                     <td ><a style="color: #ff9000!important; font-weight:bold" href='javascript:void(0);'><?php echo $row['job_title']; ?></a></td>
																	  <td ><?php echo $row['job_type']; ?></td>
																	   <td ><?php echo $row['work_exp']; ?></td>
																	    <td ><?php echo $row['job_location']; ?></td>
																		
																		
																		
																		
                                                                    <td><button type="button" class="btn btn-success btn-xs" data-toggle="modal" data-target="#job_apply">Active</button></td>
																	<td><a href="edit.php?id=<?php echo $id; ?>"> <button type="button"  class="btn btn btn-danger btn-xs"> Edit</button></a></td>
                                                                </tr>

                                                                    <?php } ?>
                  </tbody>

               </table>
                           <button type="button" class=" btn btn-success" disabled>Active</button>
                       <button type="button"   class="btn btn btn-primary" name="" disabled> Inactive</button>
                           <button type="submit" class="btn btn-danger" name="bulk_delete_submit" value="Delete">Delete</button>
                       </div>
</form>


                      </div>


                   </div>
            </div>
        <!-- /#page-content-wrapper -->
    </div></div>
	
	
	
	
	
	

	
	
	
<?php

if(isset($_POST['bulk_delete_submit'])){
    $idArr = $_POST['checked_id'];
    foreach($idArr as $id){
        mysqli_query($conn,"DELETE FROM job_list WHERE id=".$id);

    }
    $_SESSION['success_msg'] = 'Users have been deleted successfully.';
	?>
		<script>
		
		
		swal({ 
    title: "Deleted!",
    text: "You have been deleted successfully.",
    type: "success" 
   },
     function(){
    window.location.href = 'JobPost.php';
    });
    
		
	
       
        </script>
		<?php

}


?>







      <!----CDN------>
 <script src="//cdn.ckeditor.com/4.5.10/standard/ckeditor.js"></script><!----text editor cdn------>

    <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js"></script>
	<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/js/bootstrap.min.js"></script>
	<script src="https://cdnjs.cloudflare.com/ajax/libs/bootstrap-table/1.9.1/bootstrap-table.min.js"></script>

    <script src="asset/admin.js"></script>
            <script src="https://rawgit.com/hhurz/tableExport.jquery.plugin/master/tableExport.js"></script>
            <script src="https://rawgit.com/wenzhixin/bootstrap-table/master/src/bootstrap-table.js"></script>
            <script src="https://rawgit.com/wenzhixin/bootstrap-table/master/src/extensions/export/bootstrap-table-export.js"></script>
            <script src="https://cdnjs.cloudflare.com/ajax/libs/lodash.js/3.10.0/lodash.min.js"></script>
            <script src="asset/export/ga.js"></script>
             <script src="asset/editor.js"></script>







<script>
    	$(document).on("click", function(e){
		var $item = $(".rad-dropmenu-item");
		if($item.hasClass("active")){
			$item.removeClass("active");
		}
	});

	$(".rad-toggle-btn").on('click', function(){
		$(".rad-sidebar").toggleClass("rad-nav-min");
		$(".rad-body-wrapper").toggleClass("rad-nav-min");
		setTimeout(200);
	});

	$(".rad-dropdown >.rad-menu-item").on('click', function(e){
		e.stopPropagation();
		$(".rad-dropmenu-item").removeClass("active");
		$(this).next(".rad-dropmenu-item").toggleClass("active");
	});


</script>



    <script type="text/javascript">
      
            CKEDITOR.replace( 'editor1' );
    </script>



 <style>
     .rad-body-wrapper {
          position: absolute;
    left: 177px;
    top: 59px;
    width: auto;
    right: 14px;
    -webkit-transition: all .2s ease-in-out;
    transition: all .2s ease-in-out;
      }
  </style>

  </body>
</html>
