/home/mip/public_html_/old_mip/apply_online_education.php
<?php
require_once( "func-all.php"); 
do_header(); 
$educations = getdata("select * from web_education where applicant_id='$applicant_id'");
$arr_education = array(
					'High School Diploma'=>'High School Diploma',
					'Vocational Diploma / Short Course Certificate'=>'Vocational Diploma / Short Course Certificate',
					'College Level (Undergraduate)'=>'College Level (Undergraduate)',
					'Bachelor\'s / College Degree'=>'Bachelor\'s / College Degree',
					'Post Graduate Diploma / Master\'s Degree'=>'Post Graduate Diploma / Master\'s Degree',
					'Prof\'l License / (Passed Board/Bar/Prof\'l License Exam)'=>'Prof\'l License / (Passed Board/Bar/Prof\'l License Exam)',
					'Doctorate Degree'=>'Doctorate Degree'
				 );
?>

<div class="inner-header">
    
<img src="images/img-inner-header-apply.jpg" class="img-responsive"/>

</div>
<div class="container">
<div class="row">

<div class="col-sm-12">
<h3>Apply Online Education</h3>
<div class="pull-right"><a href="javascript:void(0)" id="addeducation" class="btn btn-warning btn-sm">Add Education</a></div>
<table class="table table-striped">
	<thead>
		<th>#</th>
		<th>Education</th>
		<th>Course</th>
		<th>School</th>
		<th>School Year</th>
		<th>Action</th>
	</thead>
	<tbody>
	    <?php if(isset($educations)) { ?>
		<?php foreach ($educations as $key => $education) { ?>
		<tr>
			<td><?php echo $key; ?></td>
			<td><?php echo $education['education']; ?></td>
			<td><?php echo $education['course'] ?></td>
			<td><?php echo $education['school'] ?></td>
			<td><?php echo ($education['from_date']!='0') ? $education['from_date'].' - '.$education['to_date'] : ''; ?></td>
			<td>
				<a href="javascript:void(0)" onclick="editeducation(<?php echo $education['id']; ?>)" class="btn btn-success btn-xs">Edit</a>
				<a href="sqldelete.php?what=web_education&id=<?php echo $education['id']; ?>&applicant_id=<?php echo $applicant_id; ?>" onclick="confirm('Are you sure you want to delete this?');" class="btn btn-danger btn-xs">Remove</a>
			</td>
		</tr>
		<?php } ?>
		<?php } ?>
	</tbody>
</table>
<div class="pull-right"><a href="<?php if(count($educations)<>0){ ?>apply_online_employment.php?applicant_id=<?php echo $applicant_id; } else { echo '#'; } ?>" id="secondnext" <?php echo (count($educations)<>0) ? '' : 'disabled=disabled' ?> class="btn btn-warning btn-sm">Move to the Next Stage</a></div>
</div>
</div>
</div>
<div class="modal fade bs-example-modal-md" id="educationModal" tabindex="-1" role="dialog" aria-labelledby="mySmallModalLabel">
	<div class="modal-dialog modal-md modal-z-index">
		<div class="modal-content">
			<form action="sqladd.php?what=web_education" method="post" id="myForm">
			<div class="modal-header">
				<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
				<h4 class="modal-title" id="myModalLabel">Add Education</h4>
			</div>
			<div class="modal-body">
				<div class="form-group" id="educationField">
				    <label class="formlabel">Education <span style="color:#d9534f; font-size:16px !important">*</span></label>
				    <select name="education" id="education" class="form-control">
				    	<option value="">--</option>
				    	<?php foreach ($arr_education as $key => $value) { ?>
				    	<option value="<?php echo $value; ?>"><?php echo $value; ?></option>
				    	<?php } ?>
				    </select>
				    <small id="educationInput"></small>
				</div>
				<div class="form-group">
				    <label class="formlabel">Duration</label>
				    <div class="form-inline">
					    From
					    <input type="text" name="from_date" class="form-control" id="from_date" />
					    To
					    <input type="text" name="to_date" class="form-control" id="to_date" />
				    </div>
				</div>
				<div class="form-group" id="schoolField">
					<label class="formlabel">School/Institution <span style="color:#d9534f; font-size:16px !important">*</span></label>
					<input type="text" name="school" class="form-control" id="school" />
				</div>
				<div class="form-group" id="courseField">
					<label class="formlabel">Course/Title</label>
					<input type="text" name="course" id="course" class="form-control" />
				</div>
			</div>
			<div class="modal-footer">
				<input type="hidden" name="applicant_id" id="applicant_id" value="<?php echo $applicant_id; ?>" />
				<button type="submit" class="btn btn-warning btn-sm" id="addeducationbtn">Save</button>
			</div>
			</form>
		</div>
	</div>
</div>

<script src="plugins/input-mask/jquery.inputmask.js"></script>
<script src="plugins/input-mask/jquery.inputmask.date.extensions.js"></script>
<script src="plugins/input-mask/jquery.inputmask.extensions.js"></script>
<script type="text/javascript">
$(document).ready(function() {
	$(".datemask").inputmask("mm/dd/yyyy", {"placeholder": "mm/dd/yyyy"});

	$('#addeducation').click(function() {
		$('#educationModal').modal();
	});
	$('#addeducationbtn').click(function() {
		if($('#education').val()==''){
			$('#educationField').addClass('has-error');
			$('#educationField').css('color', '#d9534f');
			$('#educationInput').html('Education field is required');
			$('#education').focus();
			return false;
		} else if($('#school').val()==''){
			$('#schoolField').addClass('has-error');
			$('#schoolField').css('color', '#d9534f');
			$('#schoolInput').html('School field is required');
			$('#school').focus();
			return false;
		} else {
			$('#addeducationbtn').html('Processing..');
			$('#addeducationbtn').attr('disabled', true);
			$('#myForm').submit();
		}
	});
});
function editeducation(id){
	$('#educationModal').modal();
	$.ajax({
		url: 'sqloption.php?what=education',
		type: 'POST',
		data: {
			id: id
		},
		dataType: "json",
		success: function(result){
			$('#education').val(result.education);
			$('#from_date').val(result.from_date);
			$('#to_date').val(result.to_date);
			$('#school').val(result.school);
			$('#course').val(result.course);
			$('#myForm').attr('action', 'sqlupdate.php?what=web_education&id='+result.id);
		}
	});
	
}
</script>
<?php
do_employerlogin();
do_footer(); 
?>