<?php
 $_SESSION['error_msg'] = "";
 use Phppot\Captcha;
    require_once "model/Captcha.php";
    $captcha = new Captcha();
require_once("header.php");
require_once("menu.php");
$obj = new controller();
?>
<style>
    .newsletter .text-center {
    text-align: left !important;
    color: #fff;
}
.bs-sidebar .blog-item {
	margin-bottom: 8px;
}
.blog-item h3 {
	color: #ff6c39;
	font-size: 28px !important;
	border-bottom: 2px solid;
	line-height: 2;
}
.blog-item {
    box-shadow: 0 0 15px 0 rgba(40,61,88,.07);
    padding: 1px 16px 37px 25px;
    text-align: justify;
}
@media only screen and (max-width:767px){
    .blog-item h3 {
   
    font-size: 20px !important;
   
}
}
</style>
 <style type="text/css">
                          input[type="date"]::before {
  color: #999999;
  content: attr(placeholder);
}
input[type="date"] {
  color: #ffffff;
}
input[type="date"]:focus,
input[type="date"]:valid {
  color: #666666;
}
input[type="date"]:focus::before,
input[type="date"]:valid::before {
  content: "" !important;
}
                        </style>
      <?php
        $co_id = $_GET['co_url'];
        $query= $obj->view_currentopenings_details($co_id);
        $fet = mysqli_fetch_assoc($query);
        //print_r($fet);
        ?>
        <?php 
        
        if(!$fet['co_url']==''){
        ?>
        
        <!-- Breadcrumbs Start -->
        <div class="rs-breadcrumbs">
        	<div class="overlay"></div>
            <div class="container">
                <div class="row">
                    <div class="col-md-12 text-center">
                        <div class="breadcrumbs-inner">
                            <h3 class="page-title"><?php echo $fet['co_open'];?></h3>
                            <ul>
                                <li>
                                    <a class="active" href="https://ethicsprosperity.com/">Home</a>
                                </li>
                                <li><?php echo $fet['co_open'];?></li>
                            </ul>
                        </div>
                    </div>
                </div>
            </div>
        </div>
        <!-- Breadcrumbs End -->

        <!-- Blog Page Start Here -->
        <div id="rs-blog" class="bs-sidebar sec-spacer">
            <div class="container">
                <div class="row">
                   
                    <div class="col-lg-6 col-md-6 col-sm-6 col-xs-12">
                        <div class="blog-item">
                             <div class="blog-title"><h3>Key Responsibilities</h3></div>
                            <div class="blog-desc">
                                <?php echo $fet['co_responsibility'];?>
                           </div>
                    	</div>
                    	 <div class="blog-item">
                             <div class="blog-title"><h3>Skills Required</h3></div>
                            <div class="blog-desc">
                                <?php echo $fet['co_skills'];?>
                            </div>
                    	</div>
                    	<div class="blog-item">
                             <div class="blog-title"><h3>Education, Expertise & Experience </h3></div>
                            <div class="blog-desc">
                               <?php echo $fet['co_education'];?>
                            </div>
                    	</div>
                    </div>
                    <div class="col-lg-6 col-md-6 col-sm-6 col-xs-12">
                        <div class="blog-sidebar">
                             <div class="newsletter">
                            	<div class="text-center">
                            	    
            <form  method="post" enctype="multipart/form-data">
                         <div class="section-title with-desc text-center clearfix">
                                <div class="title-header">
                                    <h2 class="title">Apply Online</h2>
                                </div>
                            </div><!-- section-title end -->
                        
                        <div class="row"><!-- row -->
                        <div class="col-sm-12 col-md-12">
                            <div class="form-group">
                                <input name="co_open" value="<?php echo $fet['co_open'];?>" type="hidden" class="form-control bg-white border" required="required">
                            </div>
                            <div class="form-group">
                                <input name="name" type="text" class="form-control bg-white border" autocomplete="off" placeholder="Full Name*" required="required">
                            </div>
                        </div>
                        <div class="col-sm-12 col-md-12">
                            <div class="form-group">
                                <input name="email" type="email" placeholder="Email Address*" autocomplete="off" required="required" class="form-control bg-white border">
                            </div>
                        </div>
                        <div class="col-sm-12 col-md-12">
                            <div class="form-group">
                           <input name="phone" type="text" placeholder="Mobile Number*"  autocomplete="off" pattern="\d{10}" title="10 digit Mobile No." maxlength="10" onkeypress="return isNumber(event)" required="required" class="form-control bg-white border">
                            </div>
                         </div>
                         <div class="col-sm-12 col-md-12">
                            <div class="form-group">
                                <input name="notice_period" type="text" class="form-control bg-white border" autocomplete="off" placeholder="Notice Period in Days*" required="required">
                            </div>
                        </div>
                        
                       
                        <div class="col-sm-12 col-md-12">
                            <div class="form-group">
                               Your Gender - <input type="radio" name="gender" value="Male" checked="checked" required="required">
                                <label>Male</label>
                                <input type="radio" name="gender" value="Female" checked="checked" autocomplete="off" required="required">
                                <label>Female</label>
                            </div>
                            
                        </div>
                        <div class="col-sm-12 col-md-12">
                            <div class="form-group">
                             Preferred Location  -<br>
                             <input type="radio" name="relocate_vadodara" value="Surat" autocomplete="off" required="required">
                                <label>Surat</label><br>
                                <input type="radio" name="relocate_vadodara" value="Rajkot" autocomplete="off" required="required">
                                <label>Rajkot</label><br>
                                <input type="radio" name="relocate_vadodara" value="Vadodara" autocomplete="off" checked="checked">
                                <label>Vadodara</label>  <br>
                                   <input type="radio" name="relocate_vadodara" value="Dehradun" autocomplete="off" required="required">
                                <label>Dehradun</label>
                       </div>
                    </div>
                    
                        <div class="col-sm-12 col-md-12">
                            <div class="form-group">
                                Upload Resume -
                             <input type="file" name="doc" id="file" onchange="Filevalidation()" accept=".pdf,.doc,.docx" class="form-control bg-white border" class="form-control bg-white border">
                         </div>
                     </div>
                     
                     <div class="col-sm-12 col-md-12">
                            <div class="form-group">
                                 <input name="captcha_code" type="text" class="form-control captcha-input" autocomplete="off" placeholder="Captcha Code*" required="">
                            </div>
                     </div>
                     
                        <div class="col-md-12">
                            <div class="text-left">
                              <center> <button class="submit readon" name="submit" type="submit">SEND</button></center>
                            </div>
                        </div>
                        </div>
                    </form>
                    
                   <?php
                    if(isset($_POST['submit'])){
                      $apply['post-title'] = $_POST['co_open'];
                      $apply['name'] = $_POST['name'];
                      $apply['email']= $_POST['email'];
                      $apply['phone'] = $_POST['phone'];
                      $apply['notice_period'] = $_POST['notice_period'];
                      $apply['gender'] = $_POST['gender'];
                      $apply['relocate_vadodara']= $_POST['relocate_vadodara'];
                      $apply['doc'] = $_FILES['doc'];
                      //print_r($apply);
                      //exit();
                      $userCaptcha = filter_var($_POST["captcha_code"], FILTER_SANITIZE_STRING);
                                  $isValidCaptcha = $captcha->validateCaptcha($userCaptcha);
                                  if ($isValidCaptcha) {
                      $apply= $obj->apply_job($apply);
                      echo "<b>".$apply."</b>";
                    }
                                 else
                                       {
                                          echo $_SESSION['error_msg'] = "<b>Incorrect Captcha Code</b>";
                                        }
                    }
                    ?>
                    <!-- row end-->
                                </div>
                            </div>
                        </div>
                    </div>  
							
                </div>
            </div>
        </div>
        <!-- Blog Page End Here -->
        <?php
        }
        else
        {
          header("location:404.php");  
        }
        ?>
       
<?php
require_once("footer.php");
?>