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
b786686d
Commit
b786686d
authored
Nov 29, 2015
by
Ian De La Cruz
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added constraints to reload. Refactoring Create Trip Manually
parent
7a3a60cb
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
24 additions
and
112 deletions
+24
-112
createSchedule.html
web-app/createSchedule.html
+0
-6
createTrip.html
web-app/createTrip.html
+4
-12
app.js
web-app/js/app.js
+17
-91
reload.html
web-app/reload.html
+3
-3
No files found.
web-app/createSchedule.html
View file @
b786686d
...
...
@@ -28,12 +28,6 @@
<label
for=
"startDate"
>
<input
type=
"date"
id=
"startDate"
>
</label>
<label
for=
"endTime"
>
<input
type=
"time"
id=
"endTime"
>
</label>
<label
for=
"endDate"
>
<input
type=
"date"
id=
"endDate"
>
</label>
<button
class=
"generateTrips__btn"
>
Generate Trips
</button>
</form>
</div>
...
...
web-app/createTrip.html
View file @
b786686d
...
...
@@ -30,26 +30,18 @@
<form
class=
"createTrip__form"
>
<h1
class=
"createTrip__header"
>
Create Trip
</h1>
<label
class=
"createTrip__selectLabel"
>
<span>
Origin
:
</span>
<select
class=
"createTrip__select"
id=
"select
Origin
"
>
<span>
Day
:
</span>
<select
class=
"createTrip__select"
id=
"select
ScheduleDay
"
>
<option>
--
</option>
</select>
</label>
<label
class=
"createTrip__selectLabel"
>
<span>
Destination
:
</span>
<select
class=
"createTrip__select"
id=
"select
Destination
"
>
<span>
Time
:
</span>
<select
class=
"createTrip__select"
id=
"select
ScheduleTime
"
>
<option>
--
</option>
</select>
</label>
<hr>
<label
class=
"createTrip__selectLabel"
>
<span>
Schedule Date:
</span>
<input
type=
"date"
id=
"selectDate"
>
</label>
<label
class=
"createTrip__selectLabel"
>
<span>
Schedule Time:
</span>
<input
type=
"time"
id=
"selectTime"
>
</label>
<hr>
<label
class=
"createTrip__selectLabel"
>
<span>
Plate Number:
</span>
...
...
web-app/js/app.js
View file @
b786686d
...
...
@@ -179,54 +179,7 @@ var app = {
});
},
createTrip
:
function
(
currUserAffiliation
)
{
// origin, destination, departure, plateNumber, busType, price
// search for id of each parameter
// create a pointer using the helper function
var
chosenBus
=
helper
.
getSelectedOption
(
"selectPlate"
);
var
chosenDate
=
document
.
getElementById
(
"selectDate"
).
value
;
var
chosenTime
=
document
.
getElementById
(
"selectTime"
).
value
;
console
.
log
(
moment
(
chosenDate
).
month
());
var
loader
=
document
.
getElementById
(
"loader"
);
var
successMessage
=
document
.
getElementById
(
"successMessage"
);
// console.log(chosenSchedule);
var
originPointer
,
destinationPointer
,
schedulePointer
,
busPointer
,
operatorPointer
;
// Recreate Process below using schedule day and time.
// Steps:
// 1. Search for schedule using day and time
// 2. Create pointers like below
helper
.
getParseObjectID
(
"plateNumber"
,
chosenBus
,
"Bus"
)
.
then
(
function
(
res
){
busPointer
=
helper
.
pointerTo
(
res
,
"Bus"
);
})
.
catch
(
function
(
err
){
console
.
log
(
"Bus Error: "
+
err
.
code
);
})
.
then
(
function
(){
var
dateAndTime
=
chosenDate
+
" "
+
chosenTime
;
console
.
log
(
typeof
dateAndTime
);
console
.
log
(
dateAndTime
);
var
operatorPointer
=
helper
.
pointerTo
(
currUserAffiliation
,
"Bus_Company"
);
var
Trip
=
new
Parse
.
Object
.
extend
(
"Trip"
);
var
trip
=
new
Trip
();
trip
.
set
(
"assignedBus"
,
busPointer
);
trip
.
set
(
"dateAndTime"
,
new
Date
(
dateAndTime
));
trip
.
set
(
"busCompany"
,
operatorPointer
);
trip
.
save
()
.
then
(
function
(){
successMessage
.
style
.
display
=
"block"
;
var
timeoutID
=
window
.
setTimeout
(
function
(){
loader
.
style
.
display
=
"none"
;
},
500
);
}),
function
(
err
){
console
.
log
(
"An issue popped up. Error code: "
+
err
.
code
+
"was returned by the server."
);
}
});
// Reset fields
// Add progress screen
// Steps
},
generateScheduleOptions
:
function
(
busCompany
,
parentNodeID
,
childClass
,
key
)
{
...
...
@@ -461,6 +414,20 @@ window.onload = function(){
var
currentUser
=
Parse
.
User
.
current
();
var
currLoc
=
location
.
href
;
var
currUserAffiliation
;
if
(
currLoc
.
indexOf
(
"index.html"
)
>
-
1
)
{
if
(
currentUser
==
null
){
location
.
href
=
"login.html"
;
}
else
{
var
parent
=
document
.
getElementById
(
"navigation"
);
var
outBtn
=
document
.
createElement
(
"button"
);
outBtn
.
setAttribute
(
"id"
,
"logout"
);
outBtn
.
setAttribute
(
"onclick"
,
"app.logout()"
);
outBtn
.
innerHTML
=
"Logout"
;
parent
.
appendChild
(
outBtn
);
}
}
if
(
currentUser
.
get
(
"affiliation"
)
!=
null
)
{
currUserAffiliation
=
currentUser
.
get
(
"affiliation"
).
id
;
}
...
...
@@ -509,21 +476,7 @@ window.onload = function(){
}
if
(
!
currentUser
&&
currLoc
.
indexOf
(
"login.html"
)
==
-
1
)
{
if
(
currLoc
.
indexOf
(
"adminAccount.html"
)
==
-
1
){
location
.
href
=
"login.html"
;
}
}
else
{
if
(
currLoc
.
indexOf
(
"login.html"
)
==
-
1
&&
currLoc
.
indexOf
(
"adminAccount.html"
)
==
-
1
)
{
var
parent
=
document
.
getElementById
(
"navigation"
);
var
outBtn
=
document
.
createElement
(
"button"
);
outBtn
.
setAttribute
(
"id"
,
"logout"
);
outBtn
.
setAttribute
(
"onclick"
,
"app.logout()"
);
outBtn
.
innerHTML
=
"Logout"
;
parent
.
appendChild
(
outBtn
);
}
}
if
(
currLoc
.
indexOf
(
"viewTrip.html"
)
!=
-
1
){
app
.
searchTrip
(
currUserAffiliation
);
...
...
@@ -532,29 +485,7 @@ window.onload = function(){
if
(
currLoc
.
indexOf
(
"createTrip.html"
)
!=
-
1
){
var
loader
=
document
.
getElementById
(
"loader"
);
loader
.
style
.
display
=
"block"
;
//app.generateScheduleOptions(currUserAffiliation, "selectSchedule", "", "scheduleCode");
// app.generateTerminalOptions("selectOrigin", "");
// app.generateTerminalOptions("selectDestination", "");
// app.generatePlateOptions(currUserAffiliation, "selectPlate", "");
var
timeoutID
=
window
.
setTimeout
(
function
(){
loader
.
style
.
display
=
"none"
;
},
2000
);
// var scheduleSelect = document.getElementById("selectSchedule");
// scheduleSelect.onchange = function(){
// var timeOutput = document.getElementById("scheduleTime"),
// dayOutput = document.getElementById("scheduleDay"),
// value = this.options[this.selectedIndex].text;
// var scheduleQuery = new Parse.Query("Schedule");
// scheduleQuery.equalTo("scheduleCode", value);
// scheduleQuery.first({
// success : function(res){
// timeOutput.value = res.get("departureTime");
// dayOutput.value = res.get("day");
// },
// error : function(err){ console.log(err.code); }
// })
// };
var
busSelect
=
document
.
getElementById
(
"selectPlate"
);
busSelect
.
onchange
=
function
(){
...
...
@@ -608,9 +539,4 @@ window.onload = function(){
app
.
reload
(
currentUser
.
id
);
});
}
}
// Reload
// Client Function: send value and user id (of object to be edited)
// Cloud function: look for the user, update value
// Parse.Cloud.Run("reload", {"objectId": id, "value": value})
\ No newline at end of file
}
\ No newline at end of file
web-app/reload.html
View file @
b786686d
...
...
@@ -26,16 +26,16 @@
</div>
<div
class=
"reload card"
>
<form
class=
"reload__form"
>
<h1>
Search for
User
</h1>
<h1>
Reload
User
</h1>
<label
class=
"reload__num"
>
<span>
Cellphone Number:
</span>
<input
type=
"text"
id=
"cellNum"
placeholder=
"09xxxxxxxxx"
>
</label>
<label
class=
"reload__num"
>
<span>
Cellphone Number:
</span>
<input
type=
"number"
id=
"amount"
placeholder=
"10
0"
>
<input
type=
"number"
id=
"amount"
value=
"0"
placeholder=
"
0"
>
</label>
<button
class=
"reload__btn"
id=
"searchBtn"
>
Search
</button>
<button
class=
"reload__btn"
id=
"searchBtn"
>
Reload
</button>
</form>
</div>
...
...
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