<?php
$Object = new Common();
$table = "tbl_candidates";
if(!isset($_SESSION['candidate_id'])||($_SESSION['candidate_id'] < 1)){ $Object->redirect("index.php?action=login");
}
if(isset($_SESSION['candidate_id'])&&($_SESSION['candidate_id'] > 0)){ $response = $Object->isRegistered($_SESSION['candidate_id'],$table);
if($response < 1){
$Object->redirect("index.php?action=registration");
}
}
$condition = "candidate_id='".$_SESSION['candidate_id']."'";
$canidateGenderDetails = $Object->SelectOneRow('*',$condition,$table);
$condition = "candidate_id='".$_SESSION['candidate_id']."'";
$canidateDetails = $Object->SelectOneRow('*',$condition,$table);
$switch_option= "insert";
$table = "tbl_candidates_basic_info";
if($Object->isRowExist($condition,$table) == 1){
$canidateBasicDetails = $Object->SelectOneRow('*',$condition,$table);
if(!empty($canidateBasicDetails)){ $switch_option= "update";
}
}
?>
<script type="text/javascript">
function checkEmpty(){
error =0;
living_duration_month = $("select#living_duration_month").val();
living_duration_year = $("select#living_duration_year").val();
if((living_duration_month == "")||(living_duration_year == "")){
error =1;
$("#error_living_duration").empty("");
$("#error_living_duration").append(" No se puede dejar el campo vacío.");
if(living_duration_month == ""){
$("#living_duration_month").removeClass("select");
$("#living_duration_month").addClass("select_red");
}else{
$("#living_duration_month").addClass("select");
$("#living_duration_month").removeClass("select_red");
}
if(living_duration_year == ""){
$("#living_duration_year").removeClass("select");
$("#living_duration_year").addClass("select_red");
}else{
$("#living_duration_year").addClass("select");
$("#living_duration_year").removeClass("select_red");
}
}
residence_type = $("select#residence_type").val();
if(residence_type == ""){
$("#residence_type").removeClass("drpdwn-sml");
$("#residence_type").addClass("drpdwn-sml-red");
$("#error_residence_type").empty("");
$("#error_residence_type").append(" No se puede dejar el campo vacío.");
error =1;
}else{
$("#error_residence_type").empty("");
$("#residence_type").removeClass("drpdwn-sml-red");
$("#residence_type").addClass("drpdwn-sml");
}
if(residence_type == "Arrendada"){
telephone_no = $("input#telephone_no").val();
if(telephone_no == ""){
error =1;
$("#error_telephone_no").empty("");
$("#error_telephone_no").append(" No se puede dejar el campo vacío.");
$("#telephone_no").addClass("input_red");
}else{
$("#error_telephone_no").empty("");
$("#telephone_no").removeClass("input_red");
}
}
residence_ownership_type = $("select#residence_ownership_type").val();
if(residence_ownership_type == ""){
$("#residence_ownership_type").removeClass("select_mid");
$("#residence_ownership_type").addClass("select_mid_red");
$("#error_residence_ownership_type").empty("");
$("#error_residence_ownership_type").append("No se puede dejar el campo vacío.");
error =1;
}else{
$("#error_residence_ownership_type").empty("");
$("#residence_ownership_type").addClass("select_mid");
$("#residence_ownership_type").removeClass("select_mid_red");
}
relationship_type_them = $("select#relationship_type_them").val();
if(relationship_type_them == ""){
$("#relationship_type_them").removeClass("select_mid");
$("#relationship_type_them").addClass("select_mid_red");
$("#error_relationship_type_them").empty("");
$("#error_relationship_type_them").append("No se puede dejar el campo vacío.");
error =1;
}else{
$("#relationship_type_them").removeClass("select_mid_red");
$("#relationship_type_them").addClass("select_mid");
$("#error_relationship_type_them").empty("");
}
no_pople_living = $("input#no_pople_living").val();
if(no_pople_living == ""){
error =1;
$("#error_no_pople_living").empty("");
$("#error_no_pople_living").append(" No se puede dejar el campo vacío.");
$("#no_pople_living").addClass("input_red");
}else{
$("#error_no_pople_living").empty("");
$("#no_pople_living").removeClass("input_red");
}
home_address = $("input#home_address").val();
if(home_address == ""){
error =1;
$("#error_home_address").empty("");
$("#error_home_address").append(" No se puede dejar el campo vacío.");
$("#home_address").addClass("input_red");
}else{
$("#error_home_address").empty("");
$("#home_address").removeClass("input_red");
}
neighborhood_of_residence = $("input#neighborhood_of_residence").val();
if(neighborhood_of_residence == ""){
error =1;
$("#error_neighborhood_of_residence").empty("");
$("#error_neighborhood_of_residence").append(" No se puede dejar el campo vacío.");
$("#neighborhood_of_residence").addClass("input_red");
}else{
$("#error_neighborhood_of_residence").empty("");
$("#neighborhood_of_residence").removeClass("input_red");
}
neighborhood_of_residence = $("input#neighborhood_of_residence").val();
if(neighborhood_of_residence == ""){
error =1;
$("#error_neighborhood_of_residence").empty("");
$("#error_neighborhood_of_residence").append(" No se puede dejar el campo vacío.");
$("#neighborhood_of_residence").addClass("input_red");
}else{
$("#error_neighborhood_of_residence").empty("");
$("#neighborhood_of_residence").removeClass("input_red");
}
contact_persone_name = $("input#contact_persone_name").val();
if(contact_persone_name == ""){
error =1;
$("#error_contact_persone_name").empty("");
$("#error_contact_persone_name").append(" No se puede dejar el campo vacío.");
$("#contact_persone_name").addClass("input_red");
}else{
$("#error_contact_persone_name").empty("");
$("#contact_persone_name").removeClass("input_red");
}
profession = $("select#profession").val();
if(profession == ""){
error =1;
$("#error_profession").empty("");
$("#profession").removeClass("select_mid");
$("#profession").addClass("select_mid_red");
$("#error_profession").append(" No se puede dejar el campo vacío.");
}else{
$("#error_profession").empty("");
$("#profession").removeClass("select_mid_red");
$("#profession").addClass("select_mid");
}
contact_person_relation_type = $("select#contact_person_relation_type").val();
if(contact_person_relation_type == ""){
error =1;
$("#error_contact_person_relation_type").empty("");
$("#contact_person_relation_type").removeClass("drpdwn-sml");
$("#contact_person_relation_type").addClass("drpdwn-sml-red");
$("#error_contact_person_relation_type").append(" No se puede dejar el campo vacío.");
}else{
$("#error_contact_person_relation_type").empty("");
$("#contact_person_relation_type").removeClass("drpdwn-sml-red");
$("#contact_person_relation_type").addClass("drpdwn-sml");
}
contact_person_phone_no = $("input#contact_person_phone_no").val();
if(contact_person_phone_no == ""){
error =1;
$("#error_contact_person_phone_no").empty("");
$("#error_contact_person_phone_no").append(" No se puede dejar el campo vacío.");
$("#contact_person_phone_no").addClass("input_red");
}else{
$("#error_contact_person_phone_no").empty("");
$("#contact_person_phone_no").removeClass("input_red");
}
if(error == 1){
return false;
}
}
</script>
<script type="text/javascript">
function selectMilitaryType(){
type_military_card = $("select#type_military_card").val();
if(type_military_card == ""){
jQuery("select#type_military_card option[value='']").attr("selected", "selected");
$("input#military_card_no").val('');
$("input#military_district").val('');
}
}
function hide_show(){
residence_ownership_type = $("select#residence_ownership_type").val();
if(residence_ownership_type == "Arrendada"){
$("#showArrendada").show();
}else{
$("#showArrendada").hide();
$("input#telephone_no").val('');
$("input#cellphone_no").val('');
$("input#landlord_name").val('');
$("input#landlord_phone").val('');
}
}
</script>
<style type="text/css">
p{
padding-left:5px;
}
</style>