<?php
//header('Location:index.php');
//		exit;/*
	require 'autoload.php';
	use Parse\ParseClient;
	use Parse\ParseObject;
	use Parse\ParseQuery;
	use Parse\ParseACL;
	use Parse\ParsePush;
	use Parse\ParseUser;
	use Parse\ParseInstallation;
	use Parse\ParseException;
	use Parse\ParseAnalytics;
	use Parse\ParseFile;
	use Parse\ParseCloud;
	include 'config.php';
	ParseClient::initialize($ApplicationID, $RestAPIKEY, $MasterKey);
	ParseClient::setServerURL($serverURLB4APP, '/');
?>
<!DOCTYPE html>
<html lang="en">

<head>
    <title>Login</title>
   	<?php include 'includes/head.php'; ?>
<style>
	body#pgLogin{
		background: rgba(179,220,237,1);
background: -moz-linear-gradient(left, rgba(179,220,237,1) 0%, rgba(41,184,229,1) 50%, rgba(188,224,238,1) 100%);
background: -webkit-gradient(left top, right top, color-stop(0%, rgba(179,220,237,1)), color-stop(50%, rgba(41,184,229,1)), color-stop(100%, rgba(188,224,238,1)));
background: -webkit-linear-gradient(left, rgba(179,220,237,1) 0%, rgba(41,184,229,1) 50%, rgba(188,224,238,1) 100%);
background: -o-linear-gradient(left, rgba(179,220,237,1) 0%, rgba(41,184,229,1) 50%, rgba(188,224,238,1) 100%);
background: -ms-linear-gradient(left, rgba(179,220,237,1) 0%, rgba(41,184,229,1) 50%, rgba(188,224,238,1) 100%);
background: linear-gradient(to right, rgba(179,220,237,1) 0%, rgba(41,184,229,1) 50%, rgba(188,224,238,1) 100%);
filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#b3dced', endColorstr='#bce0ee', GradientType=1 );
	}
</style>
</head>

<body class="loginPage" id="pgLogin">
	<div class = "container">
		<div class="wrapper">
			<h3 class="form-signin-heading">Sign Up</h3>					
			<hr class="colorgraph"><br>
	        				
			<?php
				if ( isset($_POST["btnAddAdmin"]) ) {					
					$objAdminUsers = new ParseObject("admin");	
					$objAdminUsers->set( "username", $_POST["email"] );
					$objAdminUsers->set( "first_name", $_POST["firstName"] );
					$objAdminUsers->set( "last_name", $_POST["lastName"]);
					$objAdminUsers->set( "email", $_POST["email"]);
					$objAdminUsers->set( "shop_name", $_POST["shopname"]);
					if($_POST["password"] != ""){
						$password = md5($_POST["password"]);
						$objAdminUsers->set( "password", $password);
					}
					$objAdminUsers->save();
					  ?>
			 <script>
				//alertify.alert('Successfully saved', 'Beacon Device save successfully!');
				alertify.alert('Successfully saved', 'Signup has been added successfull.!', function(){
					//alertify.success('Ok'); 
					window.location = "login.php";
				});
			</script>			
			<?php }?>
						
						
			<form method="post"  class="form-signin">
				
				
				<div class="form-group">
					<label for="firstName" class="form-label">First Name</label>
					<input type="text" class="form-control" id="firstName" name="firstName"  placeholder="Enter admin first name"  required data-error-msg="Please enter admin first name"  />
				</div>
				
				<div class="form-group">
					<label for="lastName" class="form-label">Last Name</label>
					<input type="text" class="form-control" id="lastName" name="lastName"  placeholder="Enter admin last name"    />
				</div>
				
				<div class="form-group">
					<label for="email" class="form-label">Email</label>
					<input type="email" class="form-control" id="email" name="email"  placeholder="Enter admin email"  required data-error-msg="Please enter admin email"  />
				</div>
				<div class="form-group">
					<label for="shopname" class="form-label">Shop</label>
					<input type="text" class="form-control" id="shopname" name="shopname"  placeholder="Enter shop name"  />
				</div>
				<div class="form-group">
					<label for="password" class="form-label">Password</label>
					<input type="password" class="form-control" id="password" name="password"  placeholder="Enter admin password"  required data-error-msg="Please enter admin password"  />
				</div>
				
				<div class="form-group">
					<input type="submit"  class="btn btn-success" name="btnAddAdmin" value="Sign Up" />
				</div>
			</form>
		</div>
	</div>
    <?php include 'includes/footer.php'; ?>
</body>

</html>