<?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 -->

/*  another date shit*/
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*/

$("#append").click( function() {
		$(".inc").append('<div class="field"><label>&nbsp;</label><select class="guards" name="guards[]"><?php guards(); ?></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
$('.remove_this').live('click', function() {
    $(this).parent().remove();
    return false;
});
	
jQuery('#save_client').submit(function(e){
    e.preventDefault();
	
	/*  validation 
	var firstname = jQuery('.firstname').val();
	var lastname = jQuery('.lastname').val();
	var company = jQuery('.company').val();
	var street = jQuery('.street').val();			
	var city = jQuery('.city').val();
	var province = jQuery('.province').val();
	//var contact = jQuery('.contact').val();
	
	if(firstname && lastname && company && street && city && province){*/
	 
	
    var formData = jQuery(this).serialize();
    jQuery.ajax({
        type: 'POST',
        url:  'save_client.php',
        data: formData,
        success: function(msg){
            showNotification({
message: "Client Successfully Added",
type: "success", // type of notification is error/success/warning/information,
autoClose: true, // auto close to true
duration: 5 // message display duration

});
<!--redirection -->
		 var delay = 3000;
		setTimeout(function(){ window.location = 'view_client_list.php';}, delay);  
<!--redirection end -->		
        }
    });
	
	
});
});

</script>

<!--the content -->

<title>Add Client</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="error" id="message_box">Complete All Fields-->
	<div class="actions">
	<div class="form label-inline uniform" id="shadow" style="width: 700px; margin:0 auto;" >
		<h2>Add Client</h2>
		<form id="save_client">	
		<!--for history log-->
		<input type="hidden" class="pc_date" name="pc_date"/>
		<input type="hidden" class="pc_time" name="pc_time" />
		<input type="hidden" name="user" value="<?php echo $_SESSION['user_name']; ?>" />
		<!--begin of form-->
	<div class="field"><label>Firstname </label> <input class="firstname" name="firstname" 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="lastname" name="lastname" 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>Company Name </label> <input class="company" name="company" size="30" type="text" class="medium" /></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>Contact Number </label> <input class="contact valid" name="contact" size="30" type="text" class="medium" /></div>
	<div class="field"><button id="save_client" name="SubmitOne">Save</button></div>
	
	</form>
	
	</div>
	</div>
<?php include("footer.php"); ?>
</div>
</body>
</html>
