Commit 9b5c6a49 authored by ejcris's avatar ejcris

Merge branch 'master' of https://github.com/chiawase/CS123-uBus

parents ec6e6690 c4b5ff9f
{
"applications": {
"_default": {
"link": "uBus"
},
"uBus": {
"applicationId": "waBL5APV9kwdeqnm1kQ34BivGHQjjHQr1I58ubmJ"
}
}
}
\ No newline at end of file
{
"project_type": 1,
"parse": {
"jssdk": "latest"
},
"email": "elysia.villadarez@obf.ateneo.edu"
}
\ No newline at end of file
// Use Parse.Cloud.define to define as many cloud functions as you want.
// For example:
Parse.Cloud.define("hello", function(request, response) {
response.success("Hello world!");
});
<html>
<head>
<title>My ParseApp site</title>
<style>
body { font-family: Helvetica, Arial, sans-serif; }
div { width: 800px; height: 400px; margin: 40px auto; padding: 20px; border: 2px solid #5298fc; }
h1 { font-size: 30px; margin: 0; }
p { margin: 40px 0; }
em { font-family: monospace; }
a { color: #5298fc; text-decoration: none; }
</style>
</head>
<body>
<div>
<h1>Congratulations! You're already hosting with Parse.</h1>
<p>To get started, edit this file at <em>public/index.html</em> and start adding static content.</p>
<p>If you want something a bit more dynamic, delete this file and check out <a href="https://parse.com/docs/hosting_guide#webapp">our hosting docs</a>.</p>
</div>
</body>
</html>
...@@ -5,7 +5,8 @@ ...@@ -5,7 +5,8 @@
<link rel="stylesheet" type="text/css" href="css/font-awesome.min.css"> <link rel="stylesheet" type="text/css" href="css/font-awesome.min.css">
<link rel="stylesheet" type="text/css" href="css/style.css"> <link rel="stylesheet" type="text/css" href="css/style.css">
<script type="text/javascript" src="https://code.jquery.com/jquery-2.1.4.js"></script> <script type="text/javascript" src="https://code.jquery.com/jquery-2.1.4.js"></script>
<script src="http://www.parsecdn.com/js/parse-1.6.6.min.js"></script> <script src="js/parse-1.6.7.js"></script>
<script type="text/javascript" src="js/app.js"></script>
</head> </head>
<body> <body>
...@@ -46,7 +47,7 @@ ...@@ -46,7 +47,7 @@
</label> </label>
</fieldset> </fieldset>
<fieldset style="margin-top: 40px;"> <fieldset style="margin-top: 40px;">
<input type="submit"> <button onclick="adminSignIn()">Sign Up</button>
</fieldset> </fieldset>
</form> </form>
</div> </div>
......
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
<link rel="stylesheet" type="text/css" href="css/font-awesome.min.css"> <link rel="stylesheet" type="text/css" href="css/font-awesome.min.css">
<link rel="stylesheet" type="text/css" href="css/style.css"> <link rel="stylesheet" type="text/css" href="css/style.css">
<script type="text/javascript" src="https://code.jquery.com/jquery-2.1.4.js"></script> <script type="text/javascript" src="https://code.jquery.com/jquery-2.1.4.js"></script>
<script src="http://www.parsecdn.com/js/parse-1.6.6.min.js"></script> <script src="js/parse-1.6.7.js"></script>
<script type="text/javascript" src="js/app.js"></script> <script type="text/javascript" src="js/app.js"></script>
</head> </head>
<body> <body>
...@@ -16,11 +16,11 @@ ...@@ -16,11 +16,11 @@
<a href="index.html"><img src="img/logo.png" width="40px"></a> <a href="index.html"><img src="img/logo.png" width="40px"></a>
<h1 style="display:inline-block; margin:0; padding-top:10px; padding-left:15px;">Bus Ticket Reservation System</h1> <h1 style="display:inline-block; margin:0; padding-top:10px; padding-left:15px;">Bus Ticket Reservation System</h1>
<a href="adminAccount.html" style="color:white;padding:15px 20px;"><i class="fa fa-plus fa-2x"></i></a> <a href="adminAccount.html" style="color:white;padding:15px 20px;"><i class="fa fa-plus fa-2x"></i></a>
<a href="login.html"><i class="fa fa-2x fa-user"></i></a> <a href="login.html"><i class="fa fa-2x fa-user"style="color:white;"></i></a>
</nav> </nav>
</header> </header>
<div id="parent"></div>
<div class="wrapper" id="parent"> <div class="wrapper">
<div class="card button"> <div class="card button">
<a href="schedule.html" id="admin"> <a href="schedule.html" id="admin">
<img src="img/scheduling.png" width="50%"> <img src="img/scheduling.png" width="50%">
......
Parse.initialize("waBL5APV9kwdeqnm1kQ34BivGHQjjHQr1I58ubmJ", "01foVLqzLntdIIplsOJCOkfCGTL63wti1rcUlVCD"); Parse.initialize("waBL5APV9kwdeqnm1kQ34BivGHQjjHQr1I58ubmJ", "01foVLqzLntdIIplsOJCOkfCGTL63wti1rcUlVCD");
//account key: OSASuXULPMu03QRflj57dfL6TZj579g7y5Wwnd5A
var login = function(){ var login = function(){
event.preventDefault(); event.preventDefault();
var uname = document.getElementById("login_uname").value, var uname = document.getElementById("login_uname").value,
pass = document.getElementById("login_pass").value; pass = document.getElementById("login_pass").value;
console.log(uname + " " + pass);
Parse.User.logIn(uname, pass, { Parse.User.logIn(uname, pass, {
success: function(user){ success: function(user){
// console.log("success"); // console.log("success");
...@@ -21,6 +25,33 @@ var logout = function(){ ...@@ -21,6 +25,33 @@ var logout = function(){
location.href="login.html"; location.href="login.html";
} }
var adminSignIn = function(){
event.preventDefault();
var addUname = document.getElementById("addUname").value,
addPassword = document.getElementById("addPassword").value,
addEmail = document.getElementById("addEmail").value,
addBusCompany = document.getElementById("addBusCompany").value;
var user = new Parse.User();
user.set("username", addUname);
user.set("password", addPassword );
user.set("email", addEmail),
user.set("bus_company", addBusCompany);
// other fields can be set just like with Parse.Object
user.signUp(null, {
success: function(user) {
// Hooray! Let them use the app now.
window.location = "index.html";
},
error: function(user, error) {
// Show the error message somewhere and let the user try again.
alert("Error: " + error.code + " " + error.message);
}
});
}
$('#reload').submit(function(event){ $('#reload').submit(function(event){
event.preventDefault(); event.preventDefault();
...@@ -71,16 +102,72 @@ $('#reload').submit(function(event){ ...@@ -71,16 +102,72 @@ $('#reload').submit(function(event){
//save //save
}); });
$("#create_schedule").submit(function(event){
event.preventDefault();
var destination = document.getElementById("destination").value,
initial = document.getElementById("initial").value,
etd = document.getElementById("etd").value,
eta = document.getElementById("eta").value,
company = document.getElementById("bus_company").value,
plate = document.getElementById("plate_number").value,
seats = document.getElementById("seats_available").value,
fare = document.getElementById("fare").value;
// console.log(typeof "plate");
var newSchedule = new Schedule();
newSchedule.save({
destination:destination,
startingTerminal: initial,
arrival: eta,
departure: etd,
busCompany: company,
busPlate: plate,
seatsAmount: seats,
ticketPrice: fare
}, {
success: function(newSchedule) {
// Execute any logic that should take place after the object is saved.
alert('New object created with objectId: ' + newSchedule.id);
console.log('New object created with objectId: ' + newSchedule.id);
},
error: function(newSchedule, error) {
// Execute any logic that should take place if the save fails.
// error is a Parse.Error with an error code and message.
alert('Failed to create new object, with error code: ' + error.message);
}
});
alert(destination);
});
window.onload = function(){ window.onload = function(){
var currentUser = Parse.User.current(); var currentUser = Parse.User.current();
var currLoc = location.href; var currLoc = location.href;
if (!currentUser && currLoc.indexOf("login.html") == -1 ) { if (!currentUser && currLoc.indexOf("login.html") == -1 ) {
if (currLoc.indexOf("adminAccount.html") == -1){
location.href = "login.html"; location.href = "login.html";
}
} else { } else {
if( currLoc.indexOf("login.html") == -1 && currLoc.indexOf("adminAccount.html") == -1 ) {
var parent = document.getElementById("parent"); var parent = document.getElementById("parent");
var outBtn = document.createElement("button"); var outBtn = document.createElement("button");
outBtn.setAttribute("onclick", "logout()"); outBtn.setAttribute("onclick", "logout()");
outBtn.innerHTML = "Logout"; outBtn.innerHTML = "Logout";
parent.appendChild(outBtn); parent.appendChild(outBtn);
} }
}
if (currLoc.indexOf("schedule.html") > -1 && currentUser){
var company = document.getElementById("bus_company");
console.log(currentUser.get("bus_company"));
var userCompany = currentUser.get("bus_company");
// console.log(userCompany);
company.value = userCompany;
company.setAttribute("disabled", "true");
}
} }
\ No newline at end of file
This diff is collapsed.
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
<link rel="stylesheet" type="text/css" href="css/style.css"> <link rel="stylesheet" type="text/css" href="css/style.css">
<link rel="icon" type="image/x-icon" href="img/favicon.ico"> <link rel="icon" type="image/x-icon" href="img/favicon.ico">
<script type="text/javascript" src="https://code.jquery.com/jquery-2.1.4.js"></script> <script type="text/javascript" src="https://code.jquery.com/jquery-2.1.4.js"></script>
<script src="http://www.parsecdn.com/js/parse-1.6.6.min.js"></script> <script src="js/parse-1.6.7.js"></script>
</head> </head>
<body> <body>
...@@ -18,7 +18,7 @@ ...@@ -18,7 +18,7 @@
<a href="javascript:void(0);"><img src="img/search.png" width="40px"></a> <a href="javascript:void(0);"><img src="img/search.png" width="40px"></a>
</nav> </nav>
</header> </header>
<div id="parent"></div>
<div class="wrapper"> <div class="wrapper">
<div class="title"> <div class="title">
<img src="img/scheduling.png" width="40px"> <img src="img/scheduling.png" width="40px">
......
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
<link rel="stylesheet" type="text/css" href="css/font-awesome.min.css"> <link rel="stylesheet" type="text/css" href="css/font-awesome.min.css">
<link rel="stylesheet" type="text/css" href="css/style.css"> <link rel="stylesheet" type="text/css" href="css/style.css">
<script type="text/javascript" src="https://code.jquery.com/jquery-2.1.4.js"></script> <script type="text/javascript" src="https://code.jquery.com/jquery-2.1.4.js"></script>
<script src="http://www.parsecdn.com/js/parse-1.6.6.min.js"></script> <script src="js/parse-1.6.7.js"></script>
<script type="text/javascript" src="js/app.js"></script> <script type="text/javascript" src="js/app.js"></script>
</head> </head>
<body> <body>
...@@ -16,10 +16,10 @@ ...@@ -16,10 +16,10 @@
<a href="index.html"><img src="img/logo.png" width="40px"></a> <a href="index.html"><img src="img/logo.png" width="40px"></a>
<h1 style="display:inline-block; margin:0; padding-top:10px; padding-left:15px;">Bus Ticket Reservation System</h1> <h1 style="display:inline-block; margin:0; padding-top:10px; padding-left:15px;">Bus Ticket Reservation System</h1>
<a href="adminAccount.html" style="color:white;padding:15px 20px;"><i class="fa fa-plus fa-2x"></i></a> <a href="adminAccount.html" style="color:white;padding:15px 20px;"><i class="fa fa-plus fa-2x"></i></a>
<a href="login.html"><i class="fa fa-2x fa-user"></i></a> <a href="login.html"><i class="fa fa-2x fa-user" style="color:white;"></i></a>
</nav> </nav>
</header> </header>
<div id="parent"></div>
<div class="wrapper"> <div class="wrapper">
<form method="post" id="adminLogin"> <form method="post" id="adminLogin">
<input type="text" placeholder="Username" id="login_uname"> <input type="text" placeholder="Username" id="login_uname">
......
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
<link rel="stylesheet" type="text/css" href="css/style.css"> <link rel="stylesheet" type="text/css" href="css/style.css">
<link rel="icon" type="image/x-icon" href="img/favicon.ico"> <link rel="icon" type="image/x-icon" href="img/favicon.ico">
<script type="text/javascript" src="https://code.jquery.com/jquery-2.1.4.js"></script> <script type="text/javascript" src="https://code.jquery.com/jquery-2.1.4.js"></script>
<script src="http://www.parsecdn.com/js/parse-1.6.6.min.js"></script> <script src="js/parse-1.6.7.js"></script>
</head> </head>
<body> <body>
...@@ -18,7 +18,7 @@ ...@@ -18,7 +18,7 @@
<a href="javascript:void(0);"><i class="fa fa-2x fa-search" style="color:white; padding-top:5px; padding-right:10px;"></i></a> <a href="javascript:void(0);"><i class="fa fa-2x fa-search" style="color:white; padding-top:5px; padding-right:10px;"></i></a>
</nav> </nav>
</header> </header>
<div id="parent"></div>
<div class="wrapper"> <div class="wrapper">
<div class="title"> <div class="title">
<img src="img/scheduling.png" width="40px"> <img src="img/scheduling.png" width="40px">
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment