Commit 449860d3 authored by Bon Lemuel Dela Cruz's avatar Bon Lemuel Dela Cruz

Offer Ride Updates, API Fixes, End Trip Fixes

parent a06529f8
angular.module('blazer.authenticationcontrollers', []) angular.module('blazer.authenticationcontrollers', [])
.controller('AuthCtrl', function($scope, $state, postBlazer, $cordovaDialogs) { .controller('AuthCtrl', function($scope, $state, postBlazer, $timeout, $ionicPopup, $cordovaDialogs, $cordovaInAppBrowser) {
$scope.user = { $scope.user = {
username: "blazetestaccount", username: "blazetestaccount",
...@@ -20,8 +20,48 @@ angular.module('blazer.authenticationcontrollers', []) ...@@ -20,8 +20,48 @@ angular.module('blazer.authenticationcontrollers', [])
}); });
} }
$scope.showForgotpassword = function(){ /* FORGOT PASSWORD POPUP */
$scope.showForgotPassword = function(){
$scope.data = {};
// An elaborate, custom popup
var myPopup = $ionicPopup.show({
template: '<input type="email" ng-model="data.email">',
title: 'Reset Password',
subTitle: 'Please enter your email address',
scope: $scope,
buttons: [
{
text: 'Reset',
type: 'button-dark button-outline',
onTap: function() {
console.log('Destination to School');
$scope.postforgotpassword($scope.data.email);
}
},
{
text: 'Cancel',
type: 'button-dark button-outline',
onTap: function() {
console.log('Cancel Reset');
}
}
]
});
}
/* FORGOT PASSWORD */
$scope.postforgotpassword = function(email){
console.debug("[ RESET EMAIL ]", email);
var emailaddress = email;
postBlazer.ForgotPassword(emailaddress)
.success(function(response) {
console.log("FORGOT PASSWORD SUCCESS", response);
})
.error(function(response) {
console.error("FORGOT PASSWORD ERROR", response);
});
} }
$scope.showAbout = function(){ $scope.showAbout = function(){
......
...@@ -12,7 +12,7 @@ ...@@ -12,7 +12,7 @@
<input type="password" ng-model="user.password" placeholder="Password" required> <input type="password" ng-model="user.password" placeholder="Password" required>
</label> </label>
</div> </div>
<a class="form-login-link">Forgot Password?</a> <a class="form-login-link" ng-click="showForgotPassword();">Forgot Password?</a>
<button class="button button-block button-outline button-light login-button" ng-click="loginUser()" ng-disabled="loginForm.$invalid">LOGIN</button> <button class="button button-block button-outline button-light login-button" ng-click="loginUser()" ng-disabled="loginForm.$invalid">LOGIN</button>
<!-- <button class="button button-block button-small button-outline button-light login-button" ng-click="showDialog()">SIGN UP</button> --> <!-- <button class="button button-block button-small button-outline button-light login-button" ng-click="showDialog()">SIGN UP</button> -->
</form> </form>
......
...@@ -68,7 +68,7 @@ angular.module('blazer.mapcontrollers', []) ...@@ -68,7 +68,7 @@ angular.module('blazer.mapcontrollers', [])
// REMOVE MARKERS // REMOVE MARKERS
map.removeLayer(markers); map.removeLayer(markers);
$scope.drawTripMarkers(lat, lon); // DRAW TRIP MARKER ] $scope.drawMarkers(lat, lon, 'On Trip'); // DRAW TRIP MARKER ]
} }
/* EVENT LISTENERS */ /* EVENT LISTENERS */
...@@ -247,6 +247,7 @@ angular.module('blazer.mapcontrollers', []) ...@@ -247,6 +247,7 @@ angular.module('blazer.mapcontrollers', [])
$scope.selectedBarangayData = $scope.data.selectedBarangay +" "+ $scope.data.selectedBarangayTime; $scope.selectedBarangayData = $scope.data.selectedBarangay +" "+ $scope.data.selectedBarangayTime;
$scope.currentBarangay = $scope.data.selectedBarangay; $scope.currentBarangay = $scope.data.selectedBarangay;
$scope.currentBarangayTime = $scope.data.selectedBarangayTime; $scope.currentBarangayTime = $scope.data.selectedBarangayTime;
$scope.data = {};
} }
}, },
{ {
...@@ -275,6 +276,10 @@ angular.module('blazer.mapcontrollers', []) ...@@ -275,6 +276,10 @@ angular.module('blazer.mapcontrollers', [])
console.log('[ BARANGAY DETAILS ]', JSON.stringify($scope.BarangayData)); console.log('[ BARANGAY DETAILS ]', JSON.stringify($scope.BarangayData));
$scope.openChart($scope.BarangayData); // LOAD CHART MODAL $scope.openChart($scope.BarangayData); // LOAD CHART MODAL
$scope.drawMarkers($scope.BarangayData.lat, $scope.BarangayData.lng, $scope.currentBarangay); $scope.drawMarkers($scope.BarangayData.lat, $scope.BarangayData.lng, $scope.currentBarangay);
// RESET VALUES
$scope.selectedBarangayData = '';
$scope.currentBarangay = '';
$scope.currentBarangayTime = '';
}) })
.error(function(response) { .error(function(response) {
console.error("BARANGAY ERROR", response); console.error("BARANGAY ERROR", response);
...@@ -331,9 +336,10 @@ angular.module('blazer.mapcontrollers', []) ...@@ -331,9 +336,10 @@ angular.module('blazer.mapcontrollers', [])
map.removeLayer(geojsonLayer); map.removeLayer(geojsonLayer);
$scope.tripStatus = true; $scope.tripStatus = true;
var newDate = new Date();
var newDate = new Date();
startTime = newDate.getTime(); startTime = newDate.getTime();
localStorage.setItem("starttime", startTime);
console.log("START TRIP TIME", startTime); console.log("START TRIP TIME", startTime);
$scope.getUserLocation(); $scope.getUserLocation();
...@@ -344,8 +350,10 @@ angular.module('blazer.mapcontrollers', []) ...@@ -344,8 +350,10 @@ angular.module('blazer.mapcontrollers', [])
$scope.tripEnd = function(){ $scope.tripEnd = function(){
$scope.tripStatus = false; $scope.tripStatus = false;
tripStatusRef = false; tripStatusRef = false;
var newDate = new Date(); var newDate = new Date();
endTime = newDate.getTime(); var endTime = newDate.getTime();
localStorage.setItem("endtime", endTime);
console.log("END TRIP TIME", endTime); console.log("END TRIP TIME", endTime);
// TRIGGER CLEAR FUNCTION OF REMOVE LINE -- NEEDS TO DEBUG // TRIGGER CLEAR FUNCTION OF REMOVE LINE -- NEEDS TO DEBUG
......
...@@ -14,7 +14,7 @@ ...@@ -14,7 +14,7 @@
<h3 class="text-light"><center>BLAZE</center></h3> <h3 class="text-light"><center>BLAZE</center></h3>
<ion-item nav-clear menu-close href="#/app/profile" class="item-avatar"><ionic-letter-avatar data="{{ user.username }}" shape="round" charcount="2"></ionic-letter-avatar><h4 class="text-light">{{ user.username }}</h4><h5 class="text-light">Blazer User</h5></ion-item> <ion-item nav-clear menu-close href="#/app/profile" class="item-avatar"><ionic-letter-avatar data="{{ user.username }}" shape="round" charcount="2"></ionic-letter-avatar><h4 class="text-light">{{ user.username }}</h4><h5 class="text-light">Blazer User</h5></ion-item>
<ion-item nav-clear menu-close href="#/app/map" class="item-icon item-icon-left"><i class="icon ion-android-compass"></i>Blaze Network</ion-item> <ion-item nav-clear menu-close href="#/app/map" class="item-icon item-icon-left"><i class="icon ion-android-compass"></i>Blaze Network</ion-item>
<ion-item nav-clear menu-close href="#/app/offerride" class="item-icon item-icon-left"><i class="icon ion-android-car"></i>Offer a Ride</ion-item> <!-- <ion-item nav-clear menu-close href="#/app/offerride" class="item-icon item-icon-left"><i class="icon ion-android-car"></i>Offer a Ride</ion-item> -->
<ion-item nav-clear menu-close href="#/app/sharedride" class="item-icon item-icon-left"><i class="icon ion-android-contacts"></i>Shared Ride</ion-item> <ion-item nav-clear menu-close href="#/app/sharedride" class="item-icon item-icon-left"><i class="icon ion-android-contacts"></i>Shared Ride</ion-item>
<ion-item nav-clear menu-close href="#/app/status" class="item-icon item-icon-left"><i class="icon ion-android-wifi"></i>My Travel Stats</ion-item> <ion-item nav-clear menu-close href="#/app/status" class="item-icon item-icon-left"><i class="icon ion-android-wifi"></i>My Travel Stats</ion-item>
<ion-item nav-clear menu-close href="#/app/about" class="item-icon item-icon-left"><i class="icon ion-android-bulb"></i>About</ion-item> <ion-item nav-clear menu-close href="#/app/about" class="item-icon item-icon-left"><i class="icon ion-android-bulb"></i>About</ion-item>
......
angular.module('blazer.offerridecontrollers', []) angular.module('blazer.offerridecontrollers', [])
.controller('OfferRideCtrl', function($scope, getBlazer, postBlazer, LocationService, $cordovaGeolocation) { .controller('OfferRideCtrl', function($scope, $ionicHistory, getBlazer, postBlazer, LocationService, $cordovaGeolocation) {
/* MAP DEFAULTS */ /* MAP DEFAULTS */
var destinationMap = L.map('mapdestination'); var destinationMap = L.map('mapdestination');
...@@ -97,9 +97,11 @@ angular.module('blazer.offerridecontrollers', []) ...@@ -97,9 +97,11 @@ angular.module('blazer.offerridecontrollers', [])
console.log("OFFER RIDE SUCCESS", response); console.log("OFFER RIDE SUCCESS", response);
data = {}; data = {};
$scope.offer ={}; $scope.offer ={};
$ionicHistory.goBack(-1);
}) })
.error(function(response) { .error(function(response) {
console.error("OFFER RIDE ERROR", response); console.error("OFFER RIDE ERROR", response);
$ionicHistory.goBack(-1);
}); });
} }
......
<ion-view view-title="Take a Shared Ride" ng-init="getSharedRideData();"> <ion-view view-title="Shared Ride" ng-init="getSharedRideData();">
<ion-header-bar> <ion-nav-buttons side="right">
<h1 class="title">Take a Shared Ride</h1> <button class="button button-outline button-icon button-light" ui-sref='app.offerride'>
</ion-header-bar> Offer
</button>
</ion-nav-buttons>
<ion-content> <ion-content>
<ion-tabs class="tabs-clear tabs-icon-top"> <ion-tabs class="tabs-clear tabs-icon-top">
<ion-tab title="Available" class="text-light darkblue" badge="availableRide.length" badge-style="badge-assertive" icon-on="light ion-android-car" <ion-tab title="Available" class="text-light darkblue" badge="availableRide.length" badge-style="badge-assertive" icon-on="light ion-android-car"
icon-off="light ion-android-car"> icon-off="light ion-android-car">
<ion-content class="background-feed"> <ion-content class="background-feed">
......
...@@ -13,7 +13,7 @@ ...@@ -13,7 +13,7 @@
<p class="text-dark">You've just finished a trip. Please take this short survey.</p> <p class="text-dark">You've just finished a trip. Please take this short survey.</p>
</div> </div>
<div class="item item-light item-text-wrap"> <!-- <div class="item item-light item-text-wrap">
<p class="text-dark">This trip is made as part of tour:</p> <p class="text-dark">This trip is made as part of tour:</p>
</div> </div>
<label class="item item-input item-select item-text-wrap item-stable"> <label class="item item-input item-select item-text-wrap item-stable">
...@@ -25,12 +25,12 @@ ...@@ -25,12 +25,12 @@
<option value="trip1">Going Home</option> <option value="trip1">Going Home</option>
<option value="trip2">Going to School</option> <option value="trip2">Going to School</option>
</select> </select>
</label> </label> -->
<div class="item item-light item-text-wrap" ng-if="endtrip.destination"> <div class="item item-light item-text-wrap">
<p class="text-dark">What was the main mode of transport used?</p> <p class="text-dark">What was the main mode of transport used?</p>
</div> </div>
<label class="item item-input item-select item-text-wrap item-stable" ng-if="endtrip.destination"> <label class="item item-input item-select item-text-wrap item-stable">
&nbsp &nbsp
<div class="input-label"> <div class="input-label">
</div> </div>
...@@ -50,11 +50,11 @@ ...@@ -50,11 +50,11 @@
</select> </select>
</label> </label>
<div class="item item-light item-text-wrap" ng-if="endtrip.mode && endtrip.mode"> <div class="item item-light item-text-wrap" ng-if="endtrip.mode">
<p class="text-dark">You made this trip by <p class="text-dark">You made this trip by
<u><b> {{endtrip.mode}} </b></u>. Overall, how would you evaluate this experience?</p> <u><b> {{endtrip.mode}} </b></u>. Overall, how would you evaluate this experience?</p>
</div> </div>
<label class="item item-input item-select item-text-wrap item-stable" ng-if="endtrip.mode && endtrip.mode"> <label class="item item-input item-select item-text-wrap item-stable" ng-if="endtrip.mode">
&nbsp &nbsp
<div class="input-label"> <div class="input-label">
</div> </div>
......
...@@ -10,9 +10,7 @@ angular.module('blazer.surveycontrollers', []) ...@@ -10,9 +10,7 @@ angular.module('blazer.surveycontrollers', [])
$scope.modalWeeklyTrip.hide(); $scope.modalWeeklyTrip.hide();
}; };
$scope.endtrip = { $scope.endtrip = {};
destination: localStorage.getItem("currentTrip")
};
$scope.postEndTripSurvey = function(){ $scope.postEndTripSurvey = function(){
var tripID = localStorage.getItem("tripid"); var tripID = localStorage.getItem("tripid");
var username = localStorage.getItem("username"); var username = localStorage.getItem("username");
...@@ -20,6 +18,7 @@ angular.module('blazer.surveycontrollers', []) ...@@ -20,6 +18,7 @@ angular.module('blazer.surveycontrollers', [])
var endTime = localStorage.getItem("endtime"); var endTime = localStorage.getItem("endtime");
var newDate = new Date(); var newDate = new Date();
var timeStamp = newDate.getTime(); var timeStamp = newDate.getTime();
var currentTrip = localStorage.getItem("currentTrip");
var postdata = { var postdata = {
"trip_id" : tripID, "trip_id" : tripID,
...@@ -29,7 +28,7 @@ angular.module('blazer.surveycontrollers', []) ...@@ -29,7 +28,7 @@ angular.module('blazer.surveycontrollers', [])
"mode": $scope.endtrip.mode, "mode": $scope.endtrip.mode,
"exp": $scope.endtrip.overallxp, "exp": $scope.endtrip.overallxp,
"emotion": $scope.endtrip.emotion, "emotion": $scope.endtrip.emotion,
"type": $scope.endtrip.destination "type": currentTrip
} }
console.log("[ POST END TRIP SURVEY ]"); console.log("[ POST END TRIP SURVEY ]");
postBlazer.EndTripSurvey(postdata) postBlazer.EndTripSurvey(postdata)
......
...@@ -230,6 +230,7 @@ color: #fff; ...@@ -230,6 +230,7 @@ color: #fff;
margin-right: 10%; margin-right: 10%;
margin-left: 25%; margin-left: 25%;
margin-bottom: 5%; margin-bottom: 5%;
margin-top: 5%;
font-size: 12px !important; font-size: 12px !important;
} }
......
...@@ -25,7 +25,7 @@ ...@@ -25,7 +25,7 @@
<script src="lib/chart/angular-chart.js"></script> <script src="lib/chart/angular-chart.js"></script>
<!-- cordova script (this will be a 404 during development) --> <!-- cordova script (this will be a 404 during development) -->
<script src="lib/ng-cordova.min.js"></script> <script src="lib/ngCordova/ng-cordova.min.js"></script>
<script src="cordova.js"></script> <script src="cordova.js"></script>
<script type="text/javascript" src="https://maps.googleapis.com/maps/api/js?libraries=places&sensor=false"></script> <script type="text/javascript" src="https://maps.googleapis.com/maps/api/js?libraries=places&sensor=false"></script>
...@@ -57,7 +57,7 @@ ...@@ -57,7 +57,7 @@
</head> </head>
<body ng-app="blazer"> <body ng-app="blazer" class="platform-android platform-cordova platform-webview">
<ion-nav-view></ion-nav-view> <ion-nav-view></ion-nav-view>
</body> </body>
</html> </html>
...@@ -38,6 +38,8 @@ angular.module('blazer', [ ...@@ -38,6 +38,8 @@ angular.module('blazer', [
.config(function($stateProvider, $urlRouterProvider, $ionicConfigProvider) { .config(function($stateProvider, $urlRouterProvider, $ionicConfigProvider) {
$ionicConfigProvider.tabs.position('bottom'); // other values: top $ionicConfigProvider.tabs.position('bottom'); // other values: top
$ionicConfigProvider.tabs.style('standard');
$ionicConfigProvider.spinner.icon('lines');
$stateProvider $stateProvider
/* MENU */ /* MENU */
......
...@@ -199,7 +199,7 @@ angular.module('blazer.apiservices', []) ...@@ -199,7 +199,7 @@ angular.module('blazer.apiservices', [])
}).error(function(responseData) { }).error(function(responseData) {
console.error("[ ERROR ]", JSON.stringify(responseData)); console.error("[ ERROR ]", JSON.stringify(responseData));
deferred.reject('Error'); deferred.reject('Error');
$ionicLoading.show({ template: "Unexpected Error!", duration: 500}); $ionicLoading.show({ template: "Check your connection!", duration: 500});
}); });
promise.success = function(fn) { promise.success = function(fn) {
...@@ -292,7 +292,7 @@ angular.module('blazer.apiservices', []) ...@@ -292,7 +292,7 @@ angular.module('blazer.apiservices', [])
console.error("[ ERROR ]", JSON.stringify(responseData)); console.error("[ ERROR ]", JSON.stringify(responseData));
deferred.reject('Error'); deferred.reject('Error');
$ionicLoading.show({ template: "Sending Error!", duration: 1000}); $ionicLoading.show({ template: "Try Again!", duration: 1000});
}); });
promise.success = function(fn) { promise.success = function(fn) {
...@@ -328,12 +328,12 @@ angular.module('blazer.apiservices', []) ...@@ -328,12 +328,12 @@ angular.module('blazer.apiservices', [])
console.log("[ SUCCESS ]", JSON.stringify(responseData)); console.log("[ SUCCESS ]", JSON.stringify(responseData));
deferred.resolve('Success'); deferred.resolve('Success');
$ionicLoading.show({ template: "Success!", duration: 1000}); $ionicLoading.show({ template: "Submitted!", duration: 1000});
}).error(function(responseData) { }).error(function(responseData) {
console.error("[ ERROR ]", JSON.stringify(responseData)); console.error("[ ERROR ]", JSON.stringify(responseData));
deferred.reject('Error'); deferred.reject('Error');
$ionicLoading.show({ template: "Sending Error!", duration: 1000}); $ionicLoading.show({ template: "Try Again!", duration: 1000});
}); });
promise.success = function(fn) { promise.success = function(fn) {
...@@ -357,7 +357,7 @@ angular.module('blazer.apiservices', []) ...@@ -357,7 +357,7 @@ angular.module('blazer.apiservices', [])
$ionicLoading.show({ template: '<ion-spinner icon="crescent"></ion-spinner>', duration: 30000}); $ionicLoading.show({ template: '<ion-spinner icon="crescent"></ion-spinner>', duration: 30000});
var sharedRideData = { var sharedRideData = {
"ride_id": data.ride_id, "ride_id": data.ride_id,
"username": data.username "user": data.username
}; };
$http({method: 'POST', url: blazerAPI + '/take_shared_ride_post.php', $http({method: 'POST', url: blazerAPI + '/take_shared_ride_post.php',
data: $.param(sharedRideData), data: $.param(sharedRideData),
...@@ -506,7 +506,44 @@ angular.module('blazer.apiservices', []) ...@@ -506,7 +506,44 @@ angular.module('blazer.apiservices', [])
return promise; return promise;
} }
return promise; return promise;
} },
ForgotPassword: function(data) {
console.log("****** ON ENTER FORGOT PASSWORD SERVICE ******");
var deferred = $q.defer();
var promise = deferred.promise;
console.log("[ EMAIL DATA ] -> ", JSON.stringify(data));
$ionicLoading.show({ template: '<ion-spinner icon="crescent"></ion-spinner>', duration: 30000});
var emailData = {
"email_address": data.email_address,
};
$http({method: 'POST', url: 'http://blaze.eacomm.com/send_password.php',
data: $.param(emailData),
headers : {'Content-Type': 'application/x-www-form-urlencoded'}
}).success(function(responseData) {
console.log("[ SUCCESS ]", JSON.stringify(responseData));
deferred.resolve('Success');
$ionicLoading.show({ template: "Success!", duration: 1000});
}).error(function(responseData) {
console.error("[ ERROR ]", JSON.stringify(responseData));
deferred.reject('Error');
$ionicLoading.show({ template: "Request Error!", duration: 1000});
});
promise.success = function(fn) {
promise.then(fn);
return promise;
}
promise.error = function(fn) {
promise.then(null, fn);
return promise;
}
return promise;
},
} }
}) })
......
This source diff could not be displayed because it is too large. You can view the blob instead.
angular.module('blazer.authenticationcontrollers', []) angular.module('blazer.authenticationcontrollers', [])
.controller('AuthCtrl', function($scope, $state, postBlazer, $cordovaDialogs, $cordovaInAppBrowser) { .controller('AuthCtrl', function($scope, $state, postBlazer, $timeout, $ionicPopup, $cordovaDialogs, $cordovaInAppBrowser) {
$scope.user = { $scope.user = {
username: "blazetestaccount", username: "blazetestaccount",
...@@ -20,17 +20,47 @@ angular.module('blazer.authenticationcontrollers', []) ...@@ -20,17 +20,47 @@ angular.module('blazer.authenticationcontrollers', [])
}); });
} }
/* FORGOT PASSWORD POPUP */
$scope.showForgotPassword = function(){
$scope.data = {};
// An elaborate, custom popup
var myPopup = $ionicPopup.show({
template: '<input type="email" ng-model="data.email">',
title: 'Reset Password',
subTitle: 'Please enter your email address',
scope: $scope,
buttons: [
{
text: 'Reset',
type: 'button-dark button-outline',
onTap: function() {
console.log('Destination to School');
$scope.postforgotpassword($scope.data.email);
}
},
{
text: 'Cancel',
type: 'button-dark button-outline',
onTap: function() {
console.log('Cancel Reset');
}
}
]
});
}
/* FORGOT PASSWORD */ /* FORGOT PASSWORD */
$scope.forgotpassword = function(){ $scope.postforgotpassword = function(email){
var emailaddress = ''; console.debug("[ RESET EMAIL ]", email);
postBlazer.forgotpassword($scope.user) var emailaddress = email;
postBlazer.ForgotPassword(emailaddress)
.success(function(response) { .success(function(response) {
console.log("LOGIN SUCCESS", response); console.log("FORGOT PASSWORD SUCCESS", response);
$state.go('app.map');
localStorage.setItem("username", $scope.user.username);
}) })
.error(function(response) { .error(function(response) {
console.error("LOGIN ERROR", response); console.error("FORGOT PASSWORD ERROR", response);
}); });
} }
......
...@@ -12,7 +12,7 @@ ...@@ -12,7 +12,7 @@
<input type="password" ng-model="user.password" placeholder="Password" required> <input type="password" ng-model="user.password" placeholder="Password" required>
</label> </label>
</div> </div>
<a class="form-login-link" ng-click="forgotpassword();">Forgot Password?</a> <a class="form-login-link" ng-click="showForgotPassword();">Forgot Password?</a>
<button class="button button-block button-outline button-light login-button" ng-click="loginUser()" ng-disabled="loginForm.$invalid">LOGIN</button> <button class="button button-block button-outline button-light login-button" ng-click="loginUser()" ng-disabled="loginForm.$invalid">LOGIN</button>
<!-- <button class="button button-block button-small button-outline button-light login-button" ng-click="showDialog()">SIGN UP</button> --> <!-- <button class="button button-block button-small button-outline button-light login-button" ng-click="showDialog()">SIGN UP</button> -->
</form> </form>
......
...@@ -68,7 +68,7 @@ angular.module('blazer.mapcontrollers', []) ...@@ -68,7 +68,7 @@ angular.module('blazer.mapcontrollers', [])
// REMOVE MARKERS // REMOVE MARKERS
map.removeLayer(markers); map.removeLayer(markers);
$scope.drawTripMarkers(lat, lon); // DRAW TRIP MARKER ] $scope.drawMarkers(lat, lon, 'On Trip'); // DRAW TRIP MARKER ]
} }
/* EVENT LISTENERS */ /* EVENT LISTENERS */
...@@ -247,6 +247,7 @@ angular.module('blazer.mapcontrollers', []) ...@@ -247,6 +247,7 @@ angular.module('blazer.mapcontrollers', [])
$scope.selectedBarangayData = $scope.data.selectedBarangay +" "+ $scope.data.selectedBarangayTime; $scope.selectedBarangayData = $scope.data.selectedBarangay +" "+ $scope.data.selectedBarangayTime;
$scope.currentBarangay = $scope.data.selectedBarangay; $scope.currentBarangay = $scope.data.selectedBarangay;
$scope.currentBarangayTime = $scope.data.selectedBarangayTime; $scope.currentBarangayTime = $scope.data.selectedBarangayTime;
$scope.data = {};
} }
}, },
{ {
...@@ -275,6 +276,10 @@ angular.module('blazer.mapcontrollers', []) ...@@ -275,6 +276,10 @@ angular.module('blazer.mapcontrollers', [])
console.log('[ BARANGAY DETAILS ]', JSON.stringify($scope.BarangayData)); console.log('[ BARANGAY DETAILS ]', JSON.stringify($scope.BarangayData));
$scope.openChart($scope.BarangayData); // LOAD CHART MODAL $scope.openChart($scope.BarangayData); // LOAD CHART MODAL
$scope.drawMarkers($scope.BarangayData.lat, $scope.BarangayData.lng, $scope.currentBarangay); $scope.drawMarkers($scope.BarangayData.lat, $scope.BarangayData.lng, $scope.currentBarangay);
// RESET VALUES
$scope.selectedBarangayData = '';
$scope.currentBarangay = '';
$scope.currentBarangayTime = '';
}) })
.error(function(response) { .error(function(response) {
console.error("BARANGAY ERROR", response); console.error("BARANGAY ERROR", response);
...@@ -331,9 +336,10 @@ angular.module('blazer.mapcontrollers', []) ...@@ -331,9 +336,10 @@ angular.module('blazer.mapcontrollers', [])
map.removeLayer(geojsonLayer); map.removeLayer(geojsonLayer);
$scope.tripStatus = true; $scope.tripStatus = true;
var newDate = new Date();
var newDate = new Date();
startTime = newDate.getTime(); startTime = newDate.getTime();
localStorage.setItem("starttime", startTime);
console.log("START TRIP TIME", startTime); console.log("START TRIP TIME", startTime);
$scope.getUserLocation(); $scope.getUserLocation();
...@@ -344,8 +350,10 @@ angular.module('blazer.mapcontrollers', []) ...@@ -344,8 +350,10 @@ angular.module('blazer.mapcontrollers', [])
$scope.tripEnd = function(){ $scope.tripEnd = function(){
$scope.tripStatus = false; $scope.tripStatus = false;
tripStatusRef = false; tripStatusRef = false;
var newDate = new Date(); var newDate = new Date();
endTime = newDate.getTime(); var endTime = newDate.getTime();
localStorage.setItem("endtime", endTime);
console.log("END TRIP TIME", endTime); console.log("END TRIP TIME", endTime);
// TRIGGER CLEAR FUNCTION OF REMOVE LINE -- NEEDS TO DEBUG // TRIGGER CLEAR FUNCTION OF REMOVE LINE -- NEEDS TO DEBUG
......
...@@ -14,7 +14,7 @@ ...@@ -14,7 +14,7 @@
<h3 class="text-light"><center>BLAZE</center></h3> <h3 class="text-light"><center>BLAZE</center></h3>
<ion-item nav-clear menu-close href="#/app/profile" class="item-avatar"><ionic-letter-avatar data="{{ user.username }}" shape="round" charcount="2"></ionic-letter-avatar><h4 class="text-light">{{ user.username }}</h4><h5 class="text-light">Blazer User</h5></ion-item> <ion-item nav-clear menu-close href="#/app/profile" class="item-avatar"><ionic-letter-avatar data="{{ user.username }}" shape="round" charcount="2"></ionic-letter-avatar><h4 class="text-light">{{ user.username }}</h4><h5 class="text-light">Blazer User</h5></ion-item>
<ion-item nav-clear menu-close href="#/app/map" class="item-icon item-icon-left"><i class="icon ion-android-compass"></i>Blaze Network</ion-item> <ion-item nav-clear menu-close href="#/app/map" class="item-icon item-icon-left"><i class="icon ion-android-compass"></i>Blaze Network</ion-item>
<ion-item nav-clear menu-close href="#/app/offerride" class="item-icon item-icon-left"><i class="icon ion-android-car"></i>Offer a Ride</ion-item> <!-- <ion-item nav-clear menu-close href="#/app/offerride" class="item-icon item-icon-left"><i class="icon ion-android-car"></i>Offer a Ride</ion-item> -->
<ion-item nav-clear menu-close href="#/app/sharedride" class="item-icon item-icon-left"><i class="icon ion-android-contacts"></i>Shared Ride</ion-item> <ion-item nav-clear menu-close href="#/app/sharedride" class="item-icon item-icon-left"><i class="icon ion-android-contacts"></i>Shared Ride</ion-item>
<ion-item nav-clear menu-close href="#/app/status" class="item-icon item-icon-left"><i class="icon ion-android-wifi"></i>My Travel Stats</ion-item> <ion-item nav-clear menu-close href="#/app/status" class="item-icon item-icon-left"><i class="icon ion-android-wifi"></i>My Travel Stats</ion-item>
<ion-item nav-clear menu-close href="#/app/about" class="item-icon item-icon-left"><i class="icon ion-android-bulb"></i>About</ion-item> <ion-item nav-clear menu-close href="#/app/about" class="item-icon item-icon-left"><i class="icon ion-android-bulb"></i>About</ion-item>
......
angular.module('blazer.offerridecontrollers', []) angular.module('blazer.offerridecontrollers', [])
.controller('OfferRideCtrl', function($scope, getBlazer, postBlazer, LocationService, $cordovaGeolocation) { .controller('OfferRideCtrl', function($scope, $ionicHistory, getBlazer, postBlazer, LocationService, $cordovaGeolocation) {
/* MAP DEFAULTS */ /* MAP DEFAULTS */
var destinationMap = L.map('mapdestination'); var destinationMap = L.map('mapdestination');
...@@ -97,9 +97,11 @@ angular.module('blazer.offerridecontrollers', []) ...@@ -97,9 +97,11 @@ angular.module('blazer.offerridecontrollers', [])
console.log("OFFER RIDE SUCCESS", response); console.log("OFFER RIDE SUCCESS", response);
data = {}; data = {};
$scope.offer ={}; $scope.offer ={};
$ionicHistory.goBack(-1);
}) })
.error(function(response) { .error(function(response) {
console.error("OFFER RIDE ERROR", response); console.error("OFFER RIDE ERROR", response);
$ionicHistory.goBack(-1);
}); });
} }
......
<ion-view view-title="Take a Shared Ride" ng-init="getSharedRideData();"> <ion-view view-title="Shared Ride" ng-init="getSharedRideData();">
<ion-header-bar> <ion-nav-buttons side="right">
<h1 class="title">Take a Shared Ride</h1> <button class="button button-outline button-icon button-light" ui-sref='app.offerride'>
</ion-header-bar> Offer
</button>
</ion-nav-buttons>
<ion-content> <ion-content>
<ion-tabs class="tabs-clear tabs-icon-top"> <ion-tabs class="tabs-clear tabs-icon-top">
<ion-tab title="Available" class="text-light darkblue" badge="availableRide.length" badge-style="badge-assertive" icon-on="light ion-android-car" <ion-tab title="Available" class="text-light darkblue" badge="availableRide.length" badge-style="badge-assertive" icon-on="light ion-android-car"
icon-off="light ion-android-car"> icon-off="light ion-android-car">
<ion-content class="background-feed"> <ion-content class="background-feed">
......
...@@ -13,7 +13,7 @@ ...@@ -13,7 +13,7 @@
<p class="text-dark">You've just finished a trip. Please take this short survey.</p> <p class="text-dark">You've just finished a trip. Please take this short survey.</p>
</div> </div>
<div class="item item-light item-text-wrap"> <!-- <div class="item item-light item-text-wrap">
<p class="text-dark">This trip is made as part of tour:</p> <p class="text-dark">This trip is made as part of tour:</p>
</div> </div>
<label class="item item-input item-select item-text-wrap item-stable"> <label class="item item-input item-select item-text-wrap item-stable">
...@@ -25,12 +25,12 @@ ...@@ -25,12 +25,12 @@
<option value="trip1">Going Home</option> <option value="trip1">Going Home</option>
<option value="trip2">Going to School</option> <option value="trip2">Going to School</option>
</select> </select>
</label> </label> -->
<div class="item item-light item-text-wrap" ng-if="endtrip.destination"> <div class="item item-light item-text-wrap">
<p class="text-dark">What was the main mode of transport used?</p> <p class="text-dark">What was the main mode of transport used?</p>
</div> </div>
<label class="item item-input item-select item-text-wrap item-stable" ng-if="endtrip.destination"> <label class="item item-input item-select item-text-wrap item-stable">
&nbsp &nbsp
<div class="input-label"> <div class="input-label">
</div> </div>
...@@ -50,11 +50,11 @@ ...@@ -50,11 +50,11 @@
</select> </select>
</label> </label>
<div class="item item-light item-text-wrap" ng-if="endtrip.mode && endtrip.mode"> <div class="item item-light item-text-wrap" ng-if="endtrip.mode">
<p class="text-dark">You made this trip by <p class="text-dark">You made this trip by
<u><b> {{endtrip.mode}} </b></u>. Overall, how would you evaluate this experience?</p> <u><b> {{endtrip.mode}} </b></u>. Overall, how would you evaluate this experience?</p>
</div> </div>
<label class="item item-input item-select item-text-wrap item-stable" ng-if="endtrip.mode && endtrip.mode"> <label class="item item-input item-select item-text-wrap item-stable" ng-if="endtrip.mode">
&nbsp &nbsp
<div class="input-label"> <div class="input-label">
</div> </div>
......
...@@ -10,9 +10,7 @@ angular.module('blazer.surveycontrollers', []) ...@@ -10,9 +10,7 @@ angular.module('blazer.surveycontrollers', [])
$scope.modalWeeklyTrip.hide(); $scope.modalWeeklyTrip.hide();
}; };
$scope.endtrip = { $scope.endtrip = {};
destination: localStorage.getItem("currentTrip")
};
$scope.postEndTripSurvey = function(){ $scope.postEndTripSurvey = function(){
var tripID = localStorage.getItem("tripid"); var tripID = localStorage.getItem("tripid");
var username = localStorage.getItem("username"); var username = localStorage.getItem("username");
...@@ -20,6 +18,7 @@ angular.module('blazer.surveycontrollers', []) ...@@ -20,6 +18,7 @@ angular.module('blazer.surveycontrollers', [])
var endTime = localStorage.getItem("endtime"); var endTime = localStorage.getItem("endtime");
var newDate = new Date(); var newDate = new Date();
var timeStamp = newDate.getTime(); var timeStamp = newDate.getTime();
var currentTrip = localStorage.getItem("currentTrip");
var postdata = { var postdata = {
"trip_id" : tripID, "trip_id" : tripID,
...@@ -29,7 +28,7 @@ angular.module('blazer.surveycontrollers', []) ...@@ -29,7 +28,7 @@ angular.module('blazer.surveycontrollers', [])
"mode": $scope.endtrip.mode, "mode": $scope.endtrip.mode,
"exp": $scope.endtrip.overallxp, "exp": $scope.endtrip.overallxp,
"emotion": $scope.endtrip.emotion, "emotion": $scope.endtrip.emotion,
"type": $scope.endtrip.destination "type": currentTrip
} }
console.log("[ POST END TRIP SURVEY ]"); console.log("[ POST END TRIP SURVEY ]");
postBlazer.EndTripSurvey(postdata) postBlazer.EndTripSurvey(postdata)
......
...@@ -230,6 +230,7 @@ color: #fff; ...@@ -230,6 +230,7 @@ color: #fff;
margin-right: 10%; margin-right: 10%;
margin-left: 25%; margin-left: 25%;
margin-bottom: 5%; margin-bottom: 5%;
margin-top: 5%;
font-size: 12px !important; font-size: 12px !important;
} }
......
...@@ -38,6 +38,8 @@ angular.module('blazer', [ ...@@ -38,6 +38,8 @@ angular.module('blazer', [
.config(function($stateProvider, $urlRouterProvider, $ionicConfigProvider) { .config(function($stateProvider, $urlRouterProvider, $ionicConfigProvider) {
$ionicConfigProvider.tabs.position('bottom'); // other values: top $ionicConfigProvider.tabs.position('bottom'); // other values: top
$ionicConfigProvider.tabs.style('standard');
$ionicConfigProvider.spinner.icon('lines');
$stateProvider $stateProvider
/* MENU */ /* MENU */
......
...@@ -199,7 +199,7 @@ angular.module('blazer.apiservices', []) ...@@ -199,7 +199,7 @@ angular.module('blazer.apiservices', [])
}).error(function(responseData) { }).error(function(responseData) {
console.error("[ ERROR ]", JSON.stringify(responseData)); console.error("[ ERROR ]", JSON.stringify(responseData));
deferred.reject('Error'); deferred.reject('Error');
$ionicLoading.show({ template: "Unexpected Error!", duration: 500}); $ionicLoading.show({ template: "Check your connection!", duration: 500});
}); });
promise.success = function(fn) { promise.success = function(fn) {
...@@ -292,7 +292,7 @@ angular.module('blazer.apiservices', []) ...@@ -292,7 +292,7 @@ angular.module('blazer.apiservices', [])
console.error("[ ERROR ]", JSON.stringify(responseData)); console.error("[ ERROR ]", JSON.stringify(responseData));
deferred.reject('Error'); deferred.reject('Error');
$ionicLoading.show({ template: "Sending Error!", duration: 1000}); $ionicLoading.show({ template: "Try Again!", duration: 1000});
}); });
promise.success = function(fn) { promise.success = function(fn) {
...@@ -328,12 +328,12 @@ angular.module('blazer.apiservices', []) ...@@ -328,12 +328,12 @@ angular.module('blazer.apiservices', [])
console.log("[ SUCCESS ]", JSON.stringify(responseData)); console.log("[ SUCCESS ]", JSON.stringify(responseData));
deferred.resolve('Success'); deferred.resolve('Success');
$ionicLoading.show({ template: "Success!", duration: 1000}); $ionicLoading.show({ template: "Submitted!", duration: 1000});
}).error(function(responseData) { }).error(function(responseData) {
console.error("[ ERROR ]", JSON.stringify(responseData)); console.error("[ ERROR ]", JSON.stringify(responseData));
deferred.reject('Error'); deferred.reject('Error');
$ionicLoading.show({ template: "Sending Error!", duration: 1000}); $ionicLoading.show({ template: "Try Again!", duration: 1000});
}); });
promise.success = function(fn) { promise.success = function(fn) {
...@@ -357,7 +357,7 @@ angular.module('blazer.apiservices', []) ...@@ -357,7 +357,7 @@ angular.module('blazer.apiservices', [])
$ionicLoading.show({ template: '<ion-spinner icon="crescent"></ion-spinner>', duration: 30000}); $ionicLoading.show({ template: '<ion-spinner icon="crescent"></ion-spinner>', duration: 30000});
var sharedRideData = { var sharedRideData = {
"ride_id": data.ride_id, "ride_id": data.ride_id,
"username": data.username "user": data.username
}; };
$http({method: 'POST', url: blazerAPI + '/take_shared_ride_post.php', $http({method: 'POST', url: blazerAPI + '/take_shared_ride_post.php',
data: $.param(sharedRideData), data: $.param(sharedRideData),
......
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