Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
U
uBus
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Chiara Veronica Señires
uBus
Commits
944bf227
Commit
944bf227
authored
Oct 29, 2015
by
Ian De La Cruz
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added a login flow. Partial fix for Issue #2
parent
bdefb981
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
70 additions
and
64 deletions
+70
-64
index.html
web-app/index.html
+3
-2
app.js
web-app/js/app.js
+34
-60
login.html
web-app/login.html
+31
-0
schedule.html
web-app/schedule.html
+2
-2
No files found.
web-app/index.html
View file @
944bf227
...
...
@@ -8,6 +8,7 @@
<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
src=
"http://www.parsecdn.com/js/parse-1.6.6.min.js"
></script>
<script
type=
"text/javascript"
src=
"js/app.js"
></script>
</head>
<body>
<header>
...
...
@@ -15,11 +16,11 @@
<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>
<a
href=
"adminAccount.html"
style=
"color:white;padding:15px 20px;"
><i
class=
"fa fa-plus fa-2x"
></i></a>
<
h1>
Bus Ticket Reservation System
</h1
>
<
a
href=
"login.html"
><i
class=
"fa fa-2x fa-user"
></i></a
>
</nav>
</header>
<div
class=
"wrapper"
>
<div
class=
"wrapper"
id=
"parent"
>
<div
class=
"card button"
>
<a
href=
"schedule.html"
id=
"admin"
>
<img
src=
"img/scheduling.png"
width=
"50%"
>
...
...
web-app/js/app.js
View file @
944bf227
Parse
.
initialize
(
"waBL5APV9kwdeqnm1kQ34BivGHQjjHQr1I58ubmJ"
,
"01foVLqzLntdIIplsOJCOkfCGTL63wti1rcUlVCD"
);
var
Schedule
=
Parse
.
Object
.
extend
(
"Schedule"
);
var
login
=
function
(){
event
.
preventDefault
();
var
uname
=
document
.
getElementById
(
"login_uname"
).
value
,
pass
=
document
.
getElementById
(
"login_pass"
).
value
;
Parse
.
User
.
logIn
(
uname
,
pass
,
{
success
:
function
(
user
){
// console.log("success");
window
.
location
=
"index.html"
;
},
error
:
function
(
user
,
error
){
console
.
log
(
"Error "
+
error
.
code
+
" "
+
error
.
message
);
}
});
}
var
logout
=
function
(){
event
.
preventDefault
();
Parse
.
User
.
logOut
();
location
.
href
=
"login.html"
;
}
$
(
'#reload'
).
submit
(
function
(
event
){
event
.
preventDefault
();
...
...
@@ -38,7 +57,7 @@ $('#reload').submit(function(event){
console
.
log
(
"Saved."
);
},
error
:
function
(
error
){
console
.
log
(
"Error "
+
error
);
console
.
log
(
"Error "
+
error
.
code
+
" "
+
error
.
message
);
}
});
}
...
...
@@ -52,61 +71,16 @@ $('#reload').submit(function(event){
//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
);
});
var
query
=
new
Parse
.
Query
(
Schedule
);
var
id
;
query
.
find
({
success
:
function
(
results
)
{
console
.
log
(
"Successfully retrieved "
+
results
.
length
);
// Do something with the returned Parse.Object values
for
(
var
i
=
0
;
i
<
results
.
length
;
i
++
)
{
var
object
=
results
[
i
];
id
=
object
.
id
;
console
.
log
(
object
);
}
},
error
:
function
(
error
)
{
status
.
error
(
"Error: "
+
error
.
code
+
" "
+
error
.
message
);
}
});
\ No newline at end of file
window
.
onload
=
function
(){
var
currentUser
=
Parse
.
User
.
current
();
var
currLoc
=
location
.
href
;
if
(
!
currentUser
&&
currLoc
.
indexOf
(
"login.html"
)
==
-
1
)
{
location
.
href
=
"login.html"
;
}
else
{
var
parent
=
document
.
getElementById
(
"parent"
);
var
outBtn
=
document
.
createElement
(
"button"
);
outBtn
.
setAttribute
(
"onclick"
,
"logout()"
);
outBtn
.
innerHTML
=
"Logout"
;
parent
.
appendChild
(
outBtn
);
}
}
\ No newline at end of file
web-app/login.html
0 → 100644
View file @
944bf227
<!DOCTYPE html>
<html>
<head>
<title>
uBus | Admin System
</title>
<meta
name=
"description"
content=
"uBus Ticket Reservation System administrator tools."
>
<link
rel=
"icon"
type=
"image/x-icon"
href=
"img/favicon.ico"
>
<link
rel=
"stylesheet"
type=
"text/css"
href=
"css/font-awesome.min.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
src=
"http://www.parsecdn.com/js/parse-1.6.6.min.js"
></script>
<script
type=
"text/javascript"
src=
"js/app.js"
></script>
</head>
<body>
<header>
<nav>
<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>
<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>
</nav>
</header>
<div
class=
"wrapper"
>
<form
method=
"post"
id=
"adminLogin"
>
<input
type=
"text"
placeholder=
"Username"
id=
"login_uname"
>
<input
type=
"password"
placeholder=
"Password"
id=
"login_pass"
>
<button
type=
"button"
onclick=
"login()"
>
Log-In
</button>
</form>
</div>
</body>
</html>
web-app/schedule.html
View file @
944bf227
...
...
@@ -14,8 +14,8 @@
<nav>
<a
href=
"index.html"
><img
src=
"img/logo.png"
width=
"40px"
></a>
<a
href=
"javascript:void(0);"
><i
mg
src=
"img/add.png"
width=
"40px"
></a>
<a
href=
"javascript:void(0);"
><i
mg
src=
"img/search.png"
width=
"40px"
></a>
<a
href=
"javascript:void(0);"
><i
class=
"fa fa-2x fa-plus"
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>
</header>
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment