MMCT TEAM
Server IP : 103.53.40.154  /  Your IP : 18.188.154.238
Web Server : Apache
System : Linux md-in-35.webhostbox.net 4.19.286-203.ELK.el7.x86_64 #1 SMP Wed Jun 14 04:33:55 CDT 2023 x86_64
User : ppcad7no ( 715)
PHP Version : 8.2.25
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : ON
Directory (0755) :  /home2/ppcad7no/polytechniccoaching.com/../thedigitalgulf.com/down-hrms/

[  Home  ][  C0mmand  ][  Upload File  ]

Current File : /home2/ppcad7no/polytechniccoaching.com/../thedigitalgulf.com/down-hrms/add-candidate.php
<?php include("hr-header.php");?>
<?php
 if(isset($_POST['AddCandidateSubmit'])){
	 if($_SESSION['admin_user_id']=='h1admin'){
		 $candidates_alloted = 'No';
	 }else{
		 $candidates_alloted = 'Yes';
	 }
	 /******* Stop Duplicate Entry Start *******/
	 $candidateDupli = db_scalar("select count(*) from tbl_candidates where 1 and (candidates_name='$candidates_name' AND candidates_mobile='$candidates_mobile')"); 
	 /******* Stop Duplicate Entry Start *******/
	 
	 if($candidateDupli==0){
	 if($_FILES['file']['name']){
			$file_name=($_FILES['file']['name']);
			
			//**** Change Duplicate Image name Start Here****//
		 $ext = substr($file_name, strrpos($file_name, "."));		 
		 $imageDupli = db_scalar("select count(*) from tbl_candidates where 1 and candidates_resume_name='$file_name'"); 
		 if($imageDupli > 0){
		  $file_name = basename($file_name, $ext);
		  $file_name = basename($file_name, $ext) . rand(1,1000) . $ext;
		 }else{
		  $file_name = $file_name;
		 }
		 //**** Change Duplicate Image name End Here****//
			move_uploaded_file($_FILES['file']['tmp_name'],"resume_file"."/".$file_name);
	}
	 
	 $insSql = "insert into tbl_candidates set
	             candidates_name='$candidates_name',
				 candidates_mobile='$candidates_mobile',
				 candidates_ref_by='$candidates_ref_by',
				 candidates_ref_name='$candidates_ref_name',
				 candidates_industry='$candidates_industry',
				 candidates_specialization='$candidates_specialization',
				 candidates_current_emp_status='$candidates_current_emp_status',
				 candidates_email='$candidates_email',
				 candidates_alt_mobile='$candidates_alt_mobile',
				 candidates_whatsapp_no='$candidates_whatsapp_no',
				 candidates_ref_contact_no='$candidates_ref_contact_no',
				 candidates_address='$candidates_address',
				 candidates_sex='$candidates_sex',
				 candidates_resume_name='$file_name',
				 candidates_current_salary='$candidates_current_salary',
				 candidates_expected_salary='$candidates_expected_salary',
				 candidates_offered_salary='$candidates_offered_salary',
				 candidates_add_date='$crDate',
				 candidates_alloted='$candidates_alloted',
				 candidates_user='$_SESSION[admin_user_id]'";
				 db_query($insSql);
				 $id=mysqli_insert_id();
				 $addPartySql = db_query("insert into party_statusdate set
				                           user_id='$_SESSION[admin_user_id]',
										   party_id='$id',
										   fresh_party_date='$crDate',
										   status='1'");
				 ?>
<script type="text/javascript">
			$(document).ready(function(e) {
				$("#AddSucc").show("slow");
            });
			</script>
<? }else{ ?>
<script type="text/javascript">
			$(document).ready(function(e) {
				$("#AddErr").show("slow");
            });
			</script>
<? }} ?>
<?php
 if(isset($_POST['UpdateCandidateSubmit'])){
	 if($_SESSION['admin_user_id']=='h1admin'){
		 $candidates_alloted = 'No';
	 }else{
		 $candidates_alloted = 'Yes';
	 }
	 
	 if($_FILES['file']['name']){
			$file_name=($_FILES['file']['name']);
			
			//**** Change Duplicate Image name Start Here****//
		 $ext = substr($file_name, strrpos($file_name, "."));		 
		 $imageDupli = db_scalar("select count(*) from tbl_candidates where 1 and candidates_resume_name='$file_name'"); 
		 if($imageDupli > 0){
		  $file_name = basename($file_name, $ext);
		  $file_name = basename($file_name, $ext) . rand(1,1000) . $ext;
		 }else{
		  $file_name = $file_name;
		 }
		 //**** Change Duplicate Image name End Here****//
			move_uploaded_file($_FILES['file']['tmp_name'],"resume_file"."/".$file_name);
	}else{
		$file_name = db_scalar("select candidates_resume_name from tbl_candidates where 1 and candidates_id='$_REQUEST[candidateID]'"); 
	}
	 $updateSql = "update tbl_candidates set
	             candidates_name='$candidates_name',
				 candidates_mobile='$candidates_mobile',
				 candidates_ref_by='$candidates_ref_by',
				 candidates_ref_name='$candidates_ref_name',
				 candidates_industry='$candidates_industry',
				 candidates_specialization='$candidates_specialization',
				 candidates_current_emp_status='$candidates_current_emp_status',
				 candidates_email='$candidates_email',
				 candidates_alt_mobile='$candidates_alt_mobile',
				 candidates_whatsapp_no='$candidates_whatsapp_no',
				 candidates_ref_contact_no='$candidates_ref_contact_no',
				 candidates_address='$candidates_address',
				 candidates_sex='$candidates_sex',
				 candidates_resume_name='$file_name',
				 candidates_current_salary='$candidates_current_salary',
				 candidates_expected_salary='$candidates_expected_salary',
				 candidates_offered_salary='$candidates_offered_salary',
				 candidates_update_date='$crDate'
				 where 1 and candidates_id='$_REQUEST[candidateID]'";
				 db_query($updateSql);
				 ?>
<script type="text/javascript">
			$(document).ready(function(e) {
				$("#AddSucc").show("slow");
            });
			</script>
<? } ?>
<?php if($_REQUEST['candidateID']!=''){ 
 $fetchSql =db_query("select * from tbl_candidates where 1 and candidates_id='".$_REQUEST['candidateID']."'");
  if(mysqli_num_rows($fetchSql)>0){
	  $data = mysqli_fetch_array($fetchSql);
  }
}
?>
<div class="container-fluid" style="margin-top:30px;">
<div class="row">
  <div class="col-sm-12">
    <div class="col-sm-3" style="padding-left:0;">
      <?php include("hr-left-menu.php");?>
    </div>
    <div class="col-sm-9" id="ctID">
      <div class="row">
        <div class="col-sm-12">
          <div id="AddSucc" style="display:none;">
            <div class="alert alert-success"> <a href="#" class="close" data-dismiss="alert">&times;</a> <strong>Success ! Information updated successfully.</strong> </div>
          </div>
          <div id="AddErr" style="display:none;">
            <div class="alert alert-danger"> <a href="#" class="close" data-dismiss="alert">&times;</a> <strong>Sorry ! User already exist.</strong> </div>
          </div>
        </div>
        <h3 class="page-header text-primary" style="margin-top:0;" id="faq-result">
          <?php if($_REQUEST['candidateID']==''){ ?>
          Add
          <? }else{ ?>
          Update
          <? } ?>
          Candidate <small class="pull-right"><a href="manage-candidate.php">Back to Manage Candidates</a></small> </h3>
        <div class="row">
          <div class="col-sm-12">
            <form class="form-horizontal" action="" method="post" enctype="multipart/form-data" onSubmit="return addCandidateValidate()">
              <div class="form-group">
                <label for="inputName" class="control-label col-xs-3">Name</label>
                <div class="col-xs-9 col-sm-6">
                  <input type="text" name="candidates_name" id="candidates_name" <?php if($_REQUEST['candidateID']!=''){ ?>value="<?=$data['candidates_name']?>"<? } ?> class="form-control" id="inputName">
                </div>
              </div>
              <div class="form-group">
                <label for="inputMobile" class="control-label col-xs-3">Mobile</label>
                <div class="col-xs-9 col-sm-6">
                  <input type="text" name="candidates_mobile" id="candidates_mobile" <?php if($_REQUEST['candidateID']!=''){ ?>value="<?=$data['candidates_mobile']?>"<? } ?> class="form-control" id="inputMobile" onchange="check_mobile_exist(this.value)">
                </div>
              </div>
              <div class="form-group">
                <label for="inputRef" class="control-label col-xs-3">Reference By</label>
                <div class="col-xs-9 col-sm-6">
                  <label class="radio-inline">
                    <input type="radio" name="candidates_ref_by" id="candidates_ref_by" value="Current Employee" checked>
                    Current Employee </label>
                  <label class="radio-inline">
                    <input type="radio" name="candidates_ref_by" id="candidates_ref_by" value="Consultant" <?php if($data['candidates_ref_by']=='Consultant'){ ?> checked<? } ?>>
                    Consultant </label>
                  <label class="radio-inline">
                    <input type="radio" name="candidates_ref_by" id="candidates_ref_by" value="HR" <?php if($data['candidates_ref_by']=='HR'){ ?> checked<? } ?>>
                    HR </label>
                  <label class="radio-inline">
                    <input type="radio" name="candidates_ref_by" id="candidates_ref_by" value="Walkin" <?php if($data['candidates_ref_by']=='Walkin'){ ?> checked<? } ?>>
                    Walkin </label>
                </div>
              </div>
              <div class="form-group">
                <label for="inputRef" class="control-label col-xs-3">Referee Name</label>
                <div class="col-xs-9 col-sm-6">
                  <input type="text" name="candidates_ref_name" <?php if($_REQUEST['candidateID']!=''){ ?>value="<?=$data['candidates_ref_name']?>"<? } ?> class="form-control" id="candidates_ref_name">
                </div>
              </div>
              <div class="form-group">
                <label for="inputRef" class="control-label col-xs-3">Referee Contact No</label>
                <div class="col-xs-9 col-sm-6">
                  <input type="text" name="candidates_ref_contact_no" <?php if($_REQUEST['candidateID']!=''){ ?>value="<?=$data['candidates_ref_contact_no']?>"<? } ?> class="form-control" id="candidates_ref_contact_no">
                </div>
              </div>
              <div class="form-group">
                <label for="inputIndustry" class="control-label col-xs-3">Industry</label>
                <div class="col-xs-9 col-sm-6">
                  <select class="form-control" name="candidates_industry" id="candidates_industry">
                    <option value="">Select Industry</option>
                    <option value="Same Industry" <?php if($data['candidates_industry']=='Same Industry'){ ?> selected<? } ?>>Same Industry</option>
                    <option value="Other Sales/Marketing" <?php if($data['candidates_industry']=='Other Sales/Marketing'){ ?> selected<? } ?>>Other Sales/Marketing</option>
                    <option value="Other Inbound" <?php if($data['candidates_industry']=='Other Inbound'){ ?> selected<? } ?>>Other Inbound</option>
                    <option value="Other Outbound" <?php if($data['candidates_industry']=='Other Outbound'){ ?> selected<? } ?>>Other Outbound</option>
                    <option value="Field Work" <?php if($data['candidates_industry']=='Field Work'){ ?> selected<? } ?>>Field Work</option>
                    <option value="Other" <?php if($data['candidates_industry']=='Other'){ ?> selected<? } ?>>Other</option>
                  </select>
                </div>
              </div>
              <div class="form-group">
                <label for="inputSpecialized" class="control-label col-xs-3">Specialized In</label>
                <div class="col-xs-9 col-sm-6">
                  <select class="form-control" name="candidates_specialization" id="candidates_specialization">
                    <option value="">Select Specialization</option>
                    <option value="Sales/Marketing" selected>Sales/Marketing</option>
                    <option value="Designing" <?php if($data['candidates_specialization']=='Designing'){ ?> selected<? } ?>>Designing</option>
                    <option value="Development" <?php if($data['candidates_specialization']=='Development'){ ?> selected<? } ?>>Development</option>
                    <option value="SEO" <?php if($data['candidates_specialization']=='SEO'){ ?> selected<? } ?>>SEO</option>
                    <option value="HR" <?php if($data['candidates_specialization']=='HR'){ ?> selected<? } ?>>HR</option>
                    <option value="Other Back-End" <?php if($data['candidates_specialization']=='Other Back-End'){ ?> selected<? } ?>>Other Back-End</option>
                    <option value="Other" <?php if($data['candidates_specialization']=='Other'){ ?> selected<? } ?>>Other</option>
                  </select>
                </div>
              </div>
              <div class="form-group">
                <label for="inputEmp" class="control-label col-xs-3">Current Emp Status</label>
                <div class="col-xs-9 col-sm-6">
                  <select class="form-control" name="candidates_current_emp_status" id="candidates_current_emp_status">
                    <option>Select Employment Status</option>
                    <option value="Fresher" selected>Fresher</option>
                    <option value="Experienced" <?php if($data['candidates_current_emp_status']=='Experienced'){ ?> selected<? } ?>>Experienced</option>
                  </select>
                </div>
              </div>
              <div class="form-group">
                <label for="inputEmail" class="control-label col-xs-3">Email</label>
                <div class="col-xs-9 col-sm-6">
                  <input type="text" name="candidates_email" <?php if($_REQUEST['candidateID']!=''){ ?>value="<?=$data['candidates_email']?>"<? } ?> class="form-control" id="candidates_email">
                </div>
              </div>
              <div class="form-group">
                <label for="inputAltmobile" class="control-label col-xs-3">Alt Mobile</label>
                <div class="col-xs-9 col-sm-6">
                  <input type="text" name="candidates_alt_mobile" <?php if($_REQUEST['candidateID']!=''){ ?>value="<?=$data['candidates_alt_mobile']?>"<? } ?> class="form-control" id="candidates_alt_mobile">
                </div>
              </div>
              <div class="form-group">
                <label for="inputWhatsapp" class="control-label col-xs-3">WhatsApp No</label>
                <div class="col-xs-9 col-sm-6">
                  <input type="text" name="candidates_whatsapp_no" <?php if($_REQUEST['candidateID']!=''){ ?>value="<?=$data['candidates_whatsapp_no']?>"<? } ?> class="form-control" id="candidates_whatsapp_no">
                </div>
              </div>
              <div class="form-group">
                <label for="inputAddress" class="control-label col-xs-3">Address</label>
                <div class="col-xs-9 col-sm-6">
                  <input type="text" name="candidates_address" <?php if($_REQUEST['candidateID']!=''){ ?>value="<?=$data['candidates_address']?>"<? } ?> class="form-control" id="candidates_address">
                </div>
              </div>
              <div class="form-group">
                <label for="inputSex" class="control-label col-xs-3">Gender</label>
                <div class="col-xs-9 col-sm-6">
                  <select class="form-control" name="candidates_sex" id="candidates_sex">
                    <option>Select Sex</option>
                    <option value="Male" selected>Male</option>
                    <option value="Female" <?php if($data['candidates_sex']=='Female'){ ?> selected<? } ?>>Female</option>
                  </select>
                </div>
              </div>
              <div class="form-group">
                <label for="inputResume" class="control-label col-xs-3">Upload Resume</label>
                <div class="col-xs-9 col-sm-6">
                  <input type="file" name="file" class="form-control" id="candidates_resume_name">
                </div>
              </div>
              <div class="form-group">
                <label for="inputCsal" class="control-label col-xs-3">Current Salary</label>
                <div class="col-xs-9 col-sm-6">
                  <input type="text" name="candidates_current_salary" <?php if($_REQUEST['candidateID']!=''){ ?>value="<?=$data['candidates_current_salary']?>"<? } ?> class="form-control" id="candidates_current_salary">
                </div>
              </div>
              <div class="form-group">
                <label for="inputEsal" class="control-label col-xs-3">Expected Salary</label>
                <div class="col-xs-9 col-sm-6">
                  <input type="text" name="candidates_expected_salary" <?php if($_REQUEST['candidateID']!=''){ ?>value="<?=$data['candidates_expected_salary']?>"<? } ?> class="form-control" id="candidates_expected_salary">
                </div>
              </div>
              <div class="form-group">
                <label for="inputOsal" class="control-label col-xs-3">Offered Salary</label>
                <div class="col-xs-9 col-sm-6">
                  <input type="text" name="candidates_offered_salary" <?php if($_REQUEST['candidateID']!=''){ ?>value="<?=$data['candidates_offered_salary']?>"<? } ?> class="form-control" id="candidates_offered_salary">
                </div>
              </div>
              <div class="form-group">
                <div class="col-xs-offset-3 col-xs-9">
                  <?php if($_REQUEST['candidateID']==''){ ?>
                  <button type="submit" name="AddCandidateSubmit" id="AddCandidateSubmit" class="btn btn-primary btn-lg">Add Candidate</button>
                  <? }else{ ?>
                  <button type="submit" name="UpdateCandidateSubmit" class="btn btn-primary btn-lg">Update Candidate</button>
                  <? } ?>
                </div>
              </div>
            </form>
          </div>
        </div>
      </div>
    </div>
  </div>
</div>
<script type="text/javascript">
function addCandidateValidate(){	
   function trim(str){				
	 return str.replace(/^\s*|\s*$/g,'');
	}	
var loginID=trim(document.getElementById('candidates_name').value);
if(loginID=='')
  {
	  alert("Enter candidate name !");
	  document.getElementById('candidates_name').focus();
	  return false;
  }
var mobno=trim(document.getElementById('candidates_mobile').value);
if(trim(document.getElementById('candidates_mobile').value)==0){
	alert("Enter candidate mobile no.!");
	document.getElementById('candidates_mobile').focus();
	return false;
}



if(isNaN(document.getElementById('candidates_mobile').value)){
	alert("Mobile no. should be no.!");
	document.getElementById('candidates_mobile').focus();
	return false;
}
if(mobno.length < 10){
    alert("Mobile no. should be 10 digit long !");
	document.getElementById('candidates_mobile').focus();
	return false;
}	
}



/*****************************  CHECK MOBILE ALREADY EXIST *************************/

function check_mobile_exist(mobile_no)
{     
        $.ajax({
            url:"check-duplicate-mobile.php",
            type:"POST",
            data:{mobile_no:mobile_no},
            success:function(data){
if(data==1){
    
    
$('#candidates_mobile').css({"border-color":"red"});
alert("Mobile no. is already exist!\nPlease use the another mobile no.!");


$('#AddCandidateSubmit').attr("disabled","disabled");
$('#AddCandidateSubmit').css({"cursor":"no-drop"});
$('#AddCandidateSubmit').css({"background-color":"black"});

                }else{
                    $('#candidates_mobile').css({"border-color":"gray"});
                    $('#AddCandidateSubmit').attr("disabled",false);
                    $('#AddCandidateSubmit').css({"cursor":"pointer"});
                }
            }
        });
 }
 
</script>
<?php include("hr-footer.php");?>

MMCT - 2023