siddharth_application/application/views/addemployee.php
2017-04-07 18:21:32 +05:30

564 lines
20 KiB
PHP
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<script>
function readURL(input) {
if (input.files && input.files[0]) {
var reader = new FileReader();
reader.onload = function (e) {
$('#profilepicture')
.attr('src', e.target.result)
.width(166)
.height(166);
};
reader.readAsDataURL(input.files[0]);
}
}
$(function(){
$('#checksame').click(function(){
$('#permanentaddress').val($('#currentaddress').val());
});
});
function isNumberKey(evt)
{
var charCode = (evt.which) ? evt.which : evt.keyCode;
if (charCode != 46 && charCode > 31
&& (charCode < 48 || charCode > 57))
return false;
return true;
}
//PAN Validate
function validatePAN() {
var reg = /(?=.*[A-Za-z]).{5,}(?=.*[0-9]).{4,}(?=.*[A-Za-z]).{1,}$/;
var PAN = $('#panno').val();
if(PAN != '')
{
if (reg.test(PAN) == false)
{
alert('Please Enter Valid PAN Number');
return (false);
}
else
{
return true;
}
}
}
function Validate()
{
if($("option:selected", $("#gender")).val() == '-1')
{
alert('Please Select Gender');
return;
}
if($("option:selected", $("#MartialStatus")).val() == "-1")
{
alert('Please Select Martial Status');
return;
}
if($("option:selected", $("#bloodgroup")).val() == "-1")
{
alert('Please Select Blood group ');
return;
}
if($("option:selected", $("#desigination")).val() == "-1")
{
alert('Please Select Desigination ');
return;
}
if($("option:selected", $("#departmentname")).val() == "-1")
{
alert('Please Select Department name');
return;
}
if($("option:selected", $("#eduqualifaction")).val() == "-1")
{
alert('Please Select Qualification');
return;
}
if(!validateEmail())
{
alert('Please Enter Valid Email Address');
return ;
}
getMobileValidation();
getValidEmergencyNumber();
getValidReferNumber();
}
function getMobileValidation() {
var contactNumber = $('#ContactNumber').val().length;
if(contactNumber < 10)
{
alert('Please Enter valid Contact Number');
return false;
}
else
{
return true;
}
}
function getValidEmergencyNumber() {
var contactNumber = $('#emergencycontactnumber').val().length;
if(contactNumber > 0 && contactNumber < 10)
{
alert('Please Enter valid Emergency Contact Number');
return false;
}
else
{
return true;
}
}
function getValidReferNumber() {
var contactNumber = $('#referrercontno').val().length;
if(contactNumber > 0 && contactNumber < 10)
{
alert('Please Enter valid Refernce Contact Number');
return false;
}
else
{
return true;
}
}
function validateEmail() {
var reg = /^([A-Za-z0-9_\-\.])+\@([A-Za-z0-9_\-\.])+\.([A-Za-z]{2,4})$/;
var email = $('#emailid').val();
if(email != '')
{
if (reg.test(email) == false)
{
alert('Please Enter Valid Email Address');
return (false);
}
else
{
return true;
}
}
else
{
alert('Please Enter Email Address');
return (false);
}
}
function getAge() {
var dateString = $("#DateofBirth").val();
var today = new Date();
var birthDate = new Date(dateString);
var age = today.getFullYear() - birthDate.getFullYear();
var m = today.getMonth() - birthDate.getMonth();
if (m < 0 || (m === 0 && today.getDate() < birthDate.getDate())) {
age--;
}
$("#age").val(age);
}
$(function() {
var d = new Date();
var month = d.getMonth();
var day = d.getDate();
var year = d.getFullYear() ;
var SIAStartYear = year - 2015;
var mindt = year-70;
var maxdt = year-15;
$("#DateofBirth").datepicker({
minDate : new Date(mindt,1,1),
maxDate : new Date(maxdt,1,1),
dateFormat: 'mm/dd/yy',
});
$("#dateofjoining").datepicker({
minDate : new Date(year-SIAStartYear,1,1),
maxDate :'now',
dateFormat: 'mm/dd/yy'
});
$("#ValidTill").datepicker({dateFormat: 'mm/dd/yy',minDate :'now',});
});
function resetphoto()
{
$("#photo").src("");
}
</script>
<style>
legend{
color:#00c0ef ! important;
}
.form-group
{
padding-bottom:4%;
}
.pad{
padding-bottom:1%;
}
.badge
{
color:red; background-color:#fff;
}
</style>
<div class="content-wrapper">
<!-- Content Header (Page header) -->
<section class="content-header">
<h1>
<CENTER>Siddharth Industries Employee Profile</CENTER>
</h1>
</section>
<section class="content">
<div style="text-align:right;">
<a href="<?php echo base_url() ?>employeeListing" class="btn btn-info" value="Back">Back</a>
</div>
<br/>
<div class="row">
<!-- left column -->
<div class="col-md-12">
<!-- general form elements -->
<div class="box box-primary">
<!-- /.box-header -->
<!-- form start -->
<form role="form" id="addemployee" action="<?php echo base_url() ?>Employeedetails/AddNewEmployee" method="post" enctype="multipart/form-data">
<div class="row">
<div class="col-md-10 col-md-offset-1" style="border:3px solid #3c8dbc;">
<form class="form-horizontal" role="form" >
<fieldset>
<!-- Form Name -->
<legend>Personal Information</legend>
<div class="col-md-12">
<div class="col-md-3">
<div class="box-header">
<img id="profilepicture" src="<?php echo base_url(); ?>assets/dist/img/avatar.png" alt="your image" style="width: 139px;"/><br/>
<input type='file' onchange="readURL(this);" id="photo" name="photo"/>
<label for="photo">Select profile picture<br/><small>(only .jpg or .png)</small></label>
<br/><input type="checkbox" id="isactive" name="isactive" onclick="checkactive"> IsActive
</div>
</div>
<div class="col-md-9">
<div class="col-md-6 pad">
<span class="badge">*</span>
<input type="text" name="FirstName" maxlength="100" id="FirstName" placeholder="First Name" class="form-control" required>
</div>
<div class="col-md-6 pad"><span class="badge">*</span>
<input type="text" name="LastName" maxlength="100" id="LastName" placeholder="Last Name" class="form-control" required>
</div>
<div class="col-md-6 pad"><span class="badge">*</span>
<input type="text" name="FatherName" id="FatherName" maxlength="200" placeholder="Father / Husband Name" class="form-control" required>
</div>
<div class="col-md-6 pad"><span class="badge">*</span>
<input id="DateofBirth" required name="DateofBirth" maxlength="10" placeholder="Date Of Birth" onchange="getAge();" class="form-control">
</div>
<div class="col-md-6 pad">
<input type="text" name="age" placeholder="Age" id="age" class="form-control" readonly>
</div>
<div class="col-md-6 pad">
<select id="gender" name="gender" type="text" placeholder="Gender" required class="form-control">
<option value="-1">Select Gender</option>
<?php
if(!empty($Gender))
{
foreach ($Gender as $rl)
{
?>
<option value="<?php echo $rl->ConfigValue ?>"><?php echo $rl->ConfigValue ?></option>
<?php
}
}
?>
</select>
</div>
<div class="col-md-6 pad"><span class="badge">*</span>
<input type="text" name="ContactNumber" onblur="getMobileValidation();" onkeypress="return event.charCode >= 48 && event.charCode <= 57" id="ContactNumber" required placeholder="Contact Number" maxlength="10" class="form-control">
</div>
<div class="col-md-6 pad"><span class="badge">*</span>
<input type="mail" name="emailid" id="emailid" placeholder="Email ID" maxlength="100" class="form-control">
</div>
<div class="col-md-6 pad">
<select id="MartialStatus" name="MartialStatus" type="text" required placeholder="Martial status" class="form-control">
<option value="-1">Select Martial Status</option>
<?php
if(!empty($Martial))
{
foreach ($Martial as $rl)
{
?>
<option value="<?php echo $rl->ConfigValue ?>"><?php echo $rl->ConfigValue ?></option>
<?php
}
}
?>
</select>
</div>
<div class="col-md-6 pad">
<select id="bloodgroup" name="bloodgroup" required class="form-control">
<option value="-1">Select Blood group</option>
<?php
if(!empty($BloodGroup))
{
foreach ($BloodGroup as $rl)
{
?>
<option value="<?php echo $rl->ConfigValue ?>"><?php echo $rl->ConfigValue ?></option>
<?php
}
}
?>
</select>
</div>
</div>
</div>
<!-- Address Section -->
<!-- Form Name -->
<legend>Address Details</legend>
<!-- Text input-->
<div class="form-group">
<div class="col-md-12"><span class="badge">*</span>
<input type="text" id="currentaddress" required name="currentaddress" maxlength="500" placeholder="Current Address" class="form-control">
</div>
</div>
<div class="form-group">
<div class="col-md-10">
<input type="checkbox" id="checksame" name="sameaddress" onclick="CheckClick"> Current address same as permanent address
</div>
</div>
<!-- Text input-->
<div class="form-group">
<div class="col-md-12"><span class="badge">*</span>
<input type="text" id="permanentaddress" required name="permanentaddress" maxlength="500" placeholder="Permanent Address " class="form-control">
</div>
</div>
<!-- Text input-->
<!-- Emergency Contact Section -->
<!-- Form Name -->
<legend>Emergency Contact Information</legend>
<!-- Text input-->
<div class="form-group">
<div class="col-md-6"><span class="badge">*</span>
<input type="text" id="emergencycontactname" maxlength="100" required name="emergencycontactname" placeholder="Emergency Contact Name" class="form-control">
</div>
<div class="col-md-6"><span class="badge">*</span>
<input type="text" id="emergencycontactnumber" required name="emergencycontactnumber" onblur="getValidEmergencyNumber();" onkeypress="return event.charCode >= 48 && event.charCode <= 57" maxlength="10" placeholder="Emergency Contact Number" class="form-control">
</div>
</div>
<!-- profile Section -->
<!-- Form Name -->
<legend>Work Profile</legend>
<!-- Text input-->
<div class="form-group">
<div class="col-md-3">
<select type="text" id="desigination" name="desigination" required class="form-control">
<option value="-1">Select Designation</option>
<?php
if(!empty($Designation))
{
foreach ($Designation as $rl)
{
?>
<option value="<?php echo $rl->ConfigValue ?>"><?php echo $rl->ConfigValue ?></option>
<?php
}
}
?>
</select>
</div>
<div class="col-md-3">
<select type="text" id="departmentname" name="departmentname" required class="form-control">
<option value="-1">Select Department</option>
<?php
if(!empty($Department))
{
foreach ($Department as $rl)
{
?>
<option value="<?php echo $rl->DEPCode ?>"><?php echo $rl->DEPCode." - " .$rl->DepartmentName ?></option>
<?php
}
}
?>
</select>
</div>
<div class="col-md-3">
<input id="dateofjoining" name="dateofjoining" maxlength="10" required placeholder="Date Of Joining" class="form-control">
</div>
<div class="col-md-3">
<input type="text" id="Previousexperience" name="Previousexperience" maxlength="4" onkeypress="return isNumberKey(event)" placeholder="Previous Years of Experience" class="form-control">
</div>
</div>
<div class="form-group">
<div class="col-md-3">
<select type="text" id="eduqualifaction" name="eduqualifaction" required class="form-control">
<option value="-1">Select Qualification</option>
<?php
if(!empty($Qualification))
{
foreach ($Qualification as $rl)
{
?>
<option value="<?php echo $rl->ConfigValue ?>"><?php echo $rl->ConfigValue ?></option>
<?php
}
}
?>
</select>
</div>
<div class="col-md-3">
<input type="text" id="addqualification" name="addqualification" maxlength="100" placeholder="Additional Qualification" class="form-control">
</div>
<div class="col-md-3">
<input type="text" id="referredby" name="referredby" placeholder="Referred By" maxlength="100" class="form-control">
</div>
<div class="col-md-3">
<input type="text" id="referrercontno" name="referrercontno" onblur=" getValidReferNumber();"
" maxlength="10" onkeypress="return event.charCode >= 48 && event.charCode <= 57" placeholder="Referrer Contact Number" class="form-control">
</div>
</div>
<legend>Bank Details</legend>
<!-- Text input-->
<div class="form-group">
<div class="col-md-3"><span class="badge">*</span>
<input type="text" id="accountno" onkeypress="return event.charCode >= 48 && event.charCode <= 57" maxlength="15" name="accountno" placeholder="Account Number" class="form-control">
</div>
<div class="col-md-3"><span class="badge">*</span>
<input type="text" id="ifsccode" name="ifsccode" placeholder="IFSC Code" maxlength="10" class="form-control">
</div>
<div class="col-md-3"><span class="badge">*</span>
<input type="text" id="bankbranchname" maxlength="200" name="bankbranchname" placeholder="Bank Branch Name" class="form-control">
</div>
<div class="col-md-3"><span class="badge">*</span>
<input type="text" id="bankaddress" maxlength="200" name="bankaddress" placeholder="Bank Address" class="form-control">
</div>
</div>
<legend>ID Proof</legend>
<!-- Text input-->
<div class="form-group">
<div class="col-md-3">
<input type="text" id="aadharno" name="aadharno" maxlength="50" placeholder="Aadhar Number" class="form-control">
</div>
<div class="col-md-3">
<input type="text" id="panno" maxlength="10" name="panno" placeholder="PAN Number" onblur="validatePAN();" class="form-control">
</div>
<div class="col-md-3">
<input type="text" id="passportno" maxlength="50" name="passportno" placeholder="Passport Number" class="form-control">
</div>
<div class="col-md-3">
<input id="ValidTill" name="ValidTill" maxlength="10" placeholder="ValidTill" class="form-control">
</div>
</div>
<legend>Additional Information</legend>
<!-- Text input-->
<div class="form-group">
<div class="col-md-12">
<input type="text" id="addinfo" name="addinfo" placeholder="Additional Information" class="form-control">
</div>
</div>
<!-- Command -->
<div class="form-group">
<div class="col-md-3 col-md-offset-9">
<div class="pull-right">
<input type="reset" id="reset" onclick="resetphoto();" class="btn btn-info" value="Reset" />
<input type="submit" onclick="Validate();" class="btn btn-primary"></button>
</div>
</div>
</div>
</fieldset>
</form>
</div><!-- /.col-lg-12 -->
</div><!-- /.row -->
</form>
</div>
</div>
<div class="col-md-4">
<?php
$this->load->helper('form');
$error = $this->session->flashdata('error');
if($error)
{
?>
<div class="alert alert-danger alert-dismissable">
<button type="button" class="close" data-dismiss="alert" aria-hidden="true">×</button>
<?php echo $this->session->flashdata('error'); ?>
</div>
<?php } ?>
<?php
$success = $this->session->flashdata('success');
if($success)
{
?>
<div class="alert alert-success alert-dismissable">
<button type="button" class="close" data-dismiss="alert" aria-hidden="true">×</button>
<?php echo $this->session->flashdata('success'); ?>
</div>
<?php } ?>
<div class="row">
<div class="col-md-12">
<?php echo validation_errors('<div class="alert alert-danger alert-dismissable">', ' <button type="button" class="close" data-dismiss="alert" aria-hidden="true">×</button></div>'); ?>
</div>
</div>
</div>
</div>
</section>
</div>
<script src="<?php echo base_url(); ?>assets/js/addUser.js" type="text/javascript"></script>