<?php include("header.php"); ?>
<script type="text/javascript">
$(document).ready( function() {
<!-- halin d ang spec characters -->
 $(".valid").keydown(function(event) {
        // Allow: backspace, comma, delete, tab and escape
		
        if ( event.keyCode == 46 //delete
		|| event.keyCode == 188  //backspace
		|| event.keyCode == 8    //comma
		|| event.keyCode == 9  //tab
		|| event.keyCode == 27 //esc
		|| event.keyCode == 109 // dash
            || // Allow: Ctrl+A
            (event.keyCode == 65 && event.ctrlKey === true) || 
             // Allow: home, end, left, right
            (event.keyCode >= 35 && event.keyCode <= 39)) {
                 // let it happen, don't do anything
                 return;
        }
        else {
            // Ensure that it is a number and stop the keypress
            if ((event.keyCode < 48 || event.keyCode > 57) && (event.keyCode < 96 || event.keyCode > 105 )) {
                event.preventDefault(); 
            }   
        }
    });
<!--asta d -->
$(".uploadthis").hide();	

$("#append").click( function() {
		$(".inc").append('<div class="field"><label>&nbsp;</label><select class="equips" name="equips[]"><?php  equips(); ?></select><a href="#" class="remove_this">remove</a></div>');
		return false;
	});
	
// using live() will bind the event to all future
// elements as well as the existing ones
jQuery('.remove_this').live('click', function() {
    $(this).parent().remove();
    return false;
});
$(".email").change( function() {
		var emailReg = /^([\w-\.]+@([\w-]+\.)+[\w-]{2,4})?$/;
		var email = jQuery('.email').val();
		if(!emailReg.test(email)){
					alert('Please enter a valid email adderess.');
				}
		return false;
	});
jQuery('#save_equip').submit(function(e){
    e.preventDefault();
	
	/*  validation */
	
	var first_name = jQuery('.first_name').val();
	var middle_initial = jQuery('.middle_initial').val();
	var last_name = jQuery('.last_name').val();
	var gender = jQuery('.gender').val();
	var street = jQuery('.street').val();
	var city = jQuery('.city').val();	
	var province = jQuery('.province').val();
	var birthdate = jQuery('.birthdate').val();
	var status = jQuery('.status').val();			
	var philhealth = jQuery('.philhealth').val();			
	var sss = jQuery('.sss').val();
	var position = jQuery('.position').val();
	var email = jQuery('.email').val();		
	var contact = jQuery('.contact').val();			
	var contact_per = jQuery('.contact_per').val();
	var skills = jQuery('.skills').val();
	var ranking = jQuery('.ranking').val();	
	
	if(first_name && middle_initial && last_name && gender && street && city && province && birthdate && status && philhealth && sss && position && email && contact && contact_per && skills && ranking){
	/*  validation */
	
    var formData = jQuery(this).serialize();
    jQuery.ajax({
        type: 'POST',
        url:  'save_emp.php',
        data: formData,
        success: function(msg){
            showNotification({
message: "Equipment Successfully Added",
type: "success", // type of notification is error/success/warning/information,
autoClose: true, // auto close to true
duration: 5 // message display duration
});

$("#shadow").hide("slow");
$(".uploadthis").show("slow");	
}
    });
} else {
alert('All fields are required!');
return false;
}
});

});
</script>

<!-- upload -->
<script type="text/javascript" src="js/upload/jquery.form.js"></script>
<!-- upload -->

<!--for datepicker-->
<script type="text/javascript" charset="utf-8">
jQuery(function($){
$(".birthdate").datepicker({
yearRange: '1950:1993',
changeYear: true
});
});
jQuery(function($){
$(".birthdate").datepicker();
});
jQuery(function($){
$(".transact_from").datepicker();
});
jQuery(function($){
$(".transact_to").datepicker();
});

</script>



<title>Add Employee</title>
</head>
<body class="modify_user standard">
<div class="wrapper">

	<div class="header">
	<h1>Lifeguard Archangels Security Corporation</h1>
	</div>
<?php include("main_menu.php"); ?>
	<div class="right_nav">
	<h1>Profiles</h1>
<?php include("right_nav.php"); ?>
	</div>
	<div class="content">
	<div class="title_page">
	</div>
	
	<div class="actions">
	<div class="form label-inline uniform" id="shadow" style="width: 700px; margin:0 auto;" >
	
	<form id="save_equip">
	<h2>Add Employee</h2>
	<!--for history log-->
		<input type="hidden" class="pc_date" name="date">
		<input type="hidden" class="pc_time" name="time">
		<input type="hidden" value="<?php echo $_SESSION['user_name']; ?>" class="user" name="user">
	<!--begin of form-->						
	<div class="field"><label>Type </label> <Select class="type" name="type">
	<option value="guard">Guard</option>
	<option value="emp">Office Employee</option>
	</select></div>
	<div id="authority">
	<div class="field"><label>License Validity </label>
	<input class="transact_from" style="width:150px;" name="transact_from" type="text" class="medium" />
	until 
	<input class="transact_to" name="transact_to" style="width:150px;" type="text" class="medium" />
	</div>	
	<div class="field"><label>License Number</label>
	<input class="license_num valid" style="width:150px;" name="license_num" type="text" class="medium" />
	</div>	

	</div>
	<div class="field"><label>Firstname </label> <input class="first_name" name="first_name" size="30" type="text" class="medium" /></div>
	<div class="field"><label>Middle Initial </label><select name="middle_initial" class="middle_initial" >
		<option>Choose Middle Initial</option>
		<option>A</option>
		<option>B</option>
		<option>C</option>
		<option>D</option>
		<option>E</option>
		<option>F</option>
		<option>G</option>
		<option>H</option>
		<option>I</option>
		<option>J</option>
		<option>K</option>
		<option>L</option>
		<option>M</option>
		<option>N</option>
		<option>O</option>
		<option>P</option>
		<option>Q</option>
		<option>R</option>
		<option>S</option>
		<option>T</option>
		<option>U</option>
		<option>V</option>
		<option>W</option>
		<option>X</option>
		<option>Y</option>
		<option>Z</option>
		</select></div>
	
	<div class="field"><label>Lastname </label> <input class="last_name" name="last_name" size="30" type="text" class="medium" /></div>
	<div class="field"><label>Gender </label><select name="gender" class="gender" >
		<option>Choose Gender</option>
		<option>Female</option>
		<option>Male</option></select></div>
	<div class="field"><label>Street </label> <input class="street" name="street" size="30" type="text" class="medium" /></div>	
	<div class="field"><label>City </label> <input class="city" name="city" size="30" type="text" class="medium" /></div>	
	<div class="field"><label>Province </label> <input class="province" name="province" size="30" type="text" class="medium" /></div>	
	<div class="field"><label>Date of Birth </label><input type="text" class="birthdate" name="birthdate" size="30" type="text" class="medium" ></div>
	<div class="field"><label>Status </label><select name="status" class="status" >
		<option>Choose Status</option>
		<option>Single</option>
		<option>Married</option>
		<option>Widowed</option>
		</select></div>
	<div class="field"><label>Philhealth Account Number </label> <input class="philhealth valid" name="philhealth" size="30" type="text" class="medium" /></div>
	<div class="field"><label>SSS Account Number </label> <input class="sss valid" name="sss" size="30" type="text" class="medium" /></div>
	<div class="field"><label>Position </label><select name="position" class="position" >
		<option>Choose Position</option>
		<option>Administrator</option>
		<option>Janitorial Staff</option>
		<option>Manager</option>
		<option>Office Staff</option>
		<option>Security Guard</option>
		<option>Supervisor</option>
		<option>Technical Staff</option></select></div>
	<div class="field"><label>Email Address </label> <input class="email" name="email" size="30" type="text" class="medium" /></div>
	<div class="field"><label>Contact Number </label> <input class="contact valid" name="contact" size="30" type="text" class="medium" /></div>
	<div class="field"><label>Contact Person </label> <input class="contact_per" name="contact_per" size="30" type="text" class="medium" /></div>
	<!--<div class="field"><label>Site Street </label> <input class="sitestreet" name="sitestreet" size="30" type="text" class="medium" /></div>	
	<div class="field"><label>Site City </label> <input class="sitecity" name="sitecity" size="30" type="text" class="medium" /></div>	
	<div class="field"><label>Site Province </label> <input class="siteprovince" name="siteprovince" size="30" type="text" class="medium" /></div>	-->
	<div class="field"><label>Skills </label> <select name="skills" class="skills" >
	<option>Choose Skill</Option>
	<option>Airports</Option>
	<option>Banks</Option>
	<option>Escorts</Option>
	<option>Homes</Option>
	<option>Malls</Option>
	<option>Private Firms</Option>
	<option>Restaurants</Option>
	<option>Schools</Option>
	<option>Supermarkets</Option></select></div>
	
	<div class="field"><label>Rating</label><input class="ranking" name="ranking" type="hidden" id="backing6">
            <div id="rateit" class="rateit bigstars" data-rateit-starwidth="32" data-rateit-starheight="32" >
            </div>
			<script type="text/javascript">
                $(function () { $('#rateit').rateit({ max: 5, step: 0.25, backingfld: '#backing6' }); });
     </script></div>	
	<div class="inc">
	<!--<div class="field"><label>Equipments</label>
	<select class="client" name="client" ><?php  equips(); ?></select>
	<button type="submit" id="append" name="add_equip">Add Equipment</button>
	</div>	-->
	</div>
	
	
	<div class="field"><button id="save_emp" name="SubmitOne">Save</button></div>
	</form>
	</div>
<div class="color2">	
<form id="imageform" class="uploadthis" method="post" enctype="multipart/form-data" action='upload.php'>
Upload your image <input type="file" name="photoimg" id="photoimg" />
</form></div>
<div id='preview'>
</div>
	</div>
	</div>
<?php include("footer.php"); ?>
</div>
</body>
</html>
<script type="text/javascript">
jQuery(document).ready( function () {

/* amo ni*/
var myDate = new Date();
var pc_date = (myDate.getMonth()+1) + '/' + (myDate.getDate()) + '/' + myDate.getFullYear();
var pc_time = myDate.getHours()+':'+myDate.getMinutes()+':'+myDate.getSeconds();
jQuery(".pc_date").val(pc_date);
jQuery(".pc_time").val(pc_time);
/*asta d*/


jQuery('.type').change( function(){
var type = jQuery('.type').val();
if(type == "emp")
{
jQuery('#authority').slideUp();
}
else
{
jQuery('#authority').slideDown();
}

});



});
</script>
<!-- upload -->
<script type="text/javascript" >
jQuery(document).ready(function() { 
		
            jQuery('#photoimg').live('change', function()			{ 
			           jQuery("#preview").html('');
			   jQuery("#preview").html('<img src="images/loader.gif" alt="Uploading...."/>');
			jQuery("#imageform").ajaxForm({
						target: '#preview'
		}).submit();
		 var delay = 3000;
		setTimeout(function(){ window.location = 'view_emp_list.php';}, delay);  
			});
        }); 
</script>
<!-- upload end -->