<?php
include_once '../includes/processes.php';
$Process = new Login_Process;

$pageLink = basename($_SERVER['REQUEST_URI']);
$Process->check_status($pageLink);
if($_SESSION['dept_id']!=7) {
	
	header("location:../");
}
 require 'db_config/config.php';
?>
<?php
   if(isset($_POST['update']))
   {
	 
 $sql = "UPDATE asset_info SET user='$_POST[user]',user_status='$_POST[user_status]',
 designation='$_POST[designation]',device='$_POST[device]',brand='$_POST[brand]',
 model_num='$_POST[model_num]',location='$_POST[location]',asset_tagging='$_POST[asset_tagging]',
 asset_tag='$_POST[asset_tag]',date='$_POST[date]' WHERE id='$_POST[id]'";
 
 
 if(mysqli_query($connect,$sql)){
 header("refresh:0; url=update_page.php");
 echo '<script type="text/javascript"> alert("Update successfull") </script>';
  /*echo "<br />";
			 echo '<div class="alert alert-success">
			       <a href="#" class="close" data-dismiss="alert">&times;</a>
				   Update successfull
				   </div>';*/
 }
 
 else 
	echo '<script type="text/javascript"> alert("Update did not work") </script>';
 
   }
   
  if(isset($_POST['delete']))
  {

 $sql = "DELETE FROM asset_info  WHERE id='$_POST[id]'";
 
 if(mysqli_query($connect,$sql)){
 header("refresh:0; url=update_page.php");
 	echo '<script type="text/javascript"> alert("Delete Succesful") </script>';

 }
 else 
	echo '<script type="text/javascript"> alert("Delete Did Not Work") </script>';

   }
 ?>