<?php
	ob_start();
	session_start();
    
    include("../class/dbConnection.php");
    include("../class/admin.php");

    //Declaring Variables
	$success = "";
	$failure = "";
	 $userId;
	 $message = "";
	
	$NA = "<font color = 'red'>Not Available</font>";

	//Retrieving Session Variable
	if(isset($_SESSION["adminId"]))
	{
		$adminId = $_SESSION["adminId"];
		//echo $adminId;
	}
	else
	{
		header('Location:index.php?message=Unauthorized%20Access%20Prohobited');
	}
	//Retrieving Query String Variable
	if(isset($_REQUEST["success"]))
	{
		$success = $_REQUEST["success"];
	}
	
	if(isset($_REQUEST["failure"]))
	{
		$failure = $_REQUEST["failure"];
	}
	//Creating 'dbConnection' Object
	$dbObj = new dbConnection();
	$con = $dbObj->getConnection();
	//echo $con . "<br/>";
	
	if($con)
	{
		//echo "MySQL Server Connected<br/>";
		$dbResult = $dbObj->selectDatabase();
		if($dbResult)
		{
			//echo "Database Selected<br/>";
			
			//Creating Admin Object
			
			$adminObj = new admin();
			
			
		}
		else
		{
			echo mysql_errno() . " : " . mysql_error();
		}
	}
	else
	{
		echo mysql_errno() . " : " . mysql_error();
	}
	


?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport"
	content="width=device-width, initial-scale=1.0, maximum-scale=1.0">
<meta name="keywords"
	content="admin, dashboard, bootstrap, template, flat, modern, theme, responsive, fluid, retina, backend, html5, css, css3">
<meta name="description" content="">
<meta name="author" content="ThemeBucket">
<link rel="shortcut icon" href="#" type="image/png">

<title> Stock Reports</title>

<!--common-->
<link href="css/style.css" rel="stylesheet">
<link href="css/style-responsive.css" rel="stylesheet">
<script type="text/javascript" src="js1/alert.js"></script>
<!-- HTML5 shim and Respond.js IE8 support of HTML5 elements and media queries -->
<!--[if lt IE 9]>
  <script src="js/html5shiv.js"></script>
  <script src="js/respond.min.js"></script>
  <![endif]-->
<script src="https://cdn.ckeditor.com/ckeditor5/1.0.0-alpha.1/classic/ckeditor.js"></script>
<!--pickers css-->
		<link rel="stylesheet" type="text/css" href="js/bootstrap-datepicker/css/datepicker-custom.css" />
		<link rel="stylesheet" type="text/css" href="js/bootstrap-daterangepicker/daterangepicker-bs3.css" />
</head>

<body class="sticky-header">

	<section>
		<!-- left side start-->
		<div class="left-side sticky-left-side">

			<!--logo and iconic logo start-->
			<?php include("include/add-logo.php");?>
			<!--logo and iconic logo end-->

			<div class="left-side-inner">

				<!-- visible to small devices only -->
				<div class="visible-xs hidden-sm hidden-md hidden-lg">
					<div class="media logged-user">
						
					</div>

					<h5 class="left-nav-title">Account Information</h5>
					<ul class="nav nav-pills nav-stacked custom-nav">
						<li><a href="EditProfile.php"><i class="fa fa-user"></i> <span>Profile</span></a></li>
						<li><a href="changePassword.php"><i class="fa fa-cog"></i> <span>Settings</span></a></li>
						<li><a href="SignOut.php"><i class="fa fa-sign-out"></i> <span>SignOut</span></a></li>
					</ul>
				</div>

				<?php
					include("include/sideNav.php");
				?>

				

			</div>
		</div>
		<!-- left side end-->

		<!-- main content start-->
		
		<div class="main-content">

			<!-- header section start-->
			<div class="header-section">

				<!--toggle button start-->
				<a class="toggle-btn"><i class="fa fa-bars"></i></a>
				<!--toggle button end-->

				<!--search start-->
				<!-- <form class="searchform" action="index.html" method="post">
					<input type="text" class="form-control" name="keyword"
						placeholder="Search here..." />
				</form> -->
				<!--search end-->

				<!--notification menu start -->
				<div class="menu-right">
					<ul class="notification-menu">
						
						
						
							
						<li><a href="#" class="btn btn-default dropdown-toggle"
							data-toggle="dropdown">  Admin <span
								class="caret"></span>
						</a>
							<ul class="dropdown-menu dropdown-menu-usermenu pull-right">
								<li><a href="EditProfile.php"><i class="fa fa-user"></i> Profile</a></li>
								<li><a href="changePassword.php"><i class="fa fa-cog"></i> Settings</a></li>
								<li><a href="SignOut.php" data-toggle="model" data-target="#mymodel"><i
										class="fa fa-sign-out"></i> Log Out</a></li>
							</ul>
						</li>

					</ul>
				</div>
				<!--notification menu end -->

			</div>
			<!-- header section end-->

			
			<div class="container">

				<div class="modal fade" id="mymodal" role="dialog">
					<form action="go" method="post" id="mymodel">
						<div class="modal-dialog">

							<!-- Modal content-->
							<div class="modal-content">
								<div class="modal-header">
									<button type="button" class="close" data-dismiss="modal">&times;</button>
									<h4 class="modal-title">Logout Confirmation</h4>
								</div>
								<div class="modal-body">
									<p>Are you sure want to Sign out!</p>
								</div>
								<div class="modal-footer">
									<button autofocus="autofocus" type="submit"
										class="btn btn-default ">Yes</button>
									<button type="button" class="btn btn-default"
										data-dismiss="modal">No</button>
								</div>
							</div>

						</div>
					</form>
				</div>

			</div>

			 <!-- logout popup ends-->
			 
			<div class="wrapper">
            	<div class="row mt">
        		<div class="col-lg-12">
				<?php
					if($success != "")
					{
						echo "<div class='alert alert-success alert-dismissable'>
					  <button type='button' class='close' data-dismiss='alert' aria-hidden='true'>&times;</button>
					  <strong>SUCESS!&nbsp;&nbsp;&nbsp; </strong> $success</div>";
					}
					if($failure != "")
					{
						echo "<div class='alert alert-danger alert-dismissable'>
					  <button type='button' class='close' data-dismiss='alert' aria-hidden='true'>&times;</button>
					  <strong>Warning!&nbsp;&nbsp;&nbsp; </strong>$failure</div>";
					}
				?>
        <section class="panel"  >
            <header class="panel-heading" style="background-color:#353F4F; color: #fff;  border-radius:8px;">
                Add File
            </header>
            
			 <h6 style = "color:red;" id = "errorMessage"></h6>

            <div class="panel-body">
            	<h4><span style = "color:red;">Note*.</span>Please upload pdf|doc|docx|xls|xlsx formates only</h4>
                <form  class="form-horizontal adminex-form" method="post" action = "insert_file.php" enctype = "multipart/form-data" >
                	<div class="form-group">
						<label class="col-sm-3 col-sm-3 control-label ">Select Date<span style="color:red">*</span></label>
						<div class="col-sm-4">
							<input type="text" class="form-control" name="date" id="datePicker" placeholder="Select Date" required="">
							<span id="sendemail" style="color:red;font-family:Trebuchet MS;font-size:14px;"></span>
						</div>
					</div>
                    <div class="form-group" >
                        <label class="control-label col-md-3">Upload File</label>
                        <div class="col-md-4">
                            <input type="file" class="default" id="file" name="file" accept=".pdf" required="">
                            <span id="errorFile" style="color:red;font-family:Trebuchet MS;font-size:14px;"></span>
                        </div>
                    </div>
                    <input type="hidden" name="admin_id" value="<?=$adminId;?>">
                    </br>
                    <div class="form-group">
			            <label class="col-sm-3 col-sm-3 control-label"></label>
                        <div class="col-sm-9">
                            <input  type="submit" id="submit" class="btn btn-primary" value="submit" onclick = "return validateFile();">
			            </div>
                    </div>
                </form>
            </div>
        </section>
        </div>
        </div>
        </div>			                    

			<!--footer section start-->
			<!-- <footer> <?php echo date("Y");?> &copy; Avyayasolutions </footer> -->
			
			<!--footer section end-->

     
		</div>

		<!-- main content end-->
	</section>

	<!-- Placed js at the end of the document so the pages load faster -->
	<script src="js/jquery-1.10.2.min.js"></script>
	<script src="js/jquery-ui-1.9.2.custom.min.js"></script>
	<script src="js/jquery-migrate-1.2.1.min.js"></script>
	<script src="js/bootstrap.min.js"></script>
	<script src="js/modernizr.min.js"></script>
	<script src="js/jquery.nicescroll.js"></script>
	<!--pickers plugins-->
		<script type="text/javascript" src="js/bootstrap-datepicker/js/bootstrap-datepicker.js"></script>
		<script type="text/javascript" src="js/bootstrap-daterangepicker/moment.min.js"></script>
		<script type="text/javascript" src="js/bootstrap-daterangepicker/daterangepicker.js"></script>
		<!--pickers initialization-->
		<script src="js/pickers-init.js"></script>
	<!-- <script type="text/javascript" src="js/ckeditor/ckeditor.js"></script> -->
	
	<!--common scripts for all pages-->
	<script src="js/scripts.js"></script>
	<script type="text/javascript">
		$(document).ready(function(){
		$('#datePicker').datepicker({
		
		});
		});
		</script>
	<script type="text/javascript">
		function validateFile()
		{
			var allowedExtensions = /(\.pdf|\.doc|\.docx|\.xls|\.xlsx)$/i;
			var file = document.getElementById('file').value;
			//alert(file);
			if(document.getElementById('file').value.length == 0)
			{
				document.getElementById('errorFile').innerHTML = "Please upload file";
				//document.getElementById('file').value = '';
				return false;
			}
			else if(!allowedExtensions.exec(file)){
				document.getElementById('errorFile').innerHTML = "Please upload requested formates only";
				return false;
			}
			else
			{
				return TRUE;
			}
			

		}
	</script>
</body>
</html>
