<?php include("header.php"); ?>
<!--for datepicker-->
<?php $id = $_POST['id']; ?>
<?php $name = $_POST['name']; ?>
<script type="text/javascript" charset="utf-8">
jQuery(function($){
$(".transact_from").datepicker();
});
jQuery(function($){
$(".transact_to").datepicker();
});
</script>
<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 -->

			/* 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*/	

$("#append_equip").click( function() {
		$(".inc2").append('<div class="field"><label>&nbsp;</label><select class="equipments" name="equipments[]"><?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
$('.remove_this').live('click', function() {
    $(this).parent().remove();
    return false;
});
	
jQuery('#save_mon').submit(function(e){
var transact_from = jQuery('.transact_from').val();
var transact_to = jQuery('.transact_to').val();
var client = jQuery('.client').val();
var type = jQuery('.type').val();

    e.preventDefault();
if (transact_from && transact_to && client && type)	{
    var formData = jQuery(this).serialize();	
    jQuery.ajax({
        type: 'POST',
        url:  'save_mon.php',
        data: formData,
        success: function(msg){
            showNotification({
message: "Transaction 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_monitoring_list.php';}, delay);  
<!--redirection end -->	
        }
    });
} else {
alert('All fields are required!');
return false;
}	
});
});

</script>

<!--the content -->

<title>Add Transaction</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>Records</h1>
	<?php include("records_sidebar.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;" >
		<h2>Add Transaction</h2>	
		<!--for history log-->
	<form id="save_mon">	
			<input type="hidden" class="pc_date" name="pc_date"/>
			<input type="hidden" class="pc_time" name="pc_time"/>
			<input type="hidden" class="user" value="<?php echo $_SESSION['user_name']; ?>" name="user">
		<!--begin of form-->
	<input  type="hidden" value="<?php echo $id; ?>" name="id" />
	<div class="field"><label>Employee Name</label><input class="emp" disabled type="text" name="name" value="<?php echo $name; ?>" /></div>
	<div class="field"><label>Transaction Period</label><input style="width: 160px;" class="transact_from" name="transact_from" size="30" type="text" class="medium" /><img src="images/calendar.png"> until <input style="width: 160px;" class="transact_to" name="transact_to" size="30" type="text" class="medium" /><img src="images/calendar.png"></div>
	<div class="field"><label>Client-in-Authority </label><select class="client" name="client" ><?php  clients(); ?></select></div>	
	<div class="inc2">
	<div class="field"><label>Type</label><select name="type" class="type">
		<option value="0" >Select type</option>
		<option value="Office" >Office</option>
		<option value="Biometrics" >Biometrics</option>
		<option value="Firearms" >FireArms</option>
		</select>
	</div>
	
	<div id="results">
	
	</div>
	
	</div>

	<div class="field"><button id="save_mon" name="SubmitOne">Save</button></div>
	</form>
	</div>
	</div>
<?php include("footer.php"); ?>
</div>
</body>
</html>
<script type="text/javascript">
$('.office').hide();
$('.bio').hide();
$('.arms').hide();

		$('.type').change( function() {
		var type = $(this).val();
		
		
			$.ajax({
			type: "POST",
			url: "choose_equips.php",
			data: ({type: type}),
			cache: false,
			success: function(msg)
			{
			  $('#results').hide().html(msg).fadeIn();
			  
			}
			}); 
		
		});
		
/* 		$('.save_mon').click( function() {
				
		var user = jQuery('.user').val();
		var equips = jQuery('.equipments').val();
		alert(equips);
		var ammos = jQuery('.ammos').val();
		
			$.ajax({
			type: "POST",
			url: "delete_mon.php",
			data: ({id: id, pc_date:pc_date, pc_time:pc_time,user:user}),
			cache: false,
			success: function(html){
			$(".change"+id).html('');
			$(".change"+id).html('Opened Availability');
			}
			}); 

		});	 */
					
</script>