Commit 76b54f1b authored by Bon Lemuel Dela Cruz's avatar Bon Lemuel Dela Cruz

- Weekly Survey Updates

- Blaze Map "Red" "Yellow" "Green"
- My Diary
parent a0fcfc32
<ion-view view-title="My Trip Diary" ng-init="loadComparisonMessages();">
<ion-nav-buttons side="right">
</ion-nav-buttons>
<ion-content padding="true">
<ion-refresher pulling-text="Pull to refresh" on-refresh="loadComparisonMessages(); clearGraphs();"></ion-refresher>
<div class="card">
<div class="item item-header item-clear bgbluegreen text-light"> Comparison Message </div>
<div class="item item-body">
<p>Some Interesting Facts:</p>
<p>"Your shortest travel time is {{comparisonMessage.best_time}} minutes."</p>
<p>"Your worst travel time is {{comparisonMessage.worst_time}} minutes."</p>
<p>"By comparison, {{comparisonMessage.zero_car_user}} who lives in the same area as you do achieved the shortest travel time of {{comparisonMessage.best_near_car_blazer}} minutes."</p>
</div>
</form>
</div>
<div class="card">
<div class="item item-header item-clear bgbluegreen text-light"> Home to School Travel Times </div>
<div class="item">
<form name="form_1">
<label class="item item-input">
<span class="input-label">Start Date:</span>
<input type="date" ng-model="request.start_date" required>
</label>
<label class="item item-input">
<span class="input-label">End Date:</span>
<input type="date" ng-model="request.end_date" required>
</label>
<button class="button button-block button-dark button-outline" ng-disabled="form_1.$invalid" ng-click="loadHometoSchoolTravel();"> Show </button>
</div>
<div class="item item-body">
<p>Range: {{request.start_date | date:'mediumDate'}} - {{request.end_date | date:'mediumDate'}}</p>
<canvas id="line" class="chart chart-line" chart-data="htsdata" chart-labels="htslabels" chart-options="options" chart-dataset-override="datasetOverride" chart-click="onClick"></canvas>
</div>
</form>
</div>
<div class="card">
<div class="item item-header item-clear bgbluegreen text-light"> Mode Use by Trips </div>
<div class="item item-body">
<form name="form_2">
<label class="item item-input">
<span class="input-label">Start Date:</span>
<input type="date" ng-model="requestMode.start_date" required>
</label>
<label class="item item-input">
<span class="input-label">End Date:</span>
<input type="date" ng-model="requestMode.end_date" required>
</label>
<button class="button button-block button-dark button-outline" ng-disabled="form_2.$invalid" ng-click="loadModeUseTravel();"> Show </button>
</div>
<div class="item item-body">
<p>Range: {{requestMode.start_date | date:'mediumDate'}} - {{requestMode.end_date | date:'mediumDate'}}</p>
<canvas id="pie" class="chart chart-pie" chart-data="hmadata" chart-labels="hmalabels"></canvas>
</div>
</div>
</ion-content>
</ion-view>
\ No newline at end of file
angular.module('blazer.diarycontrollers', [])
.controller('DiaryCtrl', function($scope, $filter, getBlazer, postBlazer) {
$scope.request = {};
$scope.travelData = {};
$scope.htslabels = {};
$scope.htsdata = {};
$scope.loadHometoSchoolTravel = function() {
$scope.htslabels = [];
$scope.htsdata = [];
var request = {
username: localStorage.getItem("username"),
start_date: $filter('date')($scope.request.start_date, 'yyyy-MM-dd'),
end_date: $filter('date')($scope.request.end_date, 'yyyy-MM-dd'),
}
postBlazer.HometoSchoolTravelTimes(request)
.success(function(response) {
console.log("HOME TO SCHOOL DATA", JSON.stringify(response));
$scope.travelData = response.travel_times;
$scope.htslabels = [];
$scope.htsdata = [];
for (var i = 0; i < $scope.travelData.length; i++) {
console.log("[ PARSED DATA ]", JSON.stringify($scope.travelData[i]));
var string_data = $scope.travelData[i].date;
$scope.htslabels.push([string_data.toString()]);
$scope.htsdata.push([$scope.travelData[i].time]);
}
console.log(JSON.stringify($scope.htslabels));
console.log(JSON.stringify($scope.htsdata));
})
.error(function(response) {
console.error("HOME TO SCHOOL ERROR", response);
});
}
$scope.requestMode = {};
$scope.hmadata = [];
$scope.hmalabels = [];
$scope.loadModeUseTravel = function() {
$scope.hmadata = [];
$scope.hmalabels = [];
var requestMode = {
username: localStorage.getItem("username"),
start_date: $filter('date')($scope.request.start_date, 'yyyy-MM-dd'),
end_date: $filter('date')($scope.request.end_date, 'yyyy-MM-dd'),
}
getBlazer.getHowYouMoveAround(requestMode.start_date, requestMode.end_date, requestMode.username).then(function(data) {
console.log("[ TRAVEL MODE ]", JSON.stringify(data));
if (!data) {
$ionicLoading.show({ template: "No data for this request", duration: 1000 });
} else {
angular.forEach(data, function(value, key) {
$scope.hmalabels.push([key]);
$scope.hmadata.push(value);
});
console.log($scope.hmalabels);
console.log($scope.hmadata);
}
});
}
$scope.comparisonMessage = {};
$scope.loadComparisonMessages = function() {
$scope.$broadcast('scroll.refreshComplete');
var requestMode = {
username: localStorage.getItem("username")
}
getBlazer.getComparisonMessage(requestMode.username).then(function(data) {
console.log("[ TRAVEL MODE ]", JSON.stringify(data));
$scope.comparisonMessage = {
best_time: data.fact_1.best_time,
worst_time: data.fact_1.worst_time,
best_time_near: data.fact_1.best_time_near,
total_car_usage: data.fact_2.total_car_usage,
best_near_car_usage: data.fact_2.best_near_car_usage,
best_near_car_blazer: data.fact_2.best_near_car_blazer,
zero_car_user: data.fact_2.zero_car_user
}
});
}
$scope.clearGraphs = function() {
$scope.$broadcast('scroll.refreshComplete');
$scope.requestMode = {};
$scope.hmadata = [];
$scope.hmalabels = [];
$scope.request = {};
$scope.travelData = {};
$scope.htslabels = {};
$scope.htsdata = {};
}
});
\ No newline at end of file
......@@ -2,574 +2,614 @@ angular.module('blazer.mapcontrollers', [])
.controller('MapCtrl', function($scope, $cordovaGeolocation, $cordovaDialogs, $stateParams, $ionicModal, $ionicPopup, $ionicLoading, $interval, $filter, $ionicPopover, getBlazer, postBlazer, $ionicSideMenuDelegate, $ionicHistory, $cordovaNetwork) {
// CLEAR HISTORY
$ionicHistory.clearHistory();
/* SIDE MENU TRIGGER */
$ionicSideMenuDelegate.canDragContent(false); // SET SIDE MENU DRAG FALSE
$scope.openMenu = function(){
$ionicSideMenuDelegate.toggleLeft();
}
/* MAP DEFAULTS */
var map = L.map('mapid');
map.setView(new L.LatLng(14.5818, 120.9771), 12);
//MAP BOX
L.tileLayer(maplayer, {
maxZoom: 18,
minZoom: 9,
attribution: '© OpenStreetMap contributors'
}).addTo(map);
/* MAP COMPONENTS */
var markers, circles, line;
$scope.drawMarkers = function(lat, lon, message){
markers = new L.marker([lat, lon]).addTo(map);
markers.bindPopup(message).openPopup();
}
/* Draw Trip Marker */
$scope.drawTripMarkers = function(lat, lon){
markers = new L.marker([lat, lon]).addTo(map);
markers.bindPopup('On Trip').openPopup();
}
/* Draw Radius */
$scope.drawCircle = function(lat, lon){
circle = L.circle([lat, lon], 500, {
color: '',
fillColor: '#165c5b',
fillOpacity: 0.3
}).addTo(map);
}
var coordinates = []; // FOR DRAWN LINES
var logCoordinates = []; // FOR LOGGING TRIP
var setLatLng;
var coords;
$scope.drawLineTrack = function(lat, lon){
var polylineOptions = {
color: '#185c82',
weight: 6,
opacity: 0.9
};
setLatLng = new L.LatLng(lat, lon); // USING LEAFLET LATLNG
coords = { lat, lon }; // USING SELF LATLNG
coordinates.push(coords);
console.log(coordinates);
line = new L.polyline(coordinates, polylineOptions);
// line.addTo(map);
map.addLayer(line);
// map.fitBounds(line.getBounds()); // zoom the map to the polyline
// REMOVE MARKERS
map.removeLayer(markers);
$scope.drawMarkers(lat, lon, 'On Trip'); // DRAW TRIP MARKER ]
}
/* EVENT LISTENERS */
$scope.mapButton = true;
function onMapDrag(e) {
$scope.mapButton = false;
console.log("Map Drag ", $scope.mapButton);
}
function onMapDragEnd(e) {
$scope.mapButton = true;
console.log("Map Drag ", $scope.mapButton);
}
map.on('move', onMapDrag); // FIRE MAPDRAG
map.on('moveend', onMapDragEnd); // FIRE MAPDRAG END
$scope.clearPolylines = function(){
console.debug("********** Clear Polylines **********");
for(var i = 0; i < coordinates.length; i ++){
map.removeLayer(line._latlngs[i]);
console.error("[ CHECK LOOP ]", i +" "+coordinates.length);
console.log("[ DELETE LINES ]", line._latlngs[i]);
// coordinates.splice(i, 1); // REMOVE AN ITEM ON AN ARRAY
}
}
/* LOAD USER ON MAP WITH RADIUS */
var userLocated = false;
$scope.initializedLocateUser = function(){
console.debug("********** Initialized Location **********");
var posOptions = {enableHighAccuracy: true};
$cordovaGeolocation.getCurrentPosition(posOptions).then(function (position) {
map.setView(new L.LatLng(position.coords.latitude, position.coords.longitude), 15); // SET MAP VIEW
if(userLocated == false){
$scope.drawMarkers(position.coords.latitude, position.coords.longitude, 'Your current location'); // DRAW MARKERS
$scope.drawCircle(position.coords.latitude, position.coords.longitude); // DRAW CIRCLE RADIUS
userLocated = true;
}
else {
console.log("USER ALREADY LOCATED");
userLocated = true;
}
}, function(error) {
console.log("LOCATING ERROR ", error);
});
}
/* Calculate Distance between points */
$scope.getDistanceFromLatLonInKm = function(lat1,lon1,lat2,lon2) {
var R = 6371; // Radius of the earth in km
var dLat = deg2rad(lat2-lat1); // deg2rad function
var dLon = deg2rad(lon2-lon1);
var a = Math.sin(dLat/2) * Math.sin(dLat/2) + Math.cos(deg2rad(lat1)) * Math.cos(deg2rad(lat2)) * Math.sin(dLon/2) * Math.sin(dLon/2);
var c = 2 * Math.atan2(Math.sqrt(a), Math.sqrt(1-a));
var d = R * c; // Distance in km
console.log("[ DISTANCE BETWEEN COORDINDATES ]", d);
return d;
}
function deg2rad(deg) {
return deg * (Math.PI/180)
}
/* MAIN ALGORITHM */
var tripStatusRef = false;
$scope.getUserLocation = function(){
console.debug("********** Trip Location **********");
var posOptions = {enableHighAccuracy: true};
$cordovaGeolocation.getCurrentPosition(posOptions).then(function (position) {
console.log("[ CURRENT LOCATION ]", position.coords);
if(!tripStatusRef){
$scope.drawLineTrack(position.coords.latitude, position.coords.longitude); // INITIAL LINE ON TRIP
tripStatusRef = true;
}
// Filter Coordinates Distance Method
var locationData = {
lat: position.coords.latitude,
lng: position.coords.longitude
}
if(logCoordinates.length > 0) // CHECK IF ARAY IS EMPTY
{
if($scope.getDistanceFromLatLonInKm(locationData.lat, locationData.lng, logCoordinates[0].lat, logCoordinates[0].lng) > 0.03)
{
logCoordinates.splice(0, 0, locationData);
console.log("[ LOCATION ARRAY ]", logCoordinates);
$scope.drawLineTrack(position.coords.latitude, position.coords.longitude); // DRAW LINE ON TRIP
}
else
{
console.error("[ You need to be 500 meters away from your current position ]", logCoordinates);
}
}
else
{
logCoordinates.splice(0, 0, locationData);
console.log("[ INITIAL LOCATION ARRAY ]", logCoordinates);
}
}, function(error) {
console.error("GENERAL LOCATION ERROR ", error);
});
}
$scope.refreshMap = function(){
console.debug("********** Refresh Map **********");
if(userLocated == true){
map.removeLayer(markers);
map.removeLayer(circle);
map.removeLayer(geojsonLayer);
// map.removeLayer(line);
console.log("Map refreshed. Layers Removed");
userLocated = false;
}
$scope.initializedLocateUser();
$scope.clearPolylines();
}
/* CONFIRM TRIP DESTINATION */
$scope.confirmTripDestination = function(){
var tripPopup = $ionicPopup.show({
title: 'Trip Destination',
subTitle: 'Select your destination',
scope: $scope,
buttons: [
{
text: 'School',
type: 'button-dark button-outline',
onTap: function() {
localStorage.setItem("currentTrip", 'trip2');
$scope.tripStart();
console.log('Destination to School');
}
},
{
text: 'Home',
type: 'button-dark button-outline',
onTap: function() {
localStorage.setItem("currentTrip", 'trip1');
$scope.tripStart();
console.log('Destination to Home');
}
}
]
});
}
/* SET SEARCH BARANGAY */
$scope.BarangayList = {};
$scope.getAllBarangay = function(){
console.debug("******* GET ALL BARANGAY ******");
getBlazer.getAllBarangay().then(function(data){
$scope.BarangayList = data;
console.log("[ Barangay Data ]", JSON.stringify($scope.BarangayList));
});
}
$scope.selectedBarangayData = '';
$scope.currentBarangay = '';
$scope.currentBarangayTime = '';
$scope.onLoadSelection = function(){
$scope.data = {};
// An elaborate, custom popup
var myPopup = $ionicPopup.show({
template: '<label class="input-label">Barangay</label><label class="item item-input item-select"><div class="input-label"></div><select ng-model="data.selectedBarangay"><option ng-repeat = "barangay in BarangayList" value="{{barangay.name}}">{{barangay.name}}</option></select></label><label class="input-label">Time</label><label class="item item-input item-select"><div class="input-label"></div><select ng-model="data.selectedBarangayTime"><option value="AM">AM Trips</option><option value="PM">PM Trips</option></select></label>',
title: 'Select your Barangay',
subTitle: 'To view the most COMMON MODE of transportation in your barangay.',
scope: $scope,
buttons: [
{
text: 'Select',
type: 'button-dark button-outline',
onTap: function(e) {
console.log("[ SELECT DATA ]", $scope.data.selectedBarangay +" "+ $scope.data.selectedBarangayTime);
// LOAD MAP FUNCTIONS
$scope.selectedBarangayData = $scope.data.selectedBarangay +" "+ $scope.data.selectedBarangayTime;
$scope.currentBarangay = $scope.data.selectedBarangay;
$scope.currentBarangayTime = $scope.data.selectedBarangayTime;
$scope.data = {};
}
},
{
text: 'Cancel',
type: 'button-dark button-outline',
onTap: function(e) {
console.log("[ LOAD BARANGAY CANCELLED ]")
}
}
]
});
}
/* CHART JS DATA */
$scope.BarangayData = {};
$scope.loadBarangayData = function(){
console.debug("********** Get Barangay Data **********");
var barangayinfo = {
"barangay": $scope.currentBarangay,
"time": $scope.currentBarangayTime
};
postBlazer.BarangayInformation(barangayinfo)
.success(function(response) {
console.log(" BARANGAY SUCCESS", response);
$scope.BarangayData = response;
console.log('[ BARANGAY DETAILS ]', JSON.stringify($scope.BarangayData));
$scope.openChart($scope.BarangayData); // LOAD CHART MODAL
$scope.drawMarkers($scope.BarangayData.lat, $scope.BarangayData.lng, $scope.currentBarangay);
// RESET VALUES
$scope.selectedBarangayData = '';
$scope.currentBarangay = '';
$scope.currentBarangayTime = '';
})
.error(function(response) {
console.error("BARANGAY ERROR", response);
});
}
$scope.labels = ["Car", "Tricycle", "Pedicab", "Jeep", "Bus", "Van", "Walk", "Carpool", "Bicycle", "Train", "Taxi"];
// CLEAR HISTORY
$ionicHistory.clearHistory();
/* SIDE MENU TRIGGER */
$ionicSideMenuDelegate.canDragContent(false); // SET SIDE MENU DRAG FALSE
$scope.openMenu = function() {
$ionicSideMenuDelegate.toggleLeft();
}
/* MAP DEFAULTS */
// var map = new L.map('mapid', { center: new L.LatLng(14.5818, 120.9771), zoom: 12 });
// var googleLayer = new L.Google('ROADMAP');
// map.addLayer(googleLayer);
//GOOGLE MAP
var map = L.map('mapid');
map.setView(new L.LatLng(14.5818, 120.9771), 12);
//LEAFLET
L.tileLayer(maplayer, {
maxZoom: 18,
minZoom: 9,
attribution: '© OpenStreetMap contributors'
}).addTo(map);
/* MAP COMPONENTS */
var markers, circles, line;
$scope.drawMarkers = function(lat, lon, message) {
markers = new L.marker([lat, lon]).addTo(map);
markers.bindPopup(message).openPopup();
}
/* Draw Trip Marker */
$scope.drawTripMarkers = function(lat, lon) {
markers = new L.marker([lat, lon]).addTo(map);
markers.bindPopup('On Trip').openPopup();
}
/* Draw Radius */
$scope.drawCircle = function(lat, lon) {
circle = L.circle([lat, lon], 500, {
color: '',
fillColor: '#165c5b',
fillOpacity: 0.3
}).addTo(map);
}
var coordinates = []; // FOR DRAWN LINES
var logCoordinates = []; // FOR LOGGING TRIP
var setLatLng;
var coords;
$scope.drawLineTrack = function(lat, lon) {
var polylineOptions = {
color: '#185c82',
weight: 6,
opacity: 0.9
};
setLatLng = new L.LatLng(lat, lon); // USING LEAFLET LATLNG
coords = { lat, lon }; // USING SELF LATLNG
coordinates.push(coords);
console.log(coordinates);
line = new L.polyline(coordinates, polylineOptions);
// line.addTo(map);
map.addLayer(line);
// map.fitBounds(line.getBounds()); // zoom the map to the polyline
// REMOVE MARKERS
map.removeLayer(markers);
$scope.drawMarkers(lat, lon, 'On Trip'); // DRAW TRIP MARKER ]
}
/* EVENT LISTENERS */
$scope.mapButton = true;
function onMapDrag(e) {
$scope.mapButton = false;
console.log("Map Drag ", $scope.mapButton);
}
function onMapDragEnd(e) {
$scope.mapButton = true;
console.log("Map Drag ", $scope.mapButton);
}
map.on('move', onMapDrag); // FIRE MAPDRAG
map.on('moveend', onMapDragEnd); // FIRE MAPDRAG END
$scope.clearPolylines = function() {
console.debug("********** Clear Polylines **********");
for (var i = 0; i < coordinates.length; i++) {
map.removeLayer(line._latlngs[i]);
console.error("[ CHECK LOOP ]", i + " " + coordinates.length);
console.log("[ DELETE LINES ]", line._latlngs[i]);
// coordinates.splice(i, 1); // REMOVE AN ITEM ON AN ARRAY
}
}
/* LOAD USER ON MAP WITH RADIUS */
var userLocated = false;
$scope.initializedLocateUser = function() {
console.debug("********** Initialized Location **********");
var posOptions = { enableHighAccuracy: true };
$cordovaGeolocation.getCurrentPosition(posOptions).then(function(position) {
map.setView(new L.LatLng(position.coords.latitude, position.coords.longitude), 15); // SET MAP VIEW
if (userLocated == false) {
$scope.drawMarkers(position.coords.latitude, position.coords.longitude, 'Your current location'); // DRAW MARKERS
$scope.drawCircle(position.coords.latitude, position.coords.longitude); // DRAW CIRCLE RADIUS
userLocated = true;
} else {
console.log("USER ALREADY LOCATED");
userLocated = true;
}
}, function(error) {
console.log("LOCATING ERROR ", error);
});
}
/* Calculate Distance between points */
$scope.getDistanceFromLatLonInKm = function(lat1, lon1, lat2, lon2) {
var R = 6371; // Radius of the earth in km
var dLat = deg2rad(lat2 - lat1); // deg2rad function
var dLon = deg2rad(lon2 - lon1);
var a = Math.sin(dLat / 2) * Math.sin(dLat / 2) + Math.cos(deg2rad(lat1)) * Math.cos(deg2rad(lat2)) * Math.sin(dLon / 2) * Math.sin(dLon / 2);
var c = 2 * Math.atan2(Math.sqrt(a), Math.sqrt(1 - a));
var d = R * c; // Distance in km
console.log("[ DISTANCE BETWEEN COORDINDATES ]", d);
return d;
}
function deg2rad(deg) {
return deg * (Math.PI / 180)
}
/* MAIN ALGORITHM */
var tripStatusRef = false;
$scope.getUserLocation = function() {
console.debug("********** Trip Location **********");
var posOptions = { enableHighAccuracy: true };
$cordovaGeolocation.getCurrentPosition(posOptions).then(function(position) {
console.log("[ CURRENT LOCATION ]", position.coords);
if (!tripStatusRef) {
$scope.drawLineTrack(position.coords.latitude, position.coords.longitude); // INITIAL LINE ON TRIP
tripStatusRef = true;
}
// Filter Coordinates Distance Method
var locationData = {
lat: position.coords.latitude,
lng: position.coords.longitude
}
if (logCoordinates.length > 0) // CHECK IF ARAY IS EMPTY
{
if ($scope.getDistanceFromLatLonInKm(locationData.lat, locationData.lng, logCoordinates[0].lat, logCoordinates[0].lng) > 0.03) {
logCoordinates.splice(0, 0, locationData);
console.log("[ LOCATION ARRAY ]", logCoordinates);
$scope.drawLineTrack(position.coords.latitude, position.coords.longitude); // DRAW LINE ON TRIP
} else {
console.error("[ You need to be 500 meters away from your current position ]", logCoordinates);
}
} else {
logCoordinates.splice(0, 0, locationData);
console.log("[ INITIAL LOCATION ARRAY ]", logCoordinates);
}
}, function(error) {
console.error("GENERAL LOCATION ERROR ", error);
});
}
$scope.refreshMap = function() {
console.debug("********** Refresh Map **********");
if (userLocated == true) {
map.removeLayer(markers);
map.removeLayer(circle);
map.removeLayer(geojsonLayer);
// map.removeLayer(line);
console.log("Map refreshed. Layers Removed");
userLocated = false;
}
$scope.initializedLocateUser();
$scope.clearPolylines();
}
/* CONFIRM TRIP DESTINATION */
$scope.confirmTripDestination = function() {
var tripPopup = $ionicPopup.show({
title: 'Trip Destination',
subTitle: 'Select your destination',
scope: $scope,
buttons: [{
text: 'School',
type: 'button-dark button-outline',
onTap: function() {
localStorage.setItem("currentTrip", 'trip2');
$scope.tripStart();
console.log('Destination to School');
}
},
{
text: 'Home',
type: 'button-dark button-outline',
onTap: function() {
localStorage.setItem("currentTrip", 'trip1');
$scope.tripStart();
console.log('Destination to Home');
}
}
]
});
}
/* SET SEARCH BARANGAY */
$scope.BarangayList = {};
$scope.getAllBarangay = function() {
console.debug("******* GET ALL BARANGAY ******");
getBlazer.getAllBarangay().then(function(data) {
$scope.BarangayList = data;
console.log("[ Barangay Data ]", JSON.stringify($scope.BarangayList));
});
}
$scope.selectedBarangayData = '';
$scope.currentBarangay = '';
$scope.currentBarangayTime = '';
$scope.onLoadSelection = function() {
$scope.data = {};
// An elaborate, custom popup
var myPopup = $ionicPopup.show({
template: '<label class="input-label">Barangay</label><label class="item item-input item-select"><div class="input-label"></div><select ng-model="data.selectedBarangay"><option ng-repeat = "barangay in BarangayList" value="{{barangay.name}}">{{barangay.name}}</option></select></label><label class="input-label">Time</label><label class="item item-input item-select"><div class="input-label"></div><select ng-model="data.selectedBarangayTime"><option value="AM">AM Trips</option><option value="PM">PM Trips</option></select></label>',
title: 'Select your Barangay',
subTitle: 'To view the most COMMON MODE of transportation in your barangay.',
scope: $scope,
buttons: [{
text: 'Select',
type: 'button-dark button-outline',
onTap: function(e) {
console.log("[ SELECT DATA ]", $scope.data.selectedBarangay + " " + $scope.data.selectedBarangayTime);
// LOAD MAP FUNCTIONS
$scope.selectedBarangayData = $scope.data.selectedBarangay + " " + $scope.data.selectedBarangayTime;
$scope.currentBarangay = $scope.data.selectedBarangay;
$scope.currentBarangayTime = $scope.data.selectedBarangayTime;
$scope.data = {};
}
},
{
text: 'Cancel',
type: 'button-dark button-outline',
onTap: function(e) {
console.log("[ LOAD BARANGAY CANCELLED ]")
}
}
]
});
}
/* CHART JS DATA */
$scope.BarangayData = {};
$scope.loadBarangayData = function() {
console.debug("********** Get Barangay Data **********");
var barangayinfo = {
"barangay": $scope.currentBarangay,
"time": $scope.currentBarangayTime
};
postBlazer.BarangayInformation(barangayinfo)
.success(function(response) {
console.log(" BARANGAY SUCCESS", response);
$scope.BarangayData = response;
console.log('[ BARANGAY DETAILS ]', JSON.stringify($scope.BarangayData));
$scope.openChart($scope.BarangayData); // LOAD CHART MODAL
$scope.drawMarkers($scope.BarangayData.lat, $scope.BarangayData.lng, $scope.currentBarangay);
// RESET VALUES
$scope.selectedBarangayData = '';
$scope.currentBarangay = '';
$scope.currentBarangayTime = '';
})
.error(function(response) {
console.error("BARANGAY ERROR", response);
});
}
$scope.labels = ["Car", "Tricycle", "Pedicab", "Jeep", "Bus", "Van", "Walk", "Carpool", "Bicycle", "Train", "Taxi"];
$scope.data = [
[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
];
$scope.value = '';
$scope.loadValue = function(val){
$scope.value = val;
}
$ionicModal.fromTemplateUrl('app/map/modal/graph.html', {
scope: $scope,
animation: 'slide-in-up'
}).then(function(modal) {
$scope.modalChart = modal;
});
/* MODAL LISTENER */
$scope.$on('modal.hidden', function() {
console.log("Modal is Hidden");
$scope.labels = ["Car", "Tricycle", "Pedicab", "Jeep", "Bus", "Van", "Walk", "Carpool", "Bicycle", "Train", "Taxi"];
$scope.data = [
[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
];
});
$scope.openChart = function(data) {
$scope.modalChart.show();
console.log("[ CHART DATA ]", data);
$scope.labels = ["Car", "Tricycle", "Pedicab", "Jeep", "Bus", "Van", "Walk", "Carpool", "Bicycle", "Train", "Taxi"];
$scope.data = [
[data.car, data.tricycle, data.pedicab, data.jeep, data.bus, data.van, data.walk, data.carpool, data.bicycle, data.train, data.taxi]
];
};
$scope.closeChart = function() {
$scope.modalChart.hide();
};
/* START TRIP */
$scope.tripStatus = false;
var startTime, endTime;
var intervalTrigger;
userLocated = false;
$scope.tripStart = function(){
map.removeLayer(markers);
map.removeLayer(circle);
map.removeLayer(geojsonLayer);
$scope.tripStatus = true;
var newDate = new Date();
startTime = newDate.getTime();
localStorage.setItem("starttime", startTime);
console.log("START TRIP TIME", startTime);
$scope.getUserLocation();
intervalTrigger = $interval($scope.getUserLocation, 1000); // START FUNCTION CALL 'LOOP''
}
/* END TRIP */
$scope.tripEnd = function(){
/* CHECK IF MOBILE IS ONLINE */
console.log("[ NETWORK STATUS ]", $cordovaNetwork.getNetwork());
if($cordovaNetwork.getNetwork() == Connection.WIFI || $cordovaNetwork.getNetwork() == Connection.CELL_2G || $cordovaNetwork.getNetwork() == Connection.CELL_3G ||$cordovaNetwork.getNetwork() == Connection.CELL_4G){
$scope.tripStatus = false;
tripStatusRef = false;
var newDate = new Date();
var endTime = newDate.getTime();
localStorage.setItem("endtime", endTime);
console.log("END TRIP TIME", endTime);
// TRIGGER CLEAR FUNCTION OF REMOVE LINE -- NEEDS TO DEBUG
$scope.clearPolylines();
map.removeLayer(line); // REMOVE LINE TRACK
parsedData = []; // CLEAR BLAZER MARKER ARRAY
$interval.cancel(intervalTrigger); // CANCEL FUNCTION CALL
$scope.sendTrackingLocation(); // SEND LOCATION DATA
$scope.openEndTripSurvey(); // OPEN END TRIP SURVEY
}
else {
$cordovaDialogs.alert('You need to be ONLINE before ending this trip. Thank you.', 'Ooops', "OKAY");
}
}
/* SEND LOCATION DATA */
$scope.sendTrackingLocation = function(){
var username = localStorage.getItem("username");
console.debug("********** Send Tracking Location **********");
postBlazer.LogTrip(logCoordinates, username)
.success(function(response) {
console.log("LOG TRIP SUCCESS", response);
coordinates = [];
logCoordinates = [];
})
.error(function(response) {
console.error("LOG TRIP ERROR", response);
});
}
/* LOAD HEATMAP */
$scope.loadHeatMap = function(){
console.debug("********** Load Heat Map **********");
}
/* Show Blazers Data */
$scope.blazersData = {};
$scope.getBlazersData = function(){
getBlazer.getBlazerDataInfo().then(function(data){
$scope.blazersData = data;
console.log("[ Blazer Data ]", JSON.stringify($scope.blazersData));
$scope.plotBlazers();
});
}
/* Plot Blazers Data on Map */
var parsedData = [];
var geojsonLayer = [];
$scope.plotBlazers = function(){
console.debug("********** Plot Blazers on Map **********");
parsedData = [];
angular.forEach($scope.blazersData, function(value, key) {
console.log("[ VALUE SCOPE ]", JSON.stringify(value));
var formatData = {
"type": "Feature",
"properties": {
"username": "Anonymous Blazer",
},
"geometry": {
"type": "Point",
"coordinates": [value.longitude, value.latitude]
}
}
parsedData.push(formatData);
});
// Map Icon Options
// ICON
// var iconOptions = L.icon({
// iconUrl: 'img/mapicon.png',
// iconSize: [35, 37],
// iconAnchor: [18, 2]
// });
// POINTS
var iconOptions = {
radius: 8,
fillColor: "green",
color: "green",
weight: 1,
opacity: 1,
fillOpacity: 0.8
};
// PLOT DATA
function onEachFeature(feature, layer)
{
if (feature.properties && feature.properties.username)
{
layer.bindPopup('<div class="pop-up-containter">Blazer</h4><div style="font-size: 15px">'+feature.properties.username+'</div></div>');
}
}
geojsonLayer = L.geoJson(parsedData, {
onEachFeature: onEachFeature,
pointToLayer: function (feature, latlng) {
return L.circleMarker(latlng, iconOptions);
}
}).addTo(map);
map.fitBounds(geojsonLayer.getBounds());
}
/* Weekly Survey Call */
$scope.loadWeeklySurvey = function(){
console.debug("********** Open Weekly Survey **********");
var newDate = new Date();
var currentDate = $filter('date')(newDate, 'yyyyMMww');
var dayToday = $filter('date')(newDate, 'EEEE');
console.log("[ Date Today ]" , currentDate);
if(dayToday == 'Friday' || dayToday == 'Saturday'){
if(localStorage.getItem(currentDate) === null){
var tripPopup = $ionicPopup.show({
title: 'Hey it\'s '+dayToday+'!',
subTitle: 'Take the weekly survey. You are awesome!',
scope: $scope,
buttons: [
{
text: 'Let\s go!',
type: 'button-dark button-outline',
onTap: function(e) {
console.log("[ TAKE WEEKLY SURVEY ]");
$scope.openWeeklySurvey();
}
},
{
text: 'Later',
type: 'button-dark button-outline',
onTap: function(e) {
console.log("[ NO WEEKLY SURVEY ]")
}
}
]
});
}
}
}
$scope.triggerWeeklySurvey = function(){
console.debug("********** Trigger Weekly Survey **********");
var newDate = new Date();
var currentDate = $filter('date')(newDate, 'yyyyMMww');
var dayToday = $filter('date')(newDate, 'EEEE');
console.log("[ Date Today ]" , currentDate);
if(localStorage.getItem(currentDate) === null){
var tripPopup = $ionicPopup.show({
title: 'Hey it\'s '+dayToday+'!',
subTitle: 'Take the weekly survey. You are awesome!',
scope: $scope,
buttons: [
{
text: 'Let\s go!',
type: 'button-dark button-outline',
onTap: function(e) {
console.log("[ TAKE WEEKLY SURVEY ]");
$scope.openWeeklySurvey();
}
},
{
text: 'Later',
type: 'button-dark button-outline',
onTap: function(e) {
console.log("[ NO WEEKLY SURVEY ]")
}
}
]
});
}
else {
$cordovaDialogs.alert('You\'ve already taken this weeks\' weekly survey. Thank you.', 'Weekly Survey', "OKAY");
}
}
/* Popover Methods */
$ionicPopover.fromTemplateUrl('app/map/popover/map-popover.html', {
scope: $scope
}).then(function(popover) {
$scope.popover = popover;
});
$scope.openPopover = function($event) {
$scope.popover.show($event);
console.log("OPEN POPOVER");
};
$scope.closePopover = function() {
$scope.popover.hide();
};
$scope.$on('$destroy', function() {
$scope.popover.remove();
});
// EndTrip Modal
$ionicModal.fromTemplateUrl('app/survey/endtrip.html', {
scope: $scope,
animation: 'slide-in-up'
}).then(function(modal) {
$scope.modalEndTrip = modal;
});
$scope.openEndTripSurvey = function() {
$scope.modalEndTrip.show();
};
// Weekly Survey Modal
$ionicModal.fromTemplateUrl('app/survey/weekly.html', {
scope: $scope,
animation: 'slide-in-up'
}).then(function(modal) {
$scope.modalWeeklyTrip = modal;
});
$scope.openWeeklySurvey = function() {
$scope.modalWeeklyTrip.show();
};
$scope.value = '';
$scope.loadValue = function(val) {
$scope.value = val;
}
$ionicModal.fromTemplateUrl('app/map/modal/graph.html', {
scope: $scope,
animation: 'slide-in-up'
}).then(function(modal) {
$scope.modalChart = modal;
});
/* MODAL LISTENER */
$scope.$on('modal.hidden', function() {
console.log("Modal is Hidden");
$scope.labels = ["Car", "Tricycle", "Pedicab", "Jeep", "Bus", "Van", "Walk", "Carpool", "Bicycle", "Train", "Taxi"];
$scope.data = [
[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
];
});
$scope.openChart = function(data) {
$scope.modalChart.show();
console.log("[ CHART DATA ]", data);
$scope.labels = ["Car", "Tricycle", "Pedicab", "Jeep", "Bus", "Van", "Walk", "Carpool", "Bicycle", "Train", "Taxi"];
$scope.data = [
[data.car, data.tricycle, data.pedicab, data.jeep, data.bus, data.van, data.walk, data.carpool, data.bicycle, data.train, data.taxi]
];
};
$scope.closeChart = function() {
$scope.modalChart.hide();
};
/* START TRIP */
$scope.tripStatus = false;
var startTime, endTime;
var intervalTrigger;
userLocated = false;
$scope.tripStart = function() {
map.removeLayer(markers);
map.removeLayer(circle);
map.removeLayer(geojsonLayer);
$scope.tripStatus = true;
var newDate = new Date();
startTime = newDate.getTime();
localStorage.setItem("starttime", startTime);
console.log("START TRIP TIME", startTime);
$scope.getUserLocation();
intervalTrigger = $interval($scope.getUserLocation, 1000); // START FUNCTION CALL 'LOOP''
}
/* END TRIP */
$scope.tripEnd = function() {
/* CHECK IF MOBILE IS ONLINE */
console.log("[ NETWORK STATUS ]", $cordovaNetwork.getNetwork());
if ($cordovaNetwork.getNetwork() == Connection.WIFI || $cordovaNetwork.getNetwork() == Connection.CELL_2G || $cordovaNetwork.getNetwork() == Connection.CELL_3G || $cordovaNetwork.getNetwork() == Connection.CELL_4G) {
$scope.tripStatus = false;
tripStatusRef = false;
var newDate = new Date();
var endTime = newDate.getTime();
localStorage.setItem("endtime", endTime);
console.log("END TRIP TIME", endTime);
// TRIGGER CLEAR FUNCTION OF REMOVE LINE -- NEEDS TO DEBUG
$scope.clearPolylines();
map.removeLayer(line); // REMOVE LINE TRACK
parsedData = []; // CLEAR BLAZER MARKER ARRAY
$interval.cancel(intervalTrigger); // CANCEL FUNCTION CALL
$scope.sendTrackingLocation(); // SEND LOCATION DATA
$scope.openEndTripSurvey(); // OPEN END TRIP SURVEY
} else {
$cordovaDialogs.alert('You need to be ONLINE before ending this trip. Thank you.', 'Ooops', "OKAY");
}
}
/* SEND LOCATION DATA */
$scope.sendTrackingLocation = function() {
var username = localStorage.getItem("username");
console.debug("********** Send Tracking Location **********");
postBlazer.LogTrip(logCoordinates, username)
.success(function(response) {
console.log("LOG TRIP SUCCESS", response);
coordinates = [];
logCoordinates = [];
})
.error(function(response) {
console.error("LOG TRIP ERROR", response);
});
}
/* LOAD HEATMAP */
$scope.loadHeatMap = function() {
console.debug("********** Load Heat Map **********");
}
/* Show Blazers Data */
$scope.blazersData = {};
$scope.getBlazersDataV2 = function() {
getBlazer.getMapData().then(function(data) {
$scope.blazersData = data;
console.log("[ Blazer Data V2 ]", JSON.stringify($scope.blazersData));
$scope.plotBlazers();
});
}
/* Show Blazers Data */
$scope.blazersData = {};
$scope.getBlazersData = function() {
getBlazer.getBlazerDataInfo().then(function(data) {
$scope.blazersData = data;
console.log("[ Blazer Data ]", JSON.stringify($scope.blazersData));
$scope.plotBlazers();
});
}
/* Plot Blazers Data on Map */
var parsedData = [];
var geojsonLayer = [];
$scope.plotBlazers = function() {
console.debug("********** Plot Blazers on Map **********");
parsedData = [];
angular.forEach($scope.blazersData, function(value, key) {
console.log("[ VALUE SCOPE ]", JSON.stringify(value));
var formatData = {
"type": "Feature",
"properties": {
"barangay_name": value.barangay_name,
"blazer_count": value.blazer_count,
"car_percentage": value.car_percentage,
},
"geometry": {
"type": "Point",
"coordinates": [value.lon, value.lat]
}
}
parsedData.push(formatData);
});
// PLOT DATA
function onEachFeature(feature, layer) {
if (feature.properties && feature.properties.barangay_name) {
layer.bindPopup('<div class="pop-up-containter">' + feature.properties.barangay_name + '</div>');
}
}
/*
The colors refer to the car percentage. If car percentage is above 50%, the color is shades of red (the redder, the closer to 100% car percentage). Yellow is 50%. Below 50%, then shades of green. Very green means 0% car use.
*/
/*
The size refers to the blazer count. If blaze count <= 20, then, small. If blazer count is more than or equal to 50, then size is big. Medium is between 20 and 50.
*/
geojsonLayer = L.geoJson(parsedData, {
onEachFeature: onEachFeature,
pointToLayer: function(feature, latlng) {
var circle_radius = '';
var circle_fill = '';
var circle_opacity = '';
// RADIUS SETTER
if (parseInt(feature.properties.blazer_count) >= 50) {
console.log("BIG");
circle_radius = 500;
} else if (parseInt(feature.properties.blazer_count) < 50 && parseInt(feature.properties.blazer_count) > 20) {
console.log("MEDIUM");
circle_radius = 250;
} else if (parseInt(feature.properties.blazer_count) <= 20) {
console.log("SMALL");
circle_radius = 100;
}
// COLOR SETTER
if (feature.properties.car_percentage > 80) {
console.log("RED");
circle_fill = "red";
circle_opacity = 0.8;
} else if (feature.properties.car_percentage > 50 && feature.properties.car_percentage <= 80) {
console.log("LIGHT RED");
circle_fill = "red";
circle_opacity = 0.3;
} else if (feature.properties.car_percentage <= 50 && feature.properties.car_percentage >= 30) {
console.log("YELLOW");
circle_fill = "yellow";
circle_opacity = 0.8;
} else if (feature.properties.car_percentage < 30 && feature.properties.car_percentage >= 20) {
console.log("LIGHT YELLOW");
circle_fill = "yellow";
circle_opacity = 0.3;
} else if (feature.properties.car_percentage < 20) {
circle_fill = "green";
circle_opacity = 0.8;
}
// return L.circleMarker(latlng, iconOptions);
return L.circle(latlng, circle_radius, {
color: '',
fillColor: circle_fill,
fillOpacity: circle_opacity,
})
}
}).addTo(map);
map.fitBounds(geojsonLayer.getBounds());
}
/* Weekly Survey Call */
$scope.loadWeeklySurvey = function() {
console.debug("********** Open Weekly Survey **********");
var newDate = new Date();
var currentDate = $filter('date')(newDate, 'yyyyMMww');
var dayToday = $filter('date')(newDate, 'EEEE');
console.log("[ Date Today ]", currentDate);
if (dayToday == 'Friday' || dayToday == 'Saturday' || dayToday == 'Sunday') {
if (localStorage.getItem(currentDate) === null) {
var tripPopup = $ionicPopup.show({
title: 'Hey it\'s ' + dayToday + '!',
subTitle: 'Take the weekly survey. You are awesome!',
scope: $scope,
buttons: [{
text: 'Let\s go!',
type: 'button-dark button-outline',
onTap: function(e) {
console.log("[ TAKE WEEKLY SURVEY ]");
$scope.openWeeklySurvey();
}
},
{
text: 'Later',
type: 'button-dark button-outline',
onTap: function(e) {
console.log("[ NO WEEKLY SURVEY ]")
}
}
]
});
}
}
}
$scope.triggerWeeklySurvey = function() {
console.debug("********** Trigger Weekly Survey **********");
var newDate = new Date();
var currentDate = $filter('date')(newDate, 'yyyyMMww');
var dayToday = $filter('date')(newDate, 'EEEE');
console.log("[ Date Today ]", currentDate);
if (dayToday == 'Friday' || dayToday == 'Saturday' || dayToday == 'Sunday') {
if (localStorage.getItem(currentDate) === null) {
var tripPopup = $ionicPopup.show({
title: 'Hey it\'s ' + dayToday + '!',
subTitle: 'Take the weekly survey. You are awesome!',
scope: $scope,
buttons: [{
text: 'Let\s go!',
type: 'button-dark button-outline',
onTap: function(e) {
console.log("[ TAKE WEEKLY SURVEY ]");
$scope.openWeeklySurvey();
}
},
{
text: 'Later',
type: 'button-dark button-outline',
onTap: function(e) {
console.log("[ NO WEEKLY SURVEY ]")
}
}
]
});
} else {
$cordovaDialogs.alert('You\'ve already taken this weeks\' weekly survey. Thank you.', 'Weekly Survey', "OKAY");
}
} else {
console.log("Cannot Take Survey Today");
$cordovaDialogs.alert('Sorry. But you may only take the weekly survey on Friday, Saturday, or Sunday. Thank you.', 'Weekly Survey', "OKAY");
}
}
/* Popover Methods */
$ionicPopover.fromTemplateUrl('app/map/popover/map-popover.html', {
scope: $scope
}).then(function(popover) {
$scope.popover = popover;
});
$scope.openPopover = function($event) {
$scope.popover.show($event);
console.log("OPEN POPOVER");
};
$scope.closePopover = function() {
$scope.popover.hide();
};
$scope.$on('$destroy', function() {
$scope.popover.remove();
});
// EndTrip Modal
$ionicModal.fromTemplateUrl('app/survey/endtrip.html', {
scope: $scope,
animation: 'slide-in-up'
}).then(function(modal) {
$scope.modalEndTrip = modal;
});
$scope.openEndTripSurvey = function() {
$scope.modalEndTrip.show();
};
// Weekly Survey Modal
$ionicModal.fromTemplateUrl('app/survey/weekly_v2.html', {
scope: $scope,
animation: 'slide-in-up'
}).then(function(modal) {
$scope.modalWeeklyTrip = modal;
});
$scope.openWeeklySurvey = function() {
$scope.modalWeeklyTrip.show();
};
});
\ No newline at end of file
<ion-view view-title="BLAZE" ng-init="initializedLocateUser();loadWeeklySurvey();getAllBarangay();">
<ion-nav-buttons side="left">
<button ng-click="openMenu()" class="button button-icon ion-android-menu" ng-disabled="tripStatus"></button>
</ion-nav-buttons>
<ion-nav-buttons side="right">
<button ng-click="openPopover($event);" class="button button-icon ion-android-apps" ng-disabled="tripStatus"></button>
</ion-nav-buttons>
<ion-nav-buttons side="left">
<button ng-click="openMenu()" class="button button-icon ion-android-menu" ng-disabled="tripStatus"></button>
</ion-nav-buttons>
<ion-nav-buttons side="right">
<button ng-click="openPopover($event);" class="button button-icon ion-android-apps" ng-disabled="tripStatus"></button>
</ion-nav-buttons>
<ion-floating-button style='opacity: 0.8;'' click="refreshMap();" has-footer="true" button-color="#333333" icon="ion-android-refresh" icon-color="#fff" ng-hide="tripStatus">
</ion-floating-button>
<ion-floating-button style='opacity: 0.8;' click="refreshMap();" has-footer="true" button-color="#333333" icon="ion-android-refresh" icon-color="#fff" ng-hide="tripStatus">
</ion-floating-button>
<div class="bar bar-subheader bar-clear darkblue item-input-inset">
<a class="item-input-wrapper" ng-click="onLoadSelection();">
<i class="icon ion-ios-search placeholder-icon"></i>
<input type="text" placeholder="Search Barangay" ng-model="selectedBarangayData" disabled>
</a>
<button class="button button-stable" style="color: #000000;" ng-click="loadBarangayData();" ng-disabled="!selectedBarangayData">
<div class="bar bar-subheader bar-clear darkblue item-input-inset">
<a class="item-input-wrapper" ng-click="onLoadSelection();">
<i class="icon ion-ios-search placeholder-icon"></i>
<input type="text" placeholder="Search Barangay" ng-model="selectedBarangayData" disabled>
</a>
<button class="button button-stable" style="color: #000000;" ng-click="loadBarangayData();" ng-disabled="!selectedBarangayData">
Show
</button>
</div>
</div>
<ion-content class="has-subheader" data-tap-disabled="true">
<div id="mapid"></div>
</ion-content>
<ion-content class="has-subheader" data-tap-disabled="true">
<div id="mapid"></div>
</ion-content>
<ion-footer-bar align-title="center" class="bar bar-clear darkblue">
<div class="button-bar">
<div class="button-bar" ng-if="!tripStatus">
<button ng-click="confirmTripDestination();" class="button button-icon ion-android-arrow-dropright-circle light"> Start Trip</button>
</div>
<div class="button-bar" ng-if="tripStatus">
<button ng-click="tripEnd();" class="button button-icon ion-android-cancel stable"> Stop Trip</button>
</div>
</div>
</ion-footer-bar>
<ion-footer-bar align-title="center" class="bar bar-clear darkblue">
<div class="button-bar">
<div class="button-bar" ng-if="!tripStatus">
<button ng-click="confirmTripDestination();" class="button button-icon ion-android-arrow-dropright-circle light"> Start Trip</button>
</div>
<div class="button-bar" ng-if="tripStatus">
<button ng-click="tripEnd();" class="button button-icon ion-android-cancel stable"> Stop Trip</button>
</div>
</div>
</ion-footer-bar>
</ion-view>
</ion-view>
\ No newline at end of file
<ion-popover-view class="fit">
<ion-content scroll="false">
<div class="list">
<a ng-click="getBlazersData();closePopover($event);" class="item item-icon-left">
<i class="icon ion-android-pin"></i>
Show Blazers
</a>
<!--<a ng-click="loadHeatMap();" class="item item-icon-left">
<i class="icon ion-android-pin"></i>
Load Heatmap
</a>-->
<a ng-click="triggerWeeklySurvey();closePopover($event);" class="item item-icon-left">
<i class="icon ion-android-clipboard"></i>
Weekly Survey
</a>
</div>
</ion-content>
</ion-popover-view>
<ion-content scroll="false">
<div class="list">
<a ng-click="getBlazersDataV2();closePopover($event);" class="item item-icon-left">
<i class="icon ion-android-pin"></i> Show Blazers
</a>
<a ng-click="triggerWeeklySurvey();closePopover($event);" class="item item-icon-left">
<i class="icon ion-android-clipboard"></i> Weekly Survey
</a>
</div>
</ion-content>
</ion-popover-view>
\ No newline at end of file
<ion-side-menus enable-menu-with-back-views="false">
<ion-side-menu-content>
<ion-nav-bar class="bar bar-clear darkblue">
<ion-nav-back-button>
</ion-nav-back-button>
<ion-nav-buttons side="left">
<button class="button button-clear button-icon button-clear ion-android-menu" menu-toggle="left"></button>
</ion-nav-buttons>
</ion-nav-bar>
<ion-nav-view name="menuContent"></ion-nav-view>
</ion-side-menu-content>
<ion-side-menu side="left" width="220">
<ion-content class="darkSide">
<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/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/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/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/settings" class="item-icon item-icon-left"><i class="icon ion-android-settings"></i>Settings</ion-item>
</ion-content>
</ion-side-menu>
</ion-side-menus>
<ion-side-menu-content>
<ion-nav-bar class="bar bar-clear darkblue">
<ion-nav-back-button>
</ion-nav-back-button>
<ion-nav-buttons side="left">
<button class="button button-clear button-icon button-clear ion-android-menu" menu-toggle="left"></button>
</ion-nav-buttons>
</ion-nav-bar>
<ion-nav-view name="menuContent"></ion-nav-view>
</ion-side-menu-content>
<ion-side-menu side="left" width="220">
<ion-content class="darkSide">
<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/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/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/diary" class="item-icon item-icon-left"><i class="icon ion-bookmark"></i>My Trip Diary</ion-item>
<!--<ion-item nav-clear menu-close href="#/app/status" class="item-icon item-icon-left"><i class="icon ion-edit"></i>Trip Logging</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/settings" class="item-icon item-icon-left"><i class="icon ion-android-settings"></i>Settings</ion-item>
</ion-content>
</ion-side-menu>
</ion-side-menus>
\ No newline at end of file
<ion-view view-title="Offer a Ride" ng-init="getUserLocation();">
<ion-nav-buttons side="right">
<!--<button class="button button-clear button-light" ng-click="resetOfferRide();" ng-disabled="setPosition == true">Referesh</button>-->
</ion-nav-buttons>
<ion-content data-tap-disabled="false">
<form name="offerride">
<div class="item item-divider"> Offer Ride </div>
<p class="text-dark note-style"><b>Note: </b> Drag the marker to a specific point of Destination.</p>
<div class="item item-divider item-light"> Destination </div>
<!--<label class="item item-input">
<ion-nav-buttons side="right">
<!--<button class="button button-clear button-light" ng-click="resetOfferRide();" ng-disabled="setPosition == true">Referesh</button>-->
</ion-nav-buttons>
<ion-content data-tap-disabled="false">
<form name="offerride">
<div class="item item-divider"> Offer Ride </div>
<p class="text-dark note-style"><b>Note: </b> Drag the marker to a specific point of Destination.</p>
<div class="item item-divider item-light"> Destination </div>
<!--<label class="item item-input">
<input type="text" placeholder="Destination Address" location-suggestion location="location" ng-model="location.formatted_address">
</label>-->
<div id="mapdestination"></div>
<p class="text-dark note-style"><b>Note: </b> Drag the marker to a specific Pick-up Location.</p>
<div class="item item-divider item-light"> Pick-up Location (specify) </div>
<div id="mappickup"></div>
<div class="item item-stacked-label" ion-datetime-picker am-pm ng-model="offer.assembly" required>
<span class="input-label">Date and Time</span>
<p>{{offer.assembly| date: "MMMM dd, yyyy 'at' H:mm:ss a"}}</p>
</div>
<label class="item item-input item-stacked-label border-bottom-select">
<div id="mapdestination"></div>
<p class="text-dark note-style"><b>Note: </b> Drag the marker to a specific Pick-up Location.</p>
<div class="item item-divider item-light"> Pick-up Location (specify) </div>
<div id="mappickup"></div>
<div class="item item-stacked-label" ion-datetime-picker am-pm ng-model="offer.assembly" required>
<span class="input-label">Date and Time</span>
<p>{{offer.assembly| date: "MMMM dd, yyyy 'at' H:mm:ss a"}}</p>
</div>
<label class="item item-input item-stacked-label border-bottom-select">
<span class="input-label"> Car Brand</span>
</label>
<label class="item item-input item-select border-top">
<label class="item item-input item-select border-top">
<div class="input-label">
&nbsp;
</div>
......@@ -70,14 +70,14 @@
<option value="Volvo">Volvo</option>
</select>
</label>
<label class="item item-input item-stacked-label">
<label class="item item-input item-stacked-label">
<span class="input-label">Plate Number</span>
<input type="text" ng-model="offer.platenumber" placeholder="ABC123 or ABCD123" max-length="8" ng-maxlength="7" required/>
</label>
<label class="item item-input item-stacked-label border-bottom-select">
<label class="item item-input item-stacked-label border-bottom-select">
<span class="input-label"> Capacity</span>
</label>
<label class="item item-input item-select border-top">
<label class="item item-input item-select border-top">
<div class="input-label">
&nbsp;
</div>
......@@ -98,19 +98,19 @@
<option value="15">15 Seater</option>
</select>
</label>
<label class="item item-input item-stacked-label">
<label class="item item-input item-stacked-label">
<span class="input-label">Mobile Number</span>
<input type="number" ng-model="offer.mobile" placeholder="(09)** *** ****" maxlength="11" ng-maxlength="11" required/>
</label>
<label class="item item-input item-stacked-label">
<label class="item item-input item-stacked-label">
<span class="input-label"> Other Details</span>
<textarea type="text" placeholder="Fuel contribution" ng-model="offer.notes" style="height: 100px;"></textarea>
</label>
<div class="padding">
<button class="button button-block button-dark button-outline" ng-disabled="offerride.$invalid" ng-click="offerRide(location);">
<div class="padding">
<button class="button button-block button-dark button-outline" ng-disabled="offerride.$invalid" ng-click="offerRide(location);">
Offer Ride
</button>
</div>
</form>
</ion-content>
</div>
</form>
</ion-content>
</ion-view>
\ No newline at end of file
<ion-view view-title="My Travel Stats" ng-init="getTravelStats();">
<ion-nav-buttons side="right">
</ion-nav-buttons>
<ion-content>
<ion-refresher pulling-text="Pull to refresh" on-refresh="getTravelStats();"></ion-refresher>
<div class="list">
<div class="item item-divider"> Mode of Use </div>
<div class="item">
<i class="button button-block button-clear bgbluegreen text-light">Latest</i>
<i class="button button-block icon-left ion-android-car"><b>{{ blazersStats.mode_latest }}</b></i>
<i class="button button-block icon-left ion-android-bulb"><b>{{ blazersStats.emo_latest }}</b></i>
<!--<i class="button button-block icon-left ion-android-time"><b>{{blazersStats.time_latest}}</b></i>-->
</div>
<div class="item">
<i class="button button-block button-clear bgbluegreen text-light">Frequently Used</i>
<i class="button button-block icon-left ion-android-car"><b>{{ blazersStats.mode_frequent }}</b></i>
<i class="button button-block icon-left ion-android-bulb"><b>{{ blazersStats.emo_frequent }}</b></i>
<!--<i class="button button-block icon-left ion-android-time"><b>{{blazersStats.time_average}}</b></i>-->
</div>
<div class="item">
<i class="button button-block button-clear bgbluegreen text-light">Low-Carbon</i>
<i class="button button-block icon-left ion-android-car"><b>{{ blazersStats.mode_best }}</b></i>
<i class="button button-block icon-left ion-android-bulb"><b>{{ blazersStats.emo_frequent_positive }}</b></i>
<!--<i class="button button-block icon-left ion-android-time"><b>{{blazersStats.time_best}}</b></i>-->
</div>
<!--<div class="item item-thumbnail-left item-borderless">
<img ng-src="img/info.png">
<i> Latest </i>
<p>Transportation: <i ng-if="!blazersStats.mode_latest">NULL</i>{{ blazersStats.mode_latest }}</p>
<p>Mood: <i ng-if="!blazersStats.emo_latest">NULL</i>{{ blazersStats.emo_latest }}</p>
</div>
<div class="item item-thumbnail-left item-borderless">
<img ng-src="img/info.png">
<i>Frequently Used</i>
<p>Transportation: <i ng-if="!blazersStats.mode_frequent">NULL</i>{{ blazersStats.mode_frequent }}</p>
<p>Mood: <i ng-if="!blazersStats.emo_frequent">NULL</i>{{ blazersStats.emo_frequent }}</p>
</div>
<div class="item item-thumbnail-left item-borderless">
<img ng-src="img/info.png">
<i>Low-Carbon</i>
<p>Transportation: <i ng-if="!blazersStats.mode_best">NULL</i>{{ blazersStats.mode_best }}</p>
<p>Mood: <i ng-if="!blazersStats.emo_frequent_positive">NULL</i>{{ blazersStats.emo_frequent_positive }}</p>
</div>-->
<div class="item item-divider"> Time </div>
<div class="item">
<i class="button button-block button-clear bgbluegreen text-light">Latest</i>
<i class="button button-block icon-left ion-android-time"><b>{{ blazersStats.time_latest }}</b></i>
</div>
<div class="item">
<i class="button button-block button-clear bgbluegreen text-light">Average</i>
<i class="button button-block icon-left ion-android-time"><b>{{ blazersStats.time_average }}</b></i>
</div>
<div class="item">
<i class="button button-block button-clear bgbluegreen text-light">Best</i>
<i class="button button-block icon-left ion-android-time"><b>{{ blazersStats.time_best }}</b></i>
</div>
<!--<div class="item item-borderless item-icon-left">
<i class="icon ion-android-wifi"></i>
Latest
<span class="item-note"> <i ng-if="!blazersStats.time_latest">NULL</i>{{ blazersStats.time_latest }} </span>
</div>
<div class="item item-borderless item-icon-left">
<i class="icon ion-android-wifi"></i>
Average
<span class="item-note"> <i ng-if="!blazersStats.time_average">NULL</i>{{ blazersStats.time_average }} </span>
</div>
<div class="item item-borderless item-icon-left">
<i class="icon ion-android-wifi"></i>
Best
<span class="item-note"> <i ng-if="!blazersStats.time_best">NULL</i>{{ blazersStats.time_best }} </span>
</div>-->
</div>
</ion-content>
</ion-view>
<ion-nav-buttons side="right">
</ion-nav-buttons>
<ion-content>
<ion-refresher pulling-text="Pull to refresh" on-refresh="getTravelStats();"></ion-refresher>
<div class="list card">
<div class="item item-divider"> Mode of Use </div>
<div class="item">
<i class="button button-block button-clear bgbluegreen text-light">Latest</i>
<i class="button button-block icon-left ion-android-car"><b>{{ blazersStats.mode_latest }}</b></i>
<i class="button button-block icon-left ion-android-bulb"><b>{{ blazersStats.emo_latest }}</b></i>
<!--<i class="button button-block icon-left ion-android-time"><b>{{blazersStats.time_latest}}</b></i>-->
</div>
<div class="item">
<i class="button button-block button-clear bgbluegreen text-light">Frequently Used</i>
<i class="button button-block icon-left ion-android-car"><b>{{ blazersStats.mode_frequent }}</b></i>
<i class="button button-block icon-left ion-android-bulb"><b>{{ blazersStats.emo_frequent }}</b></i>
</div>
<div class="item">
<i class="button button-block button-clear bgbluegreen text-light">Low-Carbon</i>
<i class="button button-block icon-left ion-android-car"><b>{{ blazersStats.mode_best }}</b></i>
<i class="button button-block icon-left ion-android-bulb"><b>{{ blazersStats.emo_frequent_positive }}</b></i>
</div>
</div>
<div class="list card">
<div class="item item-divider"> Time </div>
<div class="item">
<i class="button button-block button-clear bgbluegreen text-light">Latest</i>
<i class="button button-block icon-left ion-android-time"><b>{{ blazersStats.time_latest }}</b></i>
</div>
<div class="item">
<i class="button button-block button-clear bgbluegreen text-light">Average</i>
<i class="button button-block icon-left ion-android-time"><b>{{ blazersStats.time_average }}</b></i>
</div>
<div class="item">
<i class="button button-block button-clear bgbluegreen text-light">Best</i>
<i class="button button-block icon-left ion-android-time"><b>{{ blazersStats.time_best }}</b></i>
</div>
</div>
</ion-content>
</ion-view>
\ No newline at end of file
......@@ -2,260 +2,241 @@ angular.module('blazer.surveycontrollers', [])
.controller('SurveyCtrl', function($scope, $ionicModal, $filter, $ionicSlideBoxDelegate, $ionicScrollDelegate, postBlazer, $cordovaNetwork, $cordovaDialogs) {
$scope.closeEndTripModal = function() {
$scope.modalEndTrip.hide();
};
$scope.closeWeeklyModal = function() {
$scope.modalWeeklyTrip.hide();
};
$scope.endtrip = {};
$scope.postEndTripSurvey = function(){
/* CHECK IF MOBILE IS ONLINE */
console.log("[ NETWORK STATUS ]", $cordovaNetwork.getNetwork());
if($cordovaNetwork.getNetwork() == Connection.WIFI || $cordovaNetwork.getNetwork() == Connection.CELL_2G || $cordovaNetwork.getNetwork() == Connection.CELL_3G ||$cordovaNetwork.getNetwork() == Connection.CELL_4G){
var tripID = localStorage.getItem("tripid");
var username = localStorage.getItem("username");
var startTime = localStorage.getItem("starttime");
var endTime = localStorage.getItem("endtime");
var newDate = new Date();
var timeStamp = newDate.getTime();
var currentTrip = localStorage.getItem("currentTrip");
var postdata = {
"trip_id" : tripID,
"username": username,
"depart": startTime,
"arrive": endTime,
"mode": $scope.endtrip.mode,
"exp": $scope.endtrip.overallxp,
"emotion": $scope.endtrip.emotion,
"type": currentTrip
}
console.log("[ POST END TRIP SURVEY ]");
postBlazer.EndTripSurvey(postdata)
.success(function(response) {
$scope.closeEndTripModal();
$scope.endtrip = {};
console.log("SEND ENDTRIP SURVEY SUCCESS", response);
})
.error(function(response) {
$scope.closeEndTripModal();
$scope.endtrip = {};
console.error("SEND ENDTRIP SURVEY ERROR", response);
});
}
else {
$cordovaDialogs.alert('Network Connection is required before taking this action. Thank you!', 'Ooops', "OKAY");
}
}
$scope.disableSwipe = function() {
$ionicSlideBoxDelegate.enableSlide(false);
};
$scope.currentIndex = '';
$scope.backSlide = function(){
$ionicScrollDelegate.scrollTop(true);
$ionicSlideBoxDelegate.previous();
$scope.currentIndex = $ionicSlideBoxDelegate.currentIndex();
}
$scope.nextPageSlide = function(){
$ionicScrollDelegate.scrollTop(true);
$ionicSlideBoxDelegate.next();
$scope.currentIndex = $ionicSlideBoxDelegate.currentIndex();
}
$scope.weekly = {};
$scope.postWeeklySurvey = function(){
console.log("[ NETWORK STATUS ]", $cordovaNetwork.getNetwork());
if($cordovaNetwork.getNetwork() == Connection.WIFI || $cordovaNetwork.getNetwork() == Connection.CELL_2G || $cordovaNetwork.getNetwork() == Connection.CELL_3G ||$cordovaNetwork.getNetwork() == Connection.CELL_4G){
var userID = localStorage.getItem("userID");
var username = localStorage.getItem("username");
var newDate = new Date();
var currentDate = $filter('date')(newDate, 'yyyyMMww');
var dayToday = $filter('date')(newDate, 'EEEE');
var dateCreated = $filter('date')(newDate, 'yyyy - MM - dd HH: mm: ss');
var surveyAnswer = [];
/* LOOP SCOPE OF CHOICES */
if($scope.weekly.main == 1 || $scope.weekly.main == 2){
angular.forEach($scope.choice1, function(value, key){
surveyAnswer.push(parseInt(value));
})
}
else if($scope.weekly.main == 3){
angular.forEach($scope.choice3, function(value, key){
surveyAnswer.push(parseInt(value));
})
}
else if($scope.weekly.main == 4){
angular.forEach($scope.choice4, function(value, key){
surveyAnswer.push(parseInt(value));
})
}
else if($scope.weekly.main == 5){
angular.forEach($scope.choice5, function(value, key){
surveyAnswer.push(parseInt(value));
})
}
else if($scope.weekly.main == 'C'){
surveyAnswer = null;
}
// var surveyAns = surveyAnswer;
// var surveyAnsStr = surveyAns.join(",");
$scope.closeEndTripModal = function() {
$scope.modalEndTrip.hide();
};
var surveyString = surveyAnswer.toString();
$scope.closeWeeklyModal = function() {
$scope.modalWeeklyTrip.hide();
};
console.log("[ WEEKLY SURVEY ANSWERS ]", JSON.stringify(surveyString));
var postdata = {
"user_id": userID,
"username": username,
"choice": $scope.weekly.main,
"survey_ans": surveyString,
"date_created": dateCreated
}
postBlazer.WeeklySurvey(postdata)
.success(function(response) {
console.log("SEND WEEKLY SURVEY SUCCESS", response);
localStorage.setItem(currentDate, currentDate);
$scope.resetValues();
$scope.closeWeeklyModal();
})
.error(function(response) {
console.error("SEND WEEKLY SURVEY ERROR", response);
$scope.resetValues();
$scope.closeWeeklyModal();
});
}
else {
$cordovaDialogs.alert('Network Connection is required before taking this action. Thank you!', 'Ooops', "OKAY");
}
}
$scope.endtrip = {};
$scope.postEndTripSurvey = function() {
/* CHECK IF MOBILE IS ONLINE */
console.log("[ NETWORK STATUS ]", $cordovaNetwork.getNetwork());
if ($cordovaNetwork.getNetwork() == Connection.WIFI || $cordovaNetwork.getNetwork() == Connection.CELL_2G || $cordovaNetwork.getNetwork() == Connection.CELL_3G || $cordovaNetwork.getNetwork() == Connection.CELL_4G) {
var tripID = localStorage.getItem("tripid");
var username = localStorage.getItem("username");
var startTime = localStorage.getItem("starttime");
var endTime = localStorage.getItem("endtime");
var newDate = new Date();
var timeStamp = newDate.getTime();
var currentTrip = localStorage.getItem("currentTrip");
var postdata = {
"trip_id": tripID,
"username": username,
"depart": startTime,
"arrive": endTime,
"mode": $scope.endtrip.mode,
"exp": $scope.endtrip.overallxp,
"emotion": $scope.endtrip.emotion,
"type": currentTrip
}
console.log("[ POST END TRIP SURVEY ]");
postBlazer.EndTripSurvey(postdata)
.success(function(response) {
$scope.closeEndTripModal();
$scope.endtrip = {};
console.log("SEND ENDTRIP SURVEY SUCCESS", response);
})
.error(function(response) {
$scope.closeEndTripModal();
$scope.endtrip = {};
console.error("SEND ENDTRIP SURVEY ERROR", response);
});
} else {
$cordovaDialogs.alert('Network Connection is required before taking this action. Thank you!', 'Ooops', "OKAY");
}
}
$scope.disableSwipe = function() {
$ionicSlideBoxDelegate.enableSlide(false);
};
$scope.currentIndex = '';
$scope.backSlide = function() {
$ionicScrollDelegate.scrollTop(true);
$ionicSlideBoxDelegate.previous();
$scope.currentIndex = $ionicSlideBoxDelegate.currentIndex();
}
$scope.nextPageSlide = function() {
$ionicScrollDelegate.scrollTop(true);
$ionicSlideBoxDelegate.next();
$scope.currentIndex = $ionicSlideBoxDelegate.currentIndex();
}
$scope.resetValues = function(){
$scope.weekly = {};
$scope.postWeeklySurvey = function() {
console.log("[ NETWORK STATUS ]", $cordovaNetwork.getNetwork());
if ($cordovaNetwork.getNetwork() == Connection.WIFI || $cordovaNetwork.getNetwork() == Connection.CELL_2G || $cordovaNetwork.getNetwork() == Connection.CELL_3G || $cordovaNetwork.getNetwork() == Connection.CELL_4G) {
var userID = localStorage.getItem("userID");
var username = localStorage.getItem("username");
var newDate = new Date();
var currentDate = $filter('date')(newDate, 'yyyyMMww');
var dayToday = $filter('date')(newDate, 'EEEE');
var dateCreated = $filter('date')(newDate, 'yyyy - MM - dd HH: mm: ss');
var surveyAnswer = [];
/* LOOP SCOPE OF CHOICES */
if ($scope.weekly.main == 1 || $scope.weekly.main == 2 || $scope.weekly.main == 3 || $scope.weekly.main == 4 || $scope.weekly.main == 5 || $scope.weekly.main == 6) {
angular.forEach($scope.choice1, function(value, key) {
if (value == 'N/A') {
surveyAnswer.push(value);
} else {
surveyAnswer.push(parseInt(value));
}
})
} else if ($scope.weekly.main == 'C') {
surveyAnswer = null;
}
var surveyString = surveyAnswer.toString();
console.log("[ WEEKLY SURVEY ANSWERS ]", JSON.stringify(surveyString));
var postdata = {
"user_id": userID,
"username": username,
"choice": $scope.weekly.main,
"survey_ans": surveyString,
"date_created": dateCreated
}
postBlazer.WeeklySurvey(postdata)
.success(function(response) {
console.log("SEND WEEKLY SURVEY SUCCESS", response);
localStorage.setItem(currentDate, currentDate);
$scope.resetValues();
$scope.closeWeeklyModal();
})
.error(function(response) {
console.error("SEND WEEKLY SURVEY ERROR", response);
$scope.resetValues();
$scope.closeWeeklyModal();
});
} else {
$cordovaDialogs.alert('Network Connection is required before taking this action. Thank you!', 'Ooops', "OKAY");
}
}
$scope.resetValues = function() {
$scope.weekly = {};
$scope.choice1 = {
one: "0",
two: "0",
three: "0",
four: "0",
five: "0",
six: "0",
seven: "0",
eight: "0"
};
$scope.choice3 = {
one: "0",
two: "0",
three: "0",
four: "0",
five: "0",
six: "0",
seven: "0",
eight: "0",
nine: "0",
ten: "0"
};
$scope.choice4 = {
one: "0",
two: "0",
three: "0",
four: "0",
five: "0",
six: "0",
seven: "0"
};
$scope.choice5 = {
one: "0",
two: "0",
three: "0",
four: "0",
five: "0",
six: "0",
seven: "0"
};
}
$scope.choiceOneA = [
{ text: "0", value: "0" },
{ text: "1", value: "1" },
{ text: "2", value: "2" },
{ text: "3", value: "3" },
{ text: "4", value: "4" },
{ text: "5", value: "5" }
];
$scope.choiceOneB = [
{ text: "6", value: "6" },
{ text: "7", value: "7" },
{ text: "8", value: "8" },
{ text: "9", value: "9" },
{ text: "10", value: "10" }
];
$scope.choice1 = {
one: "0",
two: "0",
three: "0",
four: "0",
five: "0",
six: "0",
seven: "0",
eight: "0"
one: "0",
two: "0",
three: "0",
four: "0",
five: "0",
six: "0",
seven: "0",
eight: "0"
};
$scope.choice3 = {
one: "0",
two: "0",
three: "0",
four: "0",
five: "0",
six: "0",
seven: "0",
eight: "0",
nine: "0",
ten: "0"
one: "0",
two: "0",
three: "0",
four: "0",
five: "0",
six: "0",
seven: "0",
eight: "0",
nine: "0",
ten: "0"
};
$scope.choice4 = {
one: "0",
two: "0",
three: "0",
four: "0",
five: "0",
six: "0",
seven: "0"
one: "0",
two: "0",
three: "0",
four: "0",
five: "0",
six: "0",
seven: "0"
};
$scope.choice5 = {
one: "0",
two: "0",
three: "0",
four: "0",
five: "0",
six: "0",
seven: "0"
one: "0",
two: "0",
three: "0",
four: "0",
five: "0",
six: "0",
seven: "0"
};
}
$scope.choiceOneA = [
{ text: "0", value: "0" },
{ text: "1", value: "1" },
{ text: "2", value: "2" },
{ text: "3", value: "3" },
{ text: "4", value: "4" },
{ text: "5", value: "5" }
];
$scope.choiceOneB = [
{ text: "6", value: "6" },
{ text: "7", value: "7" },
{ text: "8", value: "8" },
{ text: "9", value: "9" },
{ text: "10", value: "10" }
];
$scope.choice1 = {
one: "0",
two: "0",
three: "0",
four: "0",
five: "0",
six: "0",
seven: "0",
eight: "0"
};
$scope.choice3 = {
one: "0",
two: "0",
three: "0",
four: "0",
five: "0",
six: "0",
seven: "0",
eight: "0",
nine: "0",
ten: "0"
};
$scope.choice4 = {
one: "0",
two: "0",
three: "0",
four: "0",
five: "0",
six: "0",
seven: "0"
};
$scope.choice5 = {
one: "0",
two: "0",
three: "0",
four: "0",
five: "0",
six: "0",
seven: "0"
};
$scope.items = [
{ number: 1 },
{ number: 2 },
{ number: 3 },
{ number: 4 },
{ number: 5 },
{ number: 6 },
{ number: 7 },
{ number: 8 },
{ number: 9 },
{ number: 10 },
{ number: 11 },
{ number: 12 },
{ number: 13 },
{ number: 14 },
{ number: 15 }
];
$scope.selectedItem = $scope.items[2];
});
$scope.items = [
{ number: 1 },
{ number: 2 },
{ number: 3 },
{ number: 4 },
{ number: 5 },
{ number: 6 },
{ number: 7 },
{ number: 8 },
{ number: 9 },
{ number: 10 },
{ number: 11 },
{ number: 12 },
{ number: 13 },
{ number: 14 },
{ number: 15 }
];
$scope.selectedItem = $scope.items[2];
});
\ No newline at end of file
<ion-modal-view ng-controller="SurveyCtrl">
<form name="survey">
<ion-header-bar align-title="center" class="bar bar-clear darkblue">
<div class="buttons">
<button class="button button-clear button-light" ng-if="currentIndex!=0" ng-click="backSlide();"><i class="button-icon icon ion-back"></i>Back</button>
</div>
<h1 class="title">Weekly Survey</h1>
<div class="buttons">
<button class="button button-clear button-light" ng-disabled="survey.$invalid" ng-click="postWeeklySurvey()"><i class="button-icon icon ion-android-send"></i></button>
</div>
</ion-header-bar>
<ion-content padding="true">
<ion-slide-box on-slide-changed="slideHasChanged($index)" show-pager="false" ng-init="disableSwipe(); resetValues();" class="dynamic-slider">
<ion-slide>
<div class="item item-light item-text-wrap">
<p class="text-dark">Choose one statement that best describes your car use in the past 4-5 days and how you feel about it.</p>
</div>
<ion-radio class="item item-text-wrap justify" ng-model="weekly.main" ng-value=1 ng-click="nextPageSlide()"><b>A:</b> "These past few days, I used car frequently to school, either driving or being driven alone. I am happy about it and I am not at all thinking of lessening my car use."</ion-radio>
<ion-radio class="item item-text-wrap justify" ng-model="weekly.main" ng-value=2 ng-click="nextPageSlide()"><b>B:</b> "I used car frequently to school over the last few days. I don't know if I can reduce my car use but I am willing to explore possible ways to change my behavior."</ion-radio>
<ion-radio class="item item-text-wrap justify " ng-model="weekly.main" ng-value=3 ng-click="nextPageSlide()"><b>C:</b> "I used car frequently to school in the past 4-5 days. I want to reduce my car use but I don't know how to. In the coming week, I will try to make a plan on how I can achieve my goal of going by alternative modes for some
of my trips to the university."</ion-radio>
<ion-radio class="item item-text-wrap justify" ng-model="weekly.main" ng-value=4 ng-click="nextPageSlide()"><b>D:</b> "I used car frequently to school in the last few days. I already have some plan on how to go to school by alternatives but I have not implemented it yet. In the coming week, I will attempt to finally implement it."</ion-radio>
<ion-radio class="item item-text-wrap justify" ng-model="weekly.main" ng-value=5 ng-click="nextPageSlide()"><b>E:</b> "I was able to reduce (further?) my level of car use these past 4-5 days. I will try to maintain this or reduce it more in the coming week."</ion-radio>
<ion-radio class="item item-text-wrap justify" ng-model="weekly.main" ng-value=6 ng-click="nextPageSlide()"><b>F:</b> "These past few days, I mostly used alternative modes even though I could use car."</ion-radio>
<ion-radio class="item item-text-wrap justify" ng-model="weekly.main" ng-value="'C'" ng-click="postWeeklySurvey()"><b>G:</b> "As I do not own/have access to a car, I have no choice butto use alternative modes."</ion-radio>
</ion-slide>
<ion-slide>
<div class="item item-light item-text-wrap">
<p class="text-dark">Kindly read carefully and tell us how much you agree or disagree with each of the 15 statements. Choose N/A if thestatement is not applicable to you.</p>
</div>
<!-- FIRST -->
<label class="item item-stacked-label item-text-wrap justify" style="border-bottom: 0px;">
<span><b>1:</b> "I will feel good about myself if I am able to use alternatives for my trips to school." </span>
</label>
<div class="button-bar" style="border-bottom: 0px; border-top: 0px;">
<p class="button button-clear button-positive" ng-click="choice1.one =-5">Disagree</p>
<p class="button button-clear button-positive" ng-click="choice1.one =0">Neutral</p>
<p class="button button-clear button-positive" ng-click="choice1.one =5">Agree</p>
</div>
<div class="item range range-positive" style="border-top: 0px;">
<input type="range" name="choice1one" min=-5 max=5 step=1 ng-value=0 ng-model="choice1.one" value="{{choice1.one}}"> {{choice1.one}}
</div>
<ion-checkbox class="button-bar checkbox-positive" ng-model="choice1.one" ng-true-value="'N/A'" ng-false-value="''">
Not applicable
</ion-checkbox>
<label class="item item-stacked-label item-text-wrap justify" style="border-bottom: 0px;">
<span><b>2:</b> "I will feel bad if I do nothing to adopt a more pro-environmental mobility lifestyle." </span>
</label>
<div class="button-bar" style="border-bottom: 0px;">
<p class="button button-clear button-positive" ng-click="choice1.two =-5">Disagree</p>
<p class="button button-clear button-positive" ng-click="choice1.two =0">Neutral</p>
<p class="button button-clear button-positive" ng-click="choice1.two =5">Agree</p>
</div>
<div class="item range range-positive" style="border-top: 0px;">
<input type="range" name="choice1two" min=-5 max=5 step=1 ng-value=0 ng-model="choice1.two" value="{{choice1.two}}"> {{choice1.two}}
</div>
<ion-checkbox class="button-bar checkbox-positive" ng-model="choice1.two" ng-true-value="'N/A'" ng-false-value="''">
Not applicable
</ion-checkbox>
<label class="item item-stacked-label item-text-wrap justify" style="border-bottom: 0px;">
<span><b>3:</b> "Before I make the trip by car, I first consider if I can make the same trip by alternatives. Cars should be seen as mode of last resort." </span>
</label>
<div class="button-bar" style="border-bottom: 0px;">
<p class="button button-clear button-positive" ng-click="choice1.three =-5">Disagree</p>
<p class="button button-clear button-positive" ng-click="choice1.three =0">Neutral</p>
<p class="button button-clear button-positive" ng-click="choice1.three =5">Agree</p>
</div>
<div class="item range range-positive" style="border-top: 0px;">
<input type="range" name="choice1three" min=-5 max=5 step=1 ng-value=0 ng-model="choice1.three" value="{{choice1.three}}"> {{choice1.three}}
</div>
<ion-checkbox class="button-bar checkbox-positive" ng-model="choice1.three" ng-true-value="'N/A'" ng-false-value="''">
Not applicable
</ion-checkbox>
<label class="item item-stacked-label item-text-wrap justify" style="border-bottom: 0px;">
<span><b>4:</b> “I know some Ateneans who, though have access to cars, go to school by alternatives. They somehow motivate me to travel like them." </span>
</label>
<div class="button-bar" style="border-bottom: 0px;">
<p class="button button-clear button-positive" ng-click="choice1.four =-5">Disagree</p>
<p class="button button-clear button-positive" ng-click="choice1.four =0">Neutral</p>
<p class="button button-clear button-positive" ng-click="choice1.four =5">Agree</p>
</div>
<div class="item range range-positive" style="border-top: 0px;">
<input type="range" name="choice1four" min=-5 max=5 step=1 ng-value=0 ng-model="choice1.four" value="{{choice1.four}}"> {{choice1.four}}
</div>
<ion-checkbox class="button-bar checkbox-positive" ng-model="choice1.four" ng-true-value="'N/A'" ng-false-value="''">
Not applicable
</ion-checkbox>
<label class="item item-stacked-label item-text-wrap justify" style="border-bottom: 0px;">
<span><b>5:</b> "Each of us can contribute in solving eco-problems associated with car use by using car less or ridesharing with others if possible." </span>
</label>
<div class="button-bar" style="border-bottom: 0px;">
<p class="button button-clear button-positive" ng-click="choice1.five =-5">Disagree</p>
<p class="button button-clear button-positive" ng-click="choice1.five =0">Neutral</p>
<p class="button button-clear button-positive" ng-click="choice1.five =5">Agree</p>
</div>
<div class="item range range-positive" style="border-top: 0px;">
<input type="range" name="choice1five" min=-5 max=5 step=1 ng-value=0 ng-model="choice1.five" value="{{choice1.five}}"> {{choice1.five}}
</div>
<ion-checkbox class="button-bar checkbox-positive" ng-model="choice1.five" ng-true-value="'N/A'" ng-false-value="''">
Not applicable
</ion-checkbox>
<label class="item item-stacked-label item-text-wrap justify" style="border-bottom: 0px;">
<span><b>6:</b> "There are social costs associated with car use: traffic congestion, traffic accidents, air pollution and global warming." </span>
</label>
<div class="button-bar" style="border-bottom: 0px;">
<p class="button button-clear button-positive" ng-click="choice1.six =-5">Disagree</p>
<p class="button button-clear button-positive" ng-click="choice1.six =0">Neutral</p>
<p class="button button-clear button-positive" ng-click="choice1.six =5">Agree</p>
</div>
<div class="item range range-positive" style="border-top: 0px;">
<input type="range" name="choice1six" min=-5 max=5 step=1 ng-value=0 ng-model="choice1.six" value="{{choice1.six}}"> {{choice1.six}}
</div>
<ion-checkbox class="button-bar checkbox-positive" ng-model="choice1.six" ng-true-value="'N/A'" ng-false-value="''">
Not applicable
</ion-checkbox>
<label class="item item-stacked-label item-text-wrap justify" style="border-bottom: 0px;">
<span><b>7:</b> "It is possible for me to go to the university (more often) by carpool or other alternative modes." </span>
</label>
<div class="button-bar" style="border-bottom: 0px;">
<p class="button button-clear button-positive" ng-click="choice1.seven =-5">Disagree</p>
<p class="button button-clear button-positive" ng-click="choice1.seven =0">Neutral</p>
<p class="button button-clear button-positive" ng-click="choice1.seven =5">Agree</p>
</div>
<div class="item range range-positive" style="border-top: 0px;">
<input type="range" name="choice1seven" min=-5 max=5 step=1 ng-value=0 ng-model="choice1.seven" value="{{choice1.seven}}"> {{choice1.seven}}
</div>
<ion-checkbox class="button-bar checkbox-positive" ng-model="choice1.seven" ng-true-value="'N/A'" ng-false-value="''">
Not applicable
</ion-checkbox>
<label class="item item-stacked-label item-text-wrap justify" style="border-bottom: 0px;">
<span><b>8:</b> "I intend to contribute in taking cars off the roads, either by taking alternative means or pooling with others car trips going to same destination." </span>
</label>
<div class="button-bar" style="border-bottom: 0px;">
<p class="button button-clear button-positive" ng-click="choice1.eight =-5">Disagree</p>
<p class="button button-clear button-positive" ng-click="choice1.eight =0">Neutral</p>
<p class="button button-clear button-positive" ng-click="choice1.eight =5">Agree</p>
</div>
<div class="item range range-positive" style="border-top: 0px;">
<input type="range" name="choice1eight" min=-5 max=5 step=1 ng-value=0 ng-model="choice1.eight" value="{{choice1.eight}}"> {{choice1.eight}}
</div>
<ion-checkbox class="button-bar checkbox-positive" ng-model="choice1.eight" ng-true-value="'N/A'" ng-false-value="''">
Not applicable
</ion-checkbox>
<label class="item item-stacked-label item-text-wrap justify" style="border-bottom: 0px;">
<span><b>9:</b> "Among the different mode options to go to the university, there is one option, except driving alone or being the only passenger driven, that is favorable for me." </span>
</label>
<div class="button-bar" style="border-bottom: 0px;">
<p class="button button-clear button-positive" ng-click="choice1.nine =-5">Disagree</p>
<p class="button button-clear button-positive" ng-click="choice1.nine =0">Neutral</p>
<p class="button button-clear button-positive" ng-click="choice1.nine =5">Agree</p>
</div>
<div class="item range range-positive" style="border-top: 0px;">
<input type="range" name="choice1nine" min=-5 max=5 step=1 ng-value=0 ng-model="choice1.nine" value="{{choice1.nine}}"> {{choice1.nine}}
</div>
<ion-checkbox class="button-bar checkbox-positive" ng-model="choice1.nine" ng-true-value="'N/A'" ng-false-value="''">
Not applicable
</ion-checkbox>
<label class="item item-stacked-label item-text-wrap justify" style="border-bottom: 0px;">
<span><b>10:</b> "I have decided which mode to use as substitute for my car for some of my trips to the university. I intend to make a plan on how to go to the university using this mode." </span>
</label>
<div class="button-bar" style="border-bottom: 0px;">
<p class="button button-clear button-positive" ng-click="choice1.ten =-5">Disagree</p>
<p class="button button-clear button-positive" ng-click="choice1.ten =0">Neutral</p>
<p class="button button-clear button-positive" ng-click="choice1.ten =5">Agree</p>
</div>
<div class="item range range-positive" style="border-top: 0px;">
<input type="range" name="choice1ten" min=-5 max=5 step=1 ng-value=0 ng-model="choice1.ten" value="{{choice1.ten}}"> {{choice1.ten}}
</div>
<ion-checkbox class="button-bar checkbox-positive" ng-model="choice1.ten" ng-true-value="'N/A'" ng-false-value="''">
Not applicable
</ion-checkbox>
<label class="item item-stacked-label item-text-wrap justify" style="border-bottom: 0px;">
<span><b>11:</b> "I have plan on how to go to school by alternatives, and I have already run through my head on how to best carry out this plan." </span>
</label>
<div class="button-bar" style="border-bottom: 0px;">
<p class="button button-clear button-positive" ng-click="choice1.eleven =-5">Disagree</p>
<p class="button button-clear button-positive" ng-click="choice1.eleven =0">Neutral</p>
<p class="button button-clear button-positive" ng-click="choice1.eleven =5">Agree</p>
</div>
<div class="item range range-positive" style="border-top: 0px;">
<input type="range" name="choice1eleven" min=-5 max=5 step=1 ng-value=0 ng-model="choice1.eleven" value="{{choice1.eleven}}"> {{choice1.eleven}}
</div>
<ion-checkbox class="button-bar checkbox-positive" ng-model="choice1.eleven" ng-true-value="'N/A'" ng-false-value="''">
Not applicable
</ion-checkbox>
<label class="item item-stacked-label item-text-wrap justify" style="border-bottom: 0px;">
<span><b>12:</b> "I have anticipated all the possible problems that can occur and hinder me as I put this plan into practice." </span>
</label>
<div class="button-bar" style="border-bottom: 0px;">
<p class="button button-clear button-positive" ng-click="choice1.twelve =-5">Disagree</p>
<p class="button button-clear button-positive" ng-click="choice1.twelve =0">Neutral</p>
<p class="button button-clear button-positive" ng-click="choice1.twelve =5">Agree</p>
</div>
<div class="item range range-positive" style="border-top: 0px;">
<input type="range" name="choice1twelve" min=-5 max=5 step=1 ng-value=0 ng-model="choice1.twelve" value="{{choice1.twelve}}"> {{choice1.twelve}}
</div>
<ion-checkbox class="button-bar checkbox-positive" ng-model="choice1.twelve" ng-true-value="'N/A'" ng-false-value="''">
Not applicable
</ion-checkbox>
<label class="item item-stacked-label item-text-wrap justify" style="border-bottom: 0px;">
<span><b>13:</b> "I have already mentally developed ways to overcome such problems and obstacles or to be flexible depending on the situation." </span>
</label>
<div class="button-bar" style="border-bottom: 0px;">
<p class="button button-clear button-positive" ng-click="choice1.thirteen =-5">Disagree</p>
<p class="button button-clear button-positive" ng-click="choice1.thirteen =0">Neutral</p>
<p class="button button-clear button-positive" ng-click="choice1.thirteen =5">Agree</p>
</div>
<div class="item range range-positive" style="border-top: 0px;">
<input type="range" name="choice1thirteen" min=-5 max=5 step=1 ng-value=0 ng-model="choice1.thirteen" value="{{choice1.thirteen}}"> {{choice1.thirteen}}
</div>
<ion-checkbox class="button-bar checkbox-positive" ng-model="choice1.thirteen" ng-true-value="'N/A'" ng-false-value="''">
Not applicable
</ion-checkbox>
<label class="item item-stacked-label item-text-wrap justify" style="border-bottom: 0px;">
<span><b>14:</b> "Within the next seven days, I intend to actually use (more) public transport or rideshare in going to the university/home." </span>
</label>
<div class="button-bar" style="border-bottom: 0px;">
<p class="button button-clear button-positive" ng-click="choice1.fourteen =-5">Disagree</p>
<p class="button button-clear button-positive" ng-click="choice1.fourteen =0">Neutral</p>
<p class="button button-clear button-positive" ng-click="choice1.fourteen =5">Agree</p>
</div>
<div class="item range range-positive" style="border-top: 0px;">
<input type="range" name="choice1fourteen" min=-5 max=5 step=1 ng-value=0 ng-model="choice1.fourteen" value="{{choice1.fourteen}}"> {{choice1.fourteen}}
</div>
<ion-checkbox class="button-bar checkbox-positive" ng-model="choice1.fourteen" ng-true-value="'N/A'" ng-false-value="''">
Not applicable
</ion-checkbox>
<label class="item item-stacked-label item-text-wrap justify" style="border-bottom: 0px;">
<span><b>15:</b> "I will continue to use alternatives to go to school, even though this may be inconvenient." </span>
</label>
<div class="button-bar" style="border-bottom: 0px;">
<p class="button button-clear button-positive" ng-click="choice1.fifteen =-5">Disagree</p>
<p class="button button-clear button-positive" ng-click="choice1.fifteen =0">Neutral</p>
<p class="button button-clear button-positive" ng-click="choice1.fifteen =5">Agree</p>
</div>
<div class="item range range-positive" style="border-top: 0px;">
<input type="range" name="choice1fifteen" min=-5 max=5 step=1 ng-value=0 ng-model="choice1.fifteen" value="{{choice1.fifteen}}"> {{choice1.fifteen}}
</div>
<ion-checkbox class="button-bar checkbox-positive" ng-model="choice1.fifteen" ng-true-value="'N/A'" ng-false-value="''">
Not applicable
</ion-checkbox>
</ion-slide>
</ion-slide-box>
</form>
</ion-content>
</ion-modal-view>
\ No newline at end of file
......@@ -14,111 +14,156 @@
.leaflet-zoom-box,
.leaflet-image-layer,
.leaflet-layer {
position: absolute;
left: 0;
top: 0;
position: absolute;
left: 0;
top: 0;
}
.leaflet-container {
overflow: hidden;
-ms-touch-action: none;
overflow: hidden;
-ms-touch-action: none;
touch-action: none;
}
.leaflet-tile,
.leaflet-marker-icon,
.leaflet-marker-shadow {
-webkit-user-select: none;
-moz-user-select: none;
user-select: none;
-webkit-user-drag: none;
-webkit-user-select: none;
-moz-user-select: none;
user-select: none;
-webkit-user-drag: none;
}
.leaflet-marker-icon,
.leaflet-marker-shadow {
display: block;
display: block;
}
/* map is broken in FF if you have max-width: 100% on tiles */
.leaflet-container img {
max-width: none !important;
max-width: none !important;
}
/* stupid Android 2 doesn't understand "max-width: none" properly */
.leaflet-container img.leaflet-image-layer {
max-width: 15000px !important;
max-width: 15000px !important;
}
.leaflet-tile {
filter: inherit;
visibility: hidden;
filter: inherit;
visibility: hidden;
}
.leaflet-tile-loaded {
visibility: inherit;
visibility: inherit;
}
.leaflet-zoom-box {
width: 0;
height: 0;
width: 0;
height: 0;
}
/* workaround for https://bugzilla.mozilla.org/show_bug.cgi?id=888319 */
.leaflet-overlay-pane svg {
-moz-user-select: none;
-moz-user-select: none;
}
.leaflet-tile-pane { z-index: 2; }
.leaflet-objects-pane { z-index: 3; }
.leaflet-overlay-pane { z-index: 4; }
.leaflet-shadow-pane { z-index: 5; }
.leaflet-marker-pane { z-index: 6; }
.leaflet-popup-pane { z-index: 7; }
.leaflet-tile-pane {
z-index: 2;
}
.leaflet-objects-pane {
z-index: 3;
}
.leaflet-overlay-pane {
z-index: 4;
}
.leaflet-shadow-pane {
z-index: 5;
}
.leaflet-marker-pane {
z-index: 6;
}
.leaflet-popup-pane {
z-index: 7;
}
.leaflet-vml-shape {
width: 1px;
height: 1px;
width: 1px;
height: 1px;
}
.lvml {
behavior: url(#default#VML);
display: inline-block;
position: absolute;
behavior: url(#default#VML);
display: inline-block;
position: absolute;
}
/* control positioning */
.leaflet-control {
position: relative;
z-index: 7;
pointer-events: auto;
position: relative;
z-index: 7;
pointer-events: auto;
}
.leaflet-top,
.leaflet-bottom {
position: absolute;
z-index: 1000;
pointer-events: none;
position: absolute;
z-index: 1000;
pointer-events: none;
}
.leaflet-top {
top: 0;
top: 0;
}
.leaflet-right {
right: 0;
right: 0;
}
.leaflet-bottom {
bottom: 0;
bottom: 0;
}
.leaflet-left {
left: 0;
left: 0;
}
.leaflet-control {
float: left;
clear: both;
float: left;
clear: both;
}
.leaflet-right .leaflet-control {
float: right;
float: right;
}
.leaflet-top .leaflet-control {
margin-top: 10px;
margin-top: 10px;
}
.leaflet-bottom .leaflet-control {
margin-bottom: 10px;
margin-bottom: 10px;
}
.leaflet-left .leaflet-control {
margin-left: 10px;
margin-left: 10px;
}
.leaflet-right .leaflet-control {
margin-right: 10px;
margin-right: 10px;
}
......@@ -126,128 +171,143 @@
.leaflet-fade-anim .leaflet-tile,
.leaflet-fade-anim .leaflet-popup {
opacity: 0;
-webkit-transition: opacity 0.2s linear;
-moz-transition: opacity 0.2s linear;
-o-transition: opacity 0.2s linear;
transition: opacity 0.2s linear;
opacity: 0;
-webkit-transition: opacity 0.2s linear;
-moz-transition: opacity 0.2s linear;
-o-transition: opacity 0.2s linear;
transition: opacity 0.2s linear;
}
.leaflet-fade-anim .leaflet-tile-loaded,
.leaflet-fade-anim .leaflet-map-pane .leaflet-popup {
opacity: 1;
opacity: 1;
}
.leaflet-zoom-anim .leaflet-zoom-animated {
-webkit-transition: -webkit-transform 0.25s cubic-bezier(0,0,0.25,1);
-moz-transition: -moz-transform 0.25s cubic-bezier(0,0,0.25,1);
-o-transition: -o-transform 0.25s cubic-bezier(0,0,0.25,1);
transition: transform 0.25s cubic-bezier(0,0,0.25,1);
-webkit-transition: -webkit-transform 0.25s cubic-bezier(0, 0, 0.25, 1);
-moz-transition: -moz-transform 0.25s cubic-bezier(0, 0, 0.25, 1);
-o-transition: -o-transform 0.25s cubic-bezier(0, 0, 0.25, 1);
transition: transform 0.25s cubic-bezier(0, 0, 0.25, 1);
}
.leaflet-zoom-anim .leaflet-tile,
.leaflet-pan-anim .leaflet-tile,
.leaflet-touching .leaflet-zoom-animated {
-webkit-transition: none;
-moz-transition: none;
-o-transition: none;
transition: none;
-webkit-transition: none;
-moz-transition: none;
-o-transition: none;
transition: none;
}
.leaflet-zoom-anim .leaflet-zoom-hide {
visibility: hidden;
visibility: hidden;
}
/* cursors */
.leaflet-clickable {
cursor: pointer;
cursor: pointer;
}
.leaflet-container {
cursor: -webkit-grab;
cursor: -moz-grab;
cursor: -webkit-grab;
cursor: -moz-grab;
}
.leaflet-popup-pane,
.leaflet-control {
cursor: auto;
cursor: auto;
}
.leaflet-dragging .leaflet-container,
.leaflet-dragging .leaflet-clickable {
cursor: move;
cursor: -webkit-grabbing;
cursor: -moz-grabbing;
cursor: move;
cursor: -webkit-grabbing;
cursor: -moz-grabbing;
}
/* visual tweaks */
.leaflet-container {
background: #ddd;
outline: 0;
background: #ddd;
outline: 0;
}
.leaflet-container a {
color: #0078A8;
color: #0078A8;
}
.leaflet-container a.leaflet-active {
outline: 2px solid orange;
outline: 2px solid orange;
}
.leaflet-zoom-box {
border: 2px dotted #38f;
background: rgba(255,255,255,0.5);
border: 2px dotted #38f;
background: rgba(255, 255, 255, 0.5);
}
/* general typography */
.leaflet-container {
font: 12px/1.5 "Helvetica Neue", Arial, Helvetica, sans-serif;
font: 12px/1.5 "Helvetica Neue", Arial, Helvetica, sans-serif;
}
/* general toolbar styles */
.leaflet-bar {
box-shadow: 0 1px 5px rgba(0,0,0,0.65);
border-radius: 4px;
box-shadow: 0 1px 5px rgba(0, 0, 0, 0.65);
border-radius: 4px;
}
.leaflet-bar a,
.leaflet-bar a:hover {
background-color: #fff;
border-bottom: 1px solid #ccc;
width: 26px;
height: 26px;
line-height: 26px;
display: block;
text-align: center;
text-decoration: none;
color: black;
background-color: #fff;
border-bottom: 1px solid #ccc;
width: 26px;
height: 26px;
line-height: 26px;
display: block;
text-align: center;
text-decoration: none;
color: black;
}
.leaflet-bar a,
.leaflet-control-layers-toggle {
background-position: 50% 50%;
background-repeat: no-repeat;
display: block;
background-position: 50% 50%;
background-repeat: no-repeat;
display: block;
}
.leaflet-bar a:hover {
background-color: #f4f4f4;
background-color: #f4f4f4;
}
.leaflet-bar a:first-child {
border-top-left-radius: 4px;
border-top-right-radius: 4px;
border-top-left-radius: 4px;
border-top-right-radius: 4px;
}
.leaflet-bar a:last-child {
border-bottom-left-radius: 4px;
border-bottom-right-radius: 4px;
border-bottom: none;
border-bottom-left-radius: 4px;
border-bottom-right-radius: 4px;
border-bottom: none;
}
.leaflet-bar a.leaflet-disabled {
cursor: default;
background-color: #f4f4f4;
color: #bbb;
cursor: default;
background-color: #f4f4f4;
color: #bbb;
}
.leaflet-touch .leaflet-bar a {
width: 30px;
height: 30px;
line-height: 30px;
width: 30px;
height: 30px;
line-height: 30px;
}
......@@ -255,224 +315,251 @@
.leaflet-control-zoom-in,
.leaflet-control-zoom-out {
font: bold 18px 'Lucida Console', Monaco, monospace;
text-indent: 1px;
font: bold 18px 'Lucida Console', Monaco, monospace;
text-indent: 1px;
}
.leaflet-control-zoom-out {
font-size: 20px;
font-size: 20px;
}
.leaflet-touch .leaflet-control-zoom-in {
font-size: 22px;
font-size: 22px;
}
.leaflet-touch .leaflet-control-zoom-out {
font-size: 24px;
font-size: 24px;
}
/* layers control */
.leaflet-control-layers {
box-shadow: 0 1px 5px rgba(0,0,0,0.4);
background: #fff;
border-radius: 5px;
box-shadow: 0 1px 5px rgba(0, 0, 0, 0.4);
background: #fff;
border-radius: 5px;
}
.leaflet-control-layers-toggle {
background-image: url(images/layers.png);
width: 36px;
height: 36px;
background-image: url(images/layers.png);
width: 36px;
height: 36px;
}
.leaflet-retina .leaflet-control-layers-toggle {
background-image: url(images/layers-2x.png);
background-size: 26px 26px;
background-image: url(images/layers-2x.png);
background-size: 26px 26px;
}
.leaflet-touch .leaflet-control-layers-toggle {
width: 44px;
height: 44px;
width: 44px;
height: 44px;
}
.leaflet-control-layers .leaflet-control-layers-list,
.leaflet-control-layers-expanded .leaflet-control-layers-toggle {
display: none;
display: none;
}
.leaflet-control-layers-expanded .leaflet-control-layers-list {
display: block;
position: relative;
display: block;
position: relative;
}
.leaflet-control-layers-expanded {
padding: 6px 10px 6px 6px;
color: #333;
background: #fff;
padding: 6px 10px 6px 6px;
color: #333;
background: #fff;
}
.leaflet-control-layers-selector {
margin-top: 2px;
position: relative;
top: 1px;
margin-top: 2px;
position: relative;
top: 1px;
}
.leaflet-control-layers label {
display: block;
display: block;
}
.leaflet-control-layers-separator {
height: 0;
border-top: 1px solid #ddd;
margin: 5px -10px 5px -6px;
height: 0;
border-top: 1px solid #ddd;
margin: 5px -10px 5px -6px;
}
/* attribution and scale controls */
.leaflet-container .leaflet-control-attribution {
background: #fff;
background: rgba(255, 255, 255, 0.7);
margin: 0;
background: #fff;
background: rgba(255, 255, 255, 0.7);
margin: 0;
}
.leaflet-control-attribution,
.leaflet-control-scale-line {
padding: 0 5px;
color: #333;
padding: 0 5px;
color: #333;
}
.leaflet-control-attribution a {
text-decoration: none;
text-decoration: none;
}
.leaflet-control-attribution a:hover {
text-decoration: underline;
text-decoration: underline;
}
.leaflet-container .leaflet-control-attribution,
.leaflet-container .leaflet-control-scale {
font-size: 11px;
font-size: 11px;
}
.leaflet-left .leaflet-control-scale {
margin-left: 5px;
margin-left: 5px;
}
.leaflet-bottom .leaflet-control-scale {
margin-bottom: 5px;
margin-bottom: 5px;
}
.leaflet-control-scale-line {
border: 2px solid #777;
border-top: none;
line-height: 1.1;
padding: 2px 5px 1px;
font-size: 11px;
white-space: nowrap;
overflow: hidden;
-moz-box-sizing: content-box;
box-sizing: content-box;
background: #fff;
background: rgba(255, 255, 255, 0.5);
border: 2px solid #777;
border-top: none;
line-height: 1.1;
padding: 2px 5px 1px;
font-size: 11px;
white-space: nowrap;
overflow: hidden;
-moz-box-sizing: content-box;
box-sizing: content-box;
background: #fff;
background: rgba(255, 255, 255, 0.5);
}
.leaflet-control-scale-line:not(:first-child) {
border-top: 2px solid #777;
border-bottom: none;
margin-top: -2px;
border-top: 2px solid #777;
border-bottom: none;
margin-top: -2px;
}
.leaflet-control-scale-line:not(:first-child):not(:last-child) {
border-bottom: 2px solid #777;
border-bottom: 2px solid #777;
}
.leaflet-touch .leaflet-control-attribution,
.leaflet-touch .leaflet-control-layers,
.leaflet-touch .leaflet-bar {
box-shadow: none;
box-shadow: none;
}
.leaflet-touch .leaflet-control-layers,
.leaflet-touch .leaflet-bar {
border: 2px solid rgba(0,0,0,0.2);
background-clip: padding-box;
border: 2px solid rgba(0, 0, 0, 0.2);
background-clip: padding-box;
}
/* popup */
.leaflet-popup {
position: absolute;
text-align: center;
position: absolute;
text-align: center;
}
.leaflet-popup-content-wrapper {
padding: 1px;
text-align: left;
border-radius: 12px;
padding: 1px;
text-align: left;
border-radius: 12px;
}
.leaflet-popup-content {
margin: 13px 19px;
line-height: 1.4;
margin: 13px 19px;
line-height: 1.4;
}
.leaflet-popup-content p {
margin: 18px 0;
margin: 18px 0;
}
.leaflet-popup-tip-container {
margin: 0 auto;
width: 40px;
height: 20px;
position: relative;
overflow: hidden;
margin: 0 auto;
width: 40px;
height: 20px;
position: relative;
overflow: hidden;
}
.leaflet-popup-tip {
width: 17px;
height: 17px;
padding: 1px;
margin: -10px auto 0;
-webkit-transform: rotate(45deg);
-moz-transform: rotate(45deg);
-ms-transform: rotate(45deg);
-o-transform: rotate(45deg);
transform: rotate(45deg);
.leaflet-popup-tip {
width: 17px;
height: 17px;
padding: 1px;
margin: -10px auto 0;
-webkit-transform: rotate(45deg);
-moz-transform: rotate(45deg);
-ms-transform: rotate(45deg);
-o-transform: rotate(45deg);
transform: rotate(45deg);
}
.leaflet-popup-content-wrapper,
.leaflet-popup-tip {
background: white;
box-shadow: 0 3px 14px rgba(0,0,0,0.4);
background: white;
box-shadow: 0 3px 14px rgba(0, 0, 0, 0.4);
}
.leaflet-container a.leaflet-popup-close-button {
position: absolute;
top: 0;
right: 0;
padding: 4px 4px 0 0;
text-align: center;
width: 18px;
height: 14px;
font: 16px/14px Tahoma, Verdana, sans-serif;
color: #c3c3c3;
text-decoration: none;
font-weight: bold;
background: transparent;
position: absolute;
top: 0;
right: 0;
padding: 4px 4px 0 0;
text-align: center;
width: 18px;
height: 14px;
font: 16px/14px Tahoma, Verdana, sans-serif;
color: #c3c3c3;
text-decoration: none;
font-weight: bold;
background: transparent;
}
.leaflet-container a.leaflet-popup-close-button:hover {
color: #999;
color: #999;
}
.leaflet-popup-scrolled {
overflow: auto;
border-bottom: 1px solid #ddd;
border-top: 1px solid #ddd;
overflow: auto;
border-bottom: 1px solid #ddd;
border-top: 1px solid #ddd;
}
.leaflet-oldie .leaflet-popup-content-wrapper {
zoom: 1;
zoom: 1;
}
.leaflet-oldie .leaflet-popup-tip {
width: 24px;
margin: 0 auto;
-ms-filter: "progid:DXImageTransform.Microsoft.Matrix(M11=0.70710678, M12=0.70710678, M21=-0.70710678, M22=0.70710678)";
filter: progid:DXImageTransform.Microsoft.Matrix(M11=0.70710678, M12=0.70710678, M21=-0.70710678, M22=0.70710678);
.leaflet-oldie .leaflet-popup-tip {
width: 24px;
margin: 0 auto;
-ms-filter: "progid:DXImageTransform.Microsoft.Matrix(M11=0.70710678, M12=0.70710678, M21=-0.70710678, M22=0.70710678)";
filter: progid: DXImageTransform.Microsoft.Matrix(M11=0.70710678, M12=0.70710678, M21=-0.70710678, M22=0.70710678);
}
.leaflet-oldie .leaflet-popup-tip-container {
margin-top: -1px;
margin-top: -1px;
}
.leaflet-oldie .leaflet-control-zoom,
.leaflet-oldie .leaflet-control-layers,
.leaflet-oldie .leaflet-popup-content-wrapper,
.leaflet-oldie .leaflet-popup-tip {
border: 1px solid #999;
border: 1px solid #999;
}
/* div icon */
.leaflet-div-icon {
background: #fff;
border: 1px solid #666;
}
background: #fff;
border: 1px solid #666;
}
\ No newline at end of file
<!DOCTYPE html>
<html>
<head>
<head>
<meta charset="utf-8">
<meta name="viewport" content="initial-scale=1, maximum-scale=1, user-scalable=no, width=device-width">
<!--<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no" />-->
......@@ -11,7 +12,7 @@
<link href="css/style.css" rel="stylesheet">
<link rel="stylesheet" href="css/leaflet.css">
<link rel="stylesheet" href="css/leaflet-routing-machine.css">
<link href="lib/ion-floating-menu/dist/ion-floating-menu.css" rel="stylesheet" type="text/css">
<!--<link href="lib/leaflet-markercluster/dist/MarkerCluster.css" rel="stylesheet" type="text/css"/>-->
<link href="lib/ion-datetime-picker/release/ion-datetime-picker.min.css" rel="stylesheet">
......@@ -27,8 +28,9 @@
<!-- cordova script (this will be a 404 during development) -->
<script src="lib/ngCordova/ng-cordova.min.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 src="https://maps.googleapis.com/maps/api/js?libraries=places&sensor=false"></script>
<!--<script src="lib/leaflet/leaflet-google.js"></script>-->
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script>
<!-- your app's js -->
......@@ -45,6 +47,7 @@
<script src="app/misc/js/misc.js"></script>
<script src="app/ride/js/ride.js"></script>
<script src="app/message/js/message.js"></script>
<script src="app/diary/js/diary.js"></script>
<script src="js/config.js"></script>
<script src="js/blazerAPI.js"></script>
......@@ -53,12 +56,15 @@
<script src="lib/ion-floating-menu/dist/ion-floating-menu.js" type="text/javascript"></script>
<!--<script src="lib/leaflet-markercluster/dist/leaflet.markercluster.js" type="text/javascript"></script>-->
<script src="lib/ion-datetime-picker/release/ion-datetime-picker.min.js"></script>
<script src="js/directives/radioButtons.js"></script>
</head>
<body ng-app="blazer" class="platform-android platform-cordova platform-webview">
</head>
<body ng-app="blazer" class="platform-android platform-cordova platform-webview">
<ion-nav-view></ion-nav-view>
</body>
</html>
</body>
</html>
\ No newline at end of file
angular.module('blazer', [
'ionic',
'blazer.landingcontrollers',
'blazer.menucontrollers',
'blazer.authenticationcontrollers',
'blazer.mapcontrollers',
'blazer.offerridecontrollers',
'blazer.sharedridecontrollers',
'blazer.statuscontrollers',
'blazer.tripcontrollers',
'blazer.misccontrollers',
'blazer.surveycontrollers',
'blazer.apiservices',
'blazer.rideinformation',
'blazer.composemessage',
'ionic-letter-avatar',
'ngCordova',
'radioButtons',
'ion-floating-menu',
'ion-datetime-picker',
'chart.js'
'ionic',
'blazer.landingcontrollers',
'blazer.menucontrollers',
'blazer.authenticationcontrollers',
'blazer.mapcontrollers',
'blazer.offerridecontrollers',
'blazer.sharedridecontrollers',
'blazer.statuscontrollers',
'blazer.tripcontrollers',
'blazer.misccontrollers',
'blazer.surveycontrollers',
'blazer.diarycontrollers',
'blazer.apiservices',
'blazer.rideinformation',
'blazer.composemessage',
'ionic-letter-avatar',
'ngCordova',
'radioButtons',
'ion-floating-menu',
'ion-datetime-picker',
'chart.js'
])
.run(function($ionicPlatform, $ionicPickerI18n) {
$ionicPlatform.ready(function() {
if (window.cordova && window.cordova.plugins.Keyboard) {
cordova.plugins.Keyboard.hideKeyboardAccessoryBar(true);
cordova.plugins.Keyboard.disableScroll(true);
}
if (window.StatusBar) {
// org.apache.cordova.statusbar required
StatusBar.styleDefault();
}
$ionicPickerI18n.ok = "Set";
$ionicPickerI18n.okClass = "button-dark button-outline";
$ionicPickerI18n.cancelClass = "button-dark button-outline";
});
$ionicPlatform.registerBackButtonAction(function (event) {
event.preventDefault();
$ionicPlatform.ready(function() {
if (window.cordova && window.cordova.plugins.Keyboard) {
cordova.plugins.Keyboard.hideKeyboardAccessoryBar(true);
cordova.plugins.Keyboard.disableScroll(true);
}
if (window.StatusBar) {
// org.apache.cordova.statusbar required
StatusBar.styleDefault();
}
$ionicPickerI18n.ok = "Set";
$ionicPickerI18n.okClass = "button-dark button-outline";
$ionicPickerI18n.cancelClass = "button-dark button-outline";
});
$ionicPlatform.registerBackButtonAction(function(event) {
event.preventDefault();
}, 100);
})
.config(function($stateProvider, $urlRouterProvider, $ionicConfigProvider) {
$ionicConfigProvider.tabs.position('bottom'); // other values: top
$ionicConfigProvider.tabs.style('standard');
$ionicConfigProvider.spinner.icon('lines');
$stateProvider
/* LANDING */
.state('landing', {
url: '/landing',
templateUrl: 'app/landing/landing.html',
controller: 'LandingCtrl'
})
/* MENU */
.state('app', {
url: '/app',
abstract: true,
templateUrl: 'app/menu/menu.html',
controller: 'MenuCtrl'
})
/* LOGIN */
.state('login', {
url: '/login',
templateUrl: 'app/auth/login.html',
controller: 'AuthCtrl'
})
/* HOME */
.state('app.map', {
url: '/map',
views: {
'menuContent': {
templateUrl: 'app/map/map.html',
controller: 'MapCtrl'
}
}
})
/* TRIP */
.state('app.trip', {
url: '/trip',
views: {
'menuContent': {
templateUrl: 'app/trip/trip.html',
controller: 'TripCtrl'
}
}
})
/* SHAREDRIDE */
.state('app.offerride', {
url: '/offerride',
views: {
'menuContent': {
templateUrl: 'app/offerride/offerride.html',
controller: 'OfferRideCtrl'
}
}
})
/* SHAREDRIDE */
.state('app.sharedride', {
url: '/sharedride',
views: {
'menuContent': {
templateUrl: 'app/sharedride/sharedride.html',
controller: 'SharedRideCtrl'
}
}
})
/* STATUS */
.state('app.status', {
url: '/status',
views: {
'menuContent': {
templateUrl: 'app/status/status.html',
controller: 'StatusCtrl'
}
}
})
/* PROFILE */
.state('app.profile', {
url: '/profile',
views: {
'menuContent': {
templateUrl: 'app/misc/profile.html',
controller: 'MiscCtrl'
}
}
})
/* ABOUT */
.state('app.about', {
url: '/about',
views: {
'menuContent': {
templateUrl: 'app/misc/about.html',
controller: 'MiscCtrl'
}
}
})
/* SETTINGS */
.state('app.settings', {
url: '/settings',
views: {
'menuContent': {
templateUrl: 'app/misc/settings.html',
controller: 'MiscCtrl'
}
}
})
/* RIDE INFORMATION */
.state('app.ride', {
url: '/ride/:id',
views: {
'menuContent': {
templateUrl: 'app/ride/ride.html',
controller: 'RideInfoCtrl'
}
}
})
/* COMPOSE MESSAGE */
.state('app.message', {
url: '/message',
views: {
'menuContent': {
templateUrl: 'app/message/message.html',
controller: 'MsgCtrl'
}
}
})
$urlRouterProvider.otherwise('/landing');
$ionicConfigProvider.tabs.position('bottom'); // other values: top
$ionicConfigProvider.tabs.style('standard');
$ionicConfigProvider.spinner.icon('lines');
$stateProvider
/* LANDING */
.state('landing', {
url: '/landing',
templateUrl: 'app/landing/landing.html',
controller: 'LandingCtrl'
})
/* MENU */
.state('app', {
url: '/app',
abstract: true,
templateUrl: 'app/menu/menu.html',
controller: 'MenuCtrl'
})
/* LOGIN */
.state('login', {
url: '/login',
templateUrl: 'app/auth/login.html',
controller: 'AuthCtrl'
})
/* HOME */
.state('app.map', {
url: '/map',
views: {
'menuContent': {
templateUrl: 'app/map/map.html',
controller: 'MapCtrl'
}
}
})
/* TRIP */
.state('app.trip', {
url: '/trip',
views: {
'menuContent': {
templateUrl: 'app/trip/trip.html',
controller: 'TripCtrl'
}
}
})
/* SHAREDRIDE */
.state('app.offerride', {
url: '/offerride',
views: {
'menuContent': {
templateUrl: 'app/offerride/offerride.html',
controller: 'OfferRideCtrl'
}
}
})
/* SHAREDRIDE */
.state('app.sharedride', {
url: '/sharedride',
views: {
'menuContent': {
templateUrl: 'app/sharedride/sharedride.html',
controller: 'SharedRideCtrl'
}
}
})
/* STATUS */
.state('app.status', {
url: '/status',
views: {
'menuContent': {
templateUrl: 'app/status/status.html',
controller: 'StatusCtrl'
}
}
})
/* PROFILE */
.state('app.profile', {
url: '/profile',
views: {
'menuContent': {
templateUrl: 'app/misc/profile.html',
controller: 'MiscCtrl'
}
}
})
/* ABOUT */
.state('app.about', {
url: '/about',
views: {
'menuContent': {
templateUrl: 'app/misc/about.html',
controller: 'MiscCtrl'
}
}
})
/* SETTINGS */
.state('app.settings', {
url: '/settings',
views: {
'menuContent': {
templateUrl: 'app/misc/settings.html',
controller: 'MiscCtrl'
}
}
})
/* RIDE INFORMATION */
.state('app.ride', {
url: '/ride/:id',
views: {
'menuContent': {
templateUrl: 'app/ride/ride.html',
controller: 'RideInfoCtrl'
}
}
})
/* COMPOSE MESSAGE */
.state('app.message', {
url: '/message',
views: {
'menuContent': {
templateUrl: 'app/message/message.html',
controller: 'MsgCtrl'
}
}
})
/* DIARY */
.state('app.diary', {
url: '/diary',
views: {
'menuContent': {
templateUrl: 'app/diary/diary.html',
controller: 'DiaryCtrl'
}
}
})
$urlRouterProvider.otherwise('/landing');
})
\ No newline at end of file
......@@ -4,622 +4,1106 @@
angular.module('blazer.apiservices', [])
/*-------------------------------------------------- GET -------------------------------------------------- */
.factory('getBlazer', function($http, $ionicLoading){
var AllBlazerData = [];
var AllUserData = [];
var AllTravelStatus = [];
var AllSharedRideData = [];
var DetailedSharedRide = {};
var AllModesofTransport = {};
var AllBarangay = [];
return {
getBlazerDataInfo: function(){
$ionicLoading.show({ template: '<ion-spinner icon="crescent"></ion-spinner>'});
return $http.get(blazerAPI + '/blazer_data.php', {headers : {'Content-Type': 'application/x-www-form-urlencoded'}}).then(function(response) {
console.log('[ SUCCESS ]', JSON.stringify(response));
AllBlazerData = response.data;
$ionicLoading.hide();
return AllBlazerData;
}, function(err) {
console.error('[ ERROR ]', JSON.stringify(err));
$ionicLoading.hide();
return ;
})
},
getUserProfile: function(username) {
console.log("****** ON ENTER GET USER PROFILE SERVICE ******");
// $ionicLoading.show({ template: '<ion-spinner icon="crescent"></ion-spinner>'});
return $http.get(blazerAPI+'/user_profile.php?username='+username, {headers : {'Content-Type': 'application/x-www-form-urlencoded'}}).then(function(response) {
console.log('[ SUCCESS ]', JSON.stringify(response));
AllUserData = response.data[0];
$ionicLoading.hide();
return AllUserData;
}, function(err) {
console.error('[ ERROR ]', JSON.stringify(err));
$ionicLoading.hide();
return ;
})
},
getTravelStats: function(username) {
console.log("****** ON ENTER GET USER TRAVEL STATUS SERVICE ******");
// $ionicLoading.show({ template: '<ion-spinner icon="crescent"></ion-spinner>'});
return $http.get(blazerAPI+'/travel_stats.php?username='+username, {headers : {'Content-Type': 'application/x-www-form-urlencoded'}}).then(function(response) {
console.log('[ SUCCESS ]', JSON.stringify(response));
AllTravelStatus = response.data;
$ionicLoading.hide();
return AllTravelStatus;
}, function(err) {
console.error('[ ERROR ]', JSON.stringify(err));
$ionicLoading.hide();
return ;
})
},
/* NOT USED */
getSharedRide: function() {
console.log("****** ON ENTER GET SHARED RIDE SERVICE ******");
// $ionicLoading.show( { template: '<ion-spinner icon="crescent"></ion-spinner>'} );
return $http.get(blazerAPI+'/take_shared_ride_data.php', {headers : {'Content-Type': 'application/x-www-form-urlencoded'}}).then(function(response) {
console.log('[ SUCCESS ]', JSON.stringify(response));
AllSharedRideData = response.data;
$ionicLoading.hide();
return AllSharedRideData;
}, function(err) {
console.error('[ ERROR ]', JSON.stringify(err));
$ionicLoading.hide();
return ;
})
},
getTakeSharedRide: function(username) {
console.log("****** ON ENTER GET TAKE A SHARED RIDE SERVICE ******");
// $ionicLoading.show( { template: '<ion-spinner icon="crescent"></ion-spinner>'} );
return $http.get(blazerAPI+'/take_shared_ride_data.php?username='+username, {headers : {'Content-Type': 'application/x-www-form-urlencoded'}}).then(function(response) {
console.log('[ SUCCESS ]', JSON.stringify(response));
AllSharedRideData = response.data;
$ionicLoading.hide();
return AllSharedRideData;
}, function(err) {
console.error('[ ERROR ]', JSON.stringify(err));
$ionicLoading.hide();
return ;
})
},
getDetailedSharedRide: function(rideID, username) {
DetailedSharedRide = {};
console.log("[ RIDE ID ]", rideID);
console.log("****** ON ENTER GET DETAILED SHARED RIDE SERVICE ******");
$ionicLoading.show( { template: '<ion-spinner icon="crescent"></ion-spinner>'} );
return $http.get(blazerAPI+'/take_shared_ride_data.php?username='+username, {headers : {'Content-Type': 'application/x-www-form-urlencoded'}}).then(function(response) {
// console.log('[ SUCCESS ]', JSON.stringify(response));
AllSharedRideData = response.data;
angular.forEach(AllSharedRideData, function(value, key) {
if (value.id === rideID) {
DetailedSharedRide = { "id": value.id, "createdby": value.createdby, "destination": value.destination, "pickuplocation": value.pickuplocation, "pickup_lat": value.pickup_lat, "pickup_long": value.pickup_long, "assemblytime": value.assemblytime, "model": value.model, "mobilenum": value.mobilenum, "otherdetails": value.otherdetails, "subscribers": value.subscribers, "capacityleft": value.capacityleft, "avatar": value.avatar, "ride_status": value.ride_status, "interested_status": value.interested_status }
console.log("[ DETAILED SHARED RIDE ]", JSON.stringify(DetailedSharedRide));
$ionicLoading.hide();
}
});
return DetailedSharedRide;
}, function(err) {
console.error('[ ERROR ]', JSON.stringify(err));
$ionicLoading.hide();
return ;
})
},
/* PENDING PENDING PENDING PENDING PENDING PENDING PENDING */
getModeofTransportation: function(rideID) {
console.log("****** ON ENTER MODE OF TRANSPORT SERVICE ******");
$ionicLoading.show( { template: '<ion-spinner icon="crescent"></ion-spinner>'} );
return $http.get(blazerAPI+'/get_transportation_mode.php', {headers : {'Content-Type': 'application/x-www-form-urlencoded'}}).then(function(response) {
// console.log('[ SUCCESS ]', JSON.stringify(response));
AllModesofTransport = response.data;
angular.forEach(AllModesofTransport, function(value, key) {
if (value.id === rideID) {
AllModesofTransport = {};
console.log("[ MODE OF TRANSPORT ]", JSON.stringify(AllModesofTransport));
$ionicLoading.hide();
}
});
return AllModesofTransport;
}, function(err) {
console.error('[ ERROR ]', JSON.stringify(err));
$ionicLoading.hide();
return ;
})
},
getAllBarangay: function(){
$ionicLoading.show({ template: '<ion-spinner icon="crescent"></ion-spinner>'});
return $http.get(blazerAPI + '/get_barangay.php', {headers : {'Content-Type': 'application/x-www-form-urlencoded'}}).then(function(response) {
console.log('[ SUCCESS ]', JSON.stringify(response));
AllBarangay = response.data;
// LOOP BARANGAY DATA
var BarangayData = [];
for(var i = 0; i < AllBarangay.length; i++){
console.log("Barangay "+i,AllBarangay[i]);
BarangayData.push({"name":AllBarangay[i]});
}
$ionicLoading.hide();
return BarangayData;
}, function(err) {
console.error('[ ERROR ]', JSON.stringify(err));
$ionicLoading.hide();
return ;
})
},
}
.factory('getBlazer', function($http, $ionicLoading) {
var TempData = [];
return {
getBlazerDataInfo: function() {
$ionicLoading.show({ template: '<ion-spinner icon="crescent"></ion-spinner>' });
return $http.get(blazerAPI + '/blazer_data.php', { headers: { 'Content-Type': 'application/x-www-form-urlencoded' } }).then(function(response) {
console.log('[ SUCCESS ]', JSON.stringify(response));
TempData = response.data;
$ionicLoading.hide();
return TempData;
}, function(err) {
console.error('[ ERROR ]', JSON.stringify(err));
$ionicLoading.hide();
return;
})
},
getUserProfile: function(username) {
console.log("****** ON ENTER GET USER PROFILE SERVICE ******");
// $ionicLoading.show({ template: '<ion-spinner icon="crescent"></ion-spinner>'});
return $http.get(blazerAPI + '/user_profile.php?username=' + username, { headers: { 'Content-Type': 'application/x-www-form-urlencoded' } }).then(function(response) {
console.log('[ SUCCESS ]', JSON.stringify(response));
TempData = response.data[0];
$ionicLoading.hide();
return TempData;
}, function(err) {
console.error('[ ERROR ]', JSON.stringify(err));
$ionicLoading.hide();
return;
})
},
getTravelStats: function(username) {
console.log("****** ON ENTER GET USER TRAVEL STATUS SERVICE ******");
// $ionicLoading.show({ template: '<ion-spinner icon="crescent"></ion-spinner>'});
return $http.get(blazerAPI + '/travel_stats.php?username=' + username, { headers: { 'Content-Type': 'application/x-www-form-urlencoded' } }).then(function(response) {
console.log('[ SUCCESS ]', JSON.stringify(response));
TempData = response.data;
$ionicLoading.hide();
return TempData;
}, function(err) {
console.error('[ ERROR ]', JSON.stringify(err));
$ionicLoading.hide();
return;
})
},
/* NOT USED */
getSharedRide: function() {
console.log("****** ON ENTER GET SHARED RIDE SERVICE ******");
// $ionicLoading.show( { template: '<ion-spinner icon="crescent"></ion-spinner>'} );
return $http.get(blazerAPI + '/take_shared_ride_data.php', { headers: { 'Content-Type': 'application/x-www-form-urlencoded' } }).then(function(response) {
console.log('[ SUCCESS ]', JSON.stringify(response));
TempData = response.data;
$ionicLoading.hide();
return TempData;
}, function(err) {
console.error('[ ERROR ]', JSON.stringify(err));
$ionicLoading.hide();
return;
})
},
getTakeSharedRide: function(username) {
console.log("****** ON ENTER GET TAKE A SHARED RIDE SERVICE ******");
// $ionicLoading.show( { template: '<ion-spinner icon="crescent"></ion-spinner>'} );
return $http.get(blazerAPI + '/take_shared_ride_data.php?username=' + username, { headers: { 'Content-Type': 'application/x-www-form-urlencoded' } }).then(function(response) {
console.log('[ SUCCESS ]', JSON.stringify(response));
TempData = response.data;
$ionicLoading.hide();
return TempData;
}, function(err) {
console.error('[ ERROR ]', JSON.stringify(err));
$ionicLoading.hide();
return;
})
},
getDetailedSharedRide: function(rideID, username) {
DetailedSharedRide = {};
console.log("[ RIDE ID ]", rideID);
console.log("****** ON ENTER GET DETAILED SHARED RIDE SERVICE ******");
$ionicLoading.show({ template: '<ion-spinner icon="crescent"></ion-spinner>' });
return $http.get(blazerAPI + '/take_shared_ride_data.php?username=' + username, { headers: { 'Content-Type': 'application/x-www-form-urlencoded' } }).then(function(response) {
// console.log('[ SUCCESS ]', JSON.stringify(response));
TempData = response.data;
angular.forEach(TempData, function(value, key) {
if (value.id === rideID) {
DetailedSharedRide = { "id": value.id, "createdby": value.createdby, "destination": value.destination, "pickuplocation": value.pickuplocation, "pickup_lat": value.pickup_lat, "pickup_long": value.pickup_long, "assemblytime": value.assemblytime, "model": value.model, "mobilenum": value.mobilenum, "otherdetails": value.otherdetails, "subscribers": value.subscribers, "capacityleft": value.capacityleft, "avatar": value.avatar, "ride_status": value.ride_status, "interested_status": value.interested_status }
console.log("[ DETAILED SHARED RIDE ]", JSON.stringify(DetailedSharedRide));
$ionicLoading.hide();
}
});
return DetailedSharedRide;
}, function(err) {
console.error('[ ERROR ]', JSON.stringify(err));
$ionicLoading.hide();
return;
})
},
/* PENDING PENDING PENDING PENDING PENDING PENDING PENDING */
getModeofTransportation: function(rideID) {
console.log("****** ON ENTER MODE OF TRANSPORT SERVICE ******");
$ionicLoading.show({ template: '<ion-spinner icon="crescent"></ion-spinner>' });
return $http.get(blazerAPI + '/get_transportation_mode.php', { headers: { 'Content-Type': 'application/x-www-form-urlencoded' } }).then(function(response) {
// console.log('[ SUCCESS ]', JSON.stringify(response));
TempData = response.data;
angular.forEach(TempData, function(value, key) {
if (value.id === rideID) {
TempData = {};
console.log("[ MODE OF TRANSPORT ]", JSON.stringify(TempData));
$ionicLoading.hide();
}
});
return TempData;
}, function(err) {
console.error('[ ERROR ]', JSON.stringify(err));
$ionicLoading.hide();
return;
})
},
getAllBarangay: function() {
$ionicLoading.show({ template: '<ion-spinner icon="crescent"></ion-spinner>' });
return $http.get(blazerAPI + '/get_barangay.php', { headers: { 'Content-Type': 'application/x-www-form-urlencoded' } }).then(function(response) {
console.log('[ SUCCESS ]', JSON.stringify(response));
TempData = response.data;
// LOOP BARANGAY DATA
var BarangayData = [];
for (var i = 0; i < TempData.length; i++) {
console.log("Barangay " + i, TempData[i]);
BarangayData.push({ "name": TempData[i] });
}
$ionicLoading.hide();
return BarangayData;
}, function(err) {
console.error('[ ERROR ]', JSON.stringify(err));
$ionicLoading.hide();
return;
})
},
getMapData: function() {
$ionicLoading.show({ template: '<ion-spinner icon="crescent"></ion-spinner>' });
return $http.get(blazerAPI_V2 + '/index.php/map/barangay_visualization', { headers: { 'Content-Type': 'application/x-www-form-urlencoded' } }).then(function(response) {
console.log('[ SUCCESS ]', JSON.stringify(response));
TempData = response.data;
$ionicLoading.hide();
return TempData;
}, function(err) {
console.error('[ ERROR ]', JSON.stringify(err));
$ionicLoading.hide();
return;
})
},
getMostPopulatNonCarMode: function(barangay, time) {
$ionicLoading.show({ template: '<ion-spinner icon="crescent"></ion-spinner>' });
return $http.get(blazerAPI_V2 + '/index.php/barangay/most_popular_non_car/' + barangay + '/' + time, { headers: { 'Content-Type': 'application/x-www-form-urlencoded' } }).then(function(response) {
console.log('[ SUCCESS ]', JSON.stringify(response));
TempData = response.data;
$ionicLoading.hide();
return TempData;
}, function(err) {
console.error('[ ERROR ]', JSON.stringify(err));
$ionicLoading.hide();
return;
})
},
getHowYouMoveAround: function(start, end, username) {
$ionicLoading.show({ template: '<ion-spinner icon="crescent"></ion-spinner>' });
return $http.get(blazerAPI_V2 + '/index.php/diary/how_you_moved/' + start + '/' + end + '/' + username, { headers: { 'Content-Type': 'application/x-www-form-urlencoded' } }).then(function(response) {
console.log('[ SUCCESS ]', JSON.stringify(response));
TempData = response.data;
$ionicLoading.hide();
return TempData;
}, function(err) {
console.error('[ ERROR ]', JSON.stringify(err));
$ionicLoading.hide();
return;
})
},
getHowYouMoveAround: function(start, end, username) {
$ionicLoading.show({ template: '<ion-spinner icon="crescent"></ion-spinner>' });
return $http.get(blazerAPI_V2 + '/index.php/diary/how_you_moved/' + start + '/' + end + '/' + username, { headers: { 'Content-Type': 'application/x-www-form-urlencoded' } }).then(function(response) {
console.log('[ SUCCESS ]', JSON.stringify(response));
TempData = response.data;
$ionicLoading.hide();
return TempData;
}, function(err) {
console.error('[ ERROR ]', JSON.stringify(err));
$ionicLoading.hide();
return;
})
},
getComparisonMessage: function(username) {
return $http.get('http://blaze.eacomm.com/includes/get_facts.php?username=' + username, { headers: { 'Content-Type': 'application/x-www-form-urlencoded' } }).then(function(response) {
console.log('[ SUCCESS ]', JSON.stringify(response));
TempData = response.data;
return TempData;
},
function(err) {
console.error('[ ERROR ]', JSON.stringify(err));
$ionicLoading.hide();
return;
})
},
}
})
/*-------------------------------------------------- POST -------------------------------------------------- */
.service('postBlazer', function($q, $http, $ionicLoading) {
return {
LoginUser: function(user) {
console.log("****** ON ENTER LOGIN SERVICE ******");
var deferred = $q.defer();
var promise = deferred.promise;
console.log("[ USER CREDENTIALS ] -> ", JSON.stringify(user));
$ionicLoading.show({ template: '<ion-spinner icon="crescent"></ion-spinner>', duration: 30000});
$http({method: 'POST', url: blazerAPI + '/login.php',
data: $.param(user),
headers : {'Content-Type': 'application/x-www-form-urlencoded'}
}).success(function(responseData) {
console.log("[ LOGIN RESPONSE ]", JSON.stringify(responseData));
if(responseData.status == 0){
$ionicLoading.show({ template: 'Invalid Credentials. Try again!', duration: 1000});
deferred.reject('Error');
}
else if(responseData.status == 1){
deferred.resolve('Success');
// $ionicLoading.show({ template: "Success!", duration: 500});
$ionicLoading.hide();
localStorage.setItem("userID", responseData.user.id);
console.log("[ USER ID ]", responseData.user.id);
}
}).error(function(responseData) {
console.error("[ ERROR ]", JSON.stringify(responseData));
deferred.reject('Error');
$ionicLoading.show({ template: "Check your connection!", duration: 500});
});
promise.success = function(fn) {
promise.then(fn);
return promise;
}
promise.error = function(fn) {
promise.then(null, fn);
return promise;
}
return promise;
},
LogTrip: function(coords, username) {
console.log("****** ON ENTER TRIP LOGGING SERVICE ******");
var deferred = $q.defer();
var promise = deferred.promise;
$ionicLoading.show({ template: '<ion-spinner icon="crescent"></ion-spinner>', duration: 500});
var logTrip = {};
var currentTrip = localStorage.getItem("currentTrip");
logTrip = {
username: username,
type: currentTrip,
coordinates: coords
}
console.log("[ TRIP JSON ]", JSON.stringify(logTrip));
$http({ method: 'POST', url: blazerAPI + '/log_trip.php',
data: $.param(logTrip),
headers : {'Content-Type': 'application/x-www-form-urlencoded'}
}).success(function(responseData) {
console.log("[ SUCCESS ]", JSON.stringify(responseData));
localStorage.setItem("tripid", responseData.trip_id);
deferred.resolve('Success');
// $ionicLoading.show({ template: "Success!", duration: 1000});
}).error(function(responseData) {
console.error("[ ERROR ]", JSON.stringify(responseData));
deferred.reject('Error');
$ionicLoading.show({ template: "Sending Error!", duration: 1000});
});
promise.success = function(fn) {
promise.then(fn);
return promise;
}
promise.error = function(fn) {
promise.then(null, fn);
return promise;
}
return promise;
},
EndTripSurvey: function(data) {
console.log("****** ON ENTER TRIP END SERVICE ******");
var deferred = $q.defer();
var promise = deferred.promise;
var endtripdata = {
"trip_id" : data.trip_id,
"username": data.username,
"depart": data.depart,
"arrive": data.arrive,
"mode": data.mode,
"exp": data.exp,
"emotion": data.emotion,
"type": data.type
};
var stringendtripdata = angular.fromJson(endtripdata);
console.log("[ END TRIP SURVEY ] -> ", JSON.stringify(data));
$ionicLoading.show({ template: '<ion-spinner icon="crescent"></ion-spinner>', duration: 30000});
$http({method: 'POST', url: blazerAPI + '/end_trip.php',
data: $.param(stringendtripdata),
headers : {'Content-Type': 'application/x-www-form-urlencoded'}
}).success(function(responseData) {
console.log("[ SUCCESS ]", JSON.stringify(responseData));
deferred.resolve('Success');
$ionicLoading.show({ template: "Submitted!", duration: 1000});
}).error(function(responseData) {
console.error("[ ERROR ]", JSON.stringify(responseData));
deferred.reject('Error');
$ionicLoading.show({ template: "Try Again!", duration: 1000});
});
promise.success = function(fn) {
promise.then(fn);
return promise;
}
promise.error = function(fn) {
promise.then(null, fn);
return promise;
}
return promise;
},
WeeklySurvey: function(data) {
console.log("****** ON ENTER WEEKLY SURVEY SERVICE ******");
var deferred = $q.defer();
var promise = deferred.promise;
console.log("[ WEEKLY DATA ] -> ", JSON.stringify(data));
$ionicLoading.show({ template: '<ion-spinner icon="crescent"></ion-spinner>', duration: 30000});
var weeklysurveydata = {
"user_id": data.user_id,
"username": data.username,
"choice": data.choice,
"survey_ans": data.survey_ans,
"date_created": data.date_created
};
$http({method: 'POST', url: blazerAPI + '/weekly_survey.php',
data: $.param(weeklysurveydata),
headers : {'Content-Type': 'application/x-www-form-urlencoded'}
}).success(function(responseData) {
console.log("[ SUCCESS ]", JSON.stringify(responseData));
deferred.resolve('Success');
$ionicLoading.show({ template: "Submitted!", duration: 1000});
}).error(function(responseData) {
console.error("[ ERROR ]", JSON.stringify(responseData));
deferred.reject('Error');
$ionicLoading.show({ template: "Try Again!", duration: 1000});
});
promise.success = function(fn) {
promise.then(fn);
return promise;
}
promise.error = function(fn) {
promise.then(null, fn);
return promise;
}
return promise;
},
TakeSharedRide: function(data) {
console.log("****** ON ENTER TAKE SHARED RIDE SERVICE ******");
var deferred = $q.defer();
var promise = deferred.promise;
console.log("[ TAKE A SHAREDRIDE DATA ] -> ", JSON.stringify(data));
$ionicLoading.show({ template: '<ion-spinner icon="crescent"></ion-spinner>', duration: 30000});
var sharedRideData = {
"ride_id": data.ride_id,
"user": data.username
};
$http({method: 'POST', url: blazerAPI + '/take_shared_ride_post.php',
data: $.param(sharedRideData),
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;
},
InterestedRide: function(data) {
console.log("****** ON ENTER INTERESTED RIDE SERVICE ******");
var deferred = $q.defer();
var promise = deferred.promise;
console.log("[ INTERESTED DATA ] -> ", JSON.stringify(data));
$ionicLoading.show({ template: '<ion-spinner icon="crescent"></ion-spinner>', duration: 30000});
var interestedRideData = {
"ride_id": data.ride_id,
"username": data.username
};
$http({method: 'POST', url: blazerAPI + '/interested_ride_post.php',
data: $.param(interestedRideData),
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;
},
OfferRide: function(data) {
console.log("****** ON ENTER OFFER RIDE SERVICE ******");
var deferred = $q.defer();
var promise = deferred.promise;
console.log("[ OFFER DATA ] -> ", JSON.stringify(data));
$ionicLoading.show({ template: '<ion-spinner icon="crescent"></ion-spinner>', duration: 30000});
var offerRiderData = {
"name": data.name,
"pickup_lat": data.pickup_lat,
"pickup_lng": data.pickup_lng,
"dest_lat": data.dest_lat,
"dest_lng": data.dest_lng,
"assembly_time": data.assembly_time,
"car_model": data.car_model,
"capacity": data.capacity,
"mobile": data.mobile,
"other": data.other
};
$http({method: 'POST', url: blazerAPI + '/offer_ride.php',
data: $.param(offerRiderData),
headers : {'Content-Type': 'application/x-www-form-urlencoded'}
}).success(function(responseData) {
console.log("[ SUCCESS ]", JSON.stringify(responseData));
deferred.resolve('Success');
$ionicLoading.show({ template: "Ride Offered", duration: 1000});
}).error(function(responseData) {
console.error("[ OFFER RIDE 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;
},
BarangayInformation: function(data) {
console.log("****** ON ENTER BARANGAY DATA SERVICE ******");
var deferred = $q.defer();
var promise = deferred.promise;
console.log("[ BARANGAY DATA ] -> ", JSON.stringify(data));
$ionicLoading.show({ template: '<ion-spinner icon="crescent"></ion-spinner>', duration: 30000});
var selectedBarangay = {
"barangay": data.barangay,
"time": data.time
};
$http({method: 'POST', url: 'http://blaze.eacomm.com/includes/barangay/barangay_percentage.php',
data: $.param(selectedBarangay),
headers : {'Content-Type': 'application/x-www-form-urlencoded'}
}).success(function(responseData) {
console.log("[ SUCCESS ]", JSON.stringify(responseData));
deferred.resolve(responseData);
$ionicLoading.hide();
return responseData;
}).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;
},
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;
},
}
})
return {
LoginUser: function(user) {
console.log("****** ON ENTER LOGIN SERVICE ******");
var deferred = $q.defer();
var promise = deferred.promise;
console.log("[ USER CREDENTIALS ] -> ", JSON.stringify(user));
$ionicLoading.show({ template: '<ion-spinner icon="crescent"></ion-spinner>', duration: 30000 });
$http({
method: 'POST',
url: blazerAPI + '/login.php',
data: $.param(user),
headers: { 'Content-Type': 'application/x-www-form-urlencoded' }
}).success(function(responseData) {
console.log("[ LOGIN RESPONSE ]", JSON.stringify(responseData));
if (responseData.status == 0) {
$ionicLoading.show({ template: 'Invalid Credentials. Try again!', duration: 1000 });
deferred.reject('Error');
} else if (responseData.status == 1) {
deferred.resolve('Success');
// $ionicLoading.show({ template: "Success!", duration: 500});
$ionicLoading.hide();
localStorage.setItem("userID", responseData.user.id);
console.log("[ USER ID ]", responseData.user.id);
}
}).error(function(responseData) {
console.error("[ ERROR ]", JSON.stringify(responseData));
deferred.reject('Error');
$ionicLoading.show({ template: "Check your connection!", duration: 500 });
});
promise.success = function(fn) {
promise.then(fn);
return promise;
}
promise.error = function(fn) {
promise.then(null, fn);
return promise;
}
return promise;
},
LogTrip: function(coords, username) {
console.log("****** ON ENTER TRIP LOGGING SERVICE ******");
var deferred = $q.defer();
var promise = deferred.promise;
$ionicLoading.show({ template: '<ion-spinner icon="crescent"></ion-spinner>', duration: 500 });
var logTrip = {};
var currentTrip = localStorage.getItem("currentTrip");
logTrip = {
username: username,
type: currentTrip,
coordinates: coords
}
console.log("[ TRIP JSON ]", JSON.stringify(logTrip));
$http({
method: 'POST',
url: blazerAPI + '/log_trip.php',
data: $.param(logTrip),
headers: { 'Content-Type': 'application/x-www-form-urlencoded' }
}).success(function(responseData) {
console.log("[ SUCCESS ]", JSON.stringify(responseData));
localStorage.setItem("tripid", responseData.trip_id);
deferred.resolve('Success');
// $ionicLoading.show({ template: "Success!", duration: 1000});
}).error(function(responseData) {
console.error("[ ERROR ]", JSON.stringify(responseData));
deferred.reject('Error');
$ionicLoading.show({ template: "Sending Error!", duration: 1000 });
});
promise.success = function(fn) {
promise.then(fn);
return promise;
}
promise.error = function(fn) {
promise.then(null, fn);
return promise;
}
return promise;
},
EndTripSurvey: function(data) {
console.log("****** ON ENTER TRIP END SERVICE ******");
var deferred = $q.defer();
var promise = deferred.promise;
var endtripdata = {
"trip_id": data.trip_id,
"username": data.username,
"depart": data.depart,
"arrive": data.arrive,
"mode": data.mode,
"exp": data.exp,
"emotion": data.emotion,
"type": data.type
};
var stringendtripdata = angular.fromJson(endtripdata);
console.log("[ END TRIP SURVEY ] -> ", JSON.stringify(data));
$ionicLoading.show({ template: '<ion-spinner icon="crescent"></ion-spinner>', duration: 30000 });
$http({
method: 'POST',
url: blazerAPI + '/end_trip.php',
data: $.param(stringendtripdata),
headers: { 'Content-Type': 'application/x-www-form-urlencoded' }
}).success(function(responseData) {
console.log("[ SUCCESS ]", JSON.stringify(responseData));
deferred.resolve('Success');
$ionicLoading.show({ template: "Submitted!", duration: 1000 });
}).error(function(responseData) {
console.error("[ ERROR ]", JSON.stringify(responseData));
deferred.reject('Error');
$ionicLoading.show({ template: "Try Again!", duration: 1000 });
});
promise.success = function(fn) {
promise.then(fn);
return promise;
}
promise.error = function(fn) {
promise.then(null, fn);
return promise;
}
return promise;
},
WeeklySurvey: function(data) {
console.log("****** ON ENTER WEEKLY SURVEY SERVICE ******");
var deferred = $q.defer();
var promise = deferred.promise;
console.log("[ WEEKLY DATA ] -> ", JSON.stringify(data));
$ionicLoading.show({ template: '<ion-spinner icon="crescent"></ion-spinner>', duration: 30000 });
var weeklysurveydata = {
"user_id": data.user_id,
"username": data.username,
"choice": data.choice,
"survey_ans": data.survey_ans,
"date_created": data.date_created
};
$http({
method: 'POST',
url: blazerAPI + '/weekly_survey.php',
data: $.param(weeklysurveydata),
headers: { 'Content-Type': 'application/x-www-form-urlencoded' }
}).success(function(responseData) {
console.log("[ SUCCESS ]", JSON.stringify(responseData));
deferred.resolve('Success');
$ionicLoading.show({ template: "Submitted!", duration: 1000 });
}).error(function(responseData) {
console.error("[ ERROR ]", JSON.stringify(responseData));
deferred.reject('Error');
$ionicLoading.show({ template: "Try Again!", duration: 1000 });
});
promise.success = function(fn) {
promise.then(fn);
return promise;
}
promise.error = function(fn) {
promise.then(null, fn);
return promise;
}
return promise;
},
TakeSharedRide: function(data) {
console.log("****** ON ENTER TAKE SHARED RIDE SERVICE ******");
var deferred = $q.defer();
var promise = deferred.promise;
console.log("[ TAKE A SHAREDRIDE DATA ] -> ", JSON.stringify(data));
$ionicLoading.show({ template: '<ion-spinner icon="crescent"></ion-spinner>', duration: 30000 });
var sharedRideData = {
"ride_id": data.ride_id,
"user": data.username
};
$http({
method: 'POST',
url: blazerAPI + '/take_shared_ride_post.php',
data: $.param(sharedRideData),
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;
},
InterestedRide: function(data) {
console.log("****** ON ENTER INTERESTED RIDE SERVICE ******");
var deferred = $q.defer();
var promise = deferred.promise;
console.log("[ INTERESTED DATA ] -> ", JSON.stringify(data));
$ionicLoading.show({ template: '<ion-spinner icon="crescent"></ion-spinner>', duration: 30000 });
var interestedRideData = {
"ride_id": data.ride_id,
"username": data.username
};
$http({
method: 'POST',
url: blazerAPI + '/interested_ride_post.php',
data: $.param(interestedRideData),
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;
},
OfferRide: function(data) {
console.log("****** ON ENTER OFFER RIDE SERVICE ******");
var deferred = $q.defer();
var promise = deferred.promise;
console.log("[ OFFER DATA ] -> ", JSON.stringify(data));
$ionicLoading.show({ template: '<ion-spinner icon="crescent"></ion-spinner>', duration: 30000 });
var offerRiderData = {
"name": data.name,
"pickup_lat": data.pickup_lat,
"pickup_lng": data.pickup_lng,
"dest_lat": data.dest_lat,
"dest_lng": data.dest_lng,
"assembly_time": data.assembly_time,
"car_model": data.car_model,
"capacity": data.capacity,
"mobile": data.mobile,
"other": data.other
};
$http({
method: 'POST',
url: blazerAPI + '/offer_ride.php',
data: $.param(offerRiderData),
headers: { 'Content-Type': 'application/x-www-form-urlencoded' }
}).success(function(responseData) {
console.log("[ SUCCESS ]", JSON.stringify(responseData));
deferred.resolve('Success');
$ionicLoading.show({ template: "Ride Offered", duration: 1000 });
}).error(function(responseData) {
console.error("[ OFFER RIDE 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;
},
BarangayInformation: function(data) {
console.log("****** ON ENTER BARANGAY DATA SERVICE ******");
var deferred = $q.defer();
var promise = deferred.promise;
console.log("[ BARANGAY DATA ] -> ", JSON.stringify(data));
$ionicLoading.show({ template: '<ion-spinner icon="crescent"></ion-spinner>', duration: 30000 });
var selectedBarangay = {
"barangay": data.barangay,
"time": data.time
};
$http({
method: 'POST',
url: 'http://blaze.eacomm.com/includes/barangay/barangay_percentage.php',
data: $.param(selectedBarangay),
headers: { 'Content-Type': 'application/x-www-form-urlencoded' }
}).success(function(responseData) {
console.log("[ SUCCESS ]", JSON.stringify(responseData));
deferred.resolve(responseData);
$ionicLoading.hide();
return responseData;
}).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;
},
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;
},
/******************** API V2 *********************/
UserSummary: function(data) {
console.log("****** ON ENTER USER SUMMARY SERVICE ******");
var deferred = $q.defer();
var promise = deferred.promise;
console.log("[ ENTRY DATA ] -> ", JSON.stringify(data));
$ionicLoading.show({ template: '<ion-spinner icon="crescent"></ion-spinner>', duration: 30000 });
var requestData = {
"user_id": data.user_id,
"username": data.username
};
$http({
method: 'POST',
url: blazerAPI_V2 + '/index.php/summary/get_summary',
data: $.param(requestData),
headers: { 'Content-Type': 'application/x-www-form-urlencoded' }
}).success(function(responseData) {
console.log("[ SUCCESS ]", JSON.stringify(responseData));
deferred.resolve(responseData);
$ionicLoading.hide();
return responseData;
}).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;
},
GetTripDetails: function(data) {
console.log("****** ON ENTER TRIP DETAILS SERVICE ******");
var deferred = $q.defer();
var promise = deferred.promise;
console.log("[ ENTRY DATA ] -> ", JSON.stringify(data));
$ionicLoading.show({ template: '<ion-spinner icon="crescent"></ion-spinner>', duration: 30000 });
var requestData = {
"username": data.username,
"date": data.date
};
$http({
method: 'POST',
url: blazerAPI_V2 + '/index.php/logger/get_trip',
data: $.param(requestData),
headers: { 'Content-Type': 'application/x-www-form-urlencoded' }
}).success(function(responseData) {
console.log("[ SUCCESS ]", JSON.stringify(responseData));
deferred.resolve(responseData);
$ionicLoading.hide();
return responseData;
}).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;
},
LogTripV2: function(data) {
console.log("****** ON ENTER LOG TRIP DETAILS SERVICE ******");
var deferred = $q.defer();
var promise = deferred.promise;
console.log("[ ENTRY DATA ] -> ", JSON.stringify(data));
$ionicLoading.show({ template: '<ion-spinner icon="crescent"></ion-spinner>', duration: 30000 });
var requestData = {
"origin": data.origin,
"destination": data.destination,
"username": data.username,
"type": data.type,
"datecreated": data.datecreated,
"depart": data.depart,
"arrive": data.arrive,
"mode": data.mode,
"exp": data.exp,
"emotion": data.emotion,
};
$http({
method: 'POST',
url: blazerAPI_V2 + '/index.php/logger/add_trip',
data: $.param(requestData),
headers: { 'Content-Type': 'application/x-www-form-urlencoded' }
}).success(function(responseData) {
console.log("[ SUCCESS ]", JSON.stringify(responseData));
deferred.resolve(responseData);
$ionicLoading.hide();
return responseData;
}).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;
},
UpdateTrip: function(data) {
console.log("****** ON ENTER UPDATE TRIP DETAILS SERVICE ******");
var deferred = $q.defer();
var promise = deferred.promise;
console.log("[ ENTRY DATA ] -> ", JSON.stringify(data));
$ionicLoading.show({ template: '<ion-spinner icon="crescent"></ion-spinner>', duration: 30000 });
var requestData = {
"trip_uploads_id": data.trip_uploads_id,
"origin": data.origin,
"destination": data.destination,
"username": data.username,
"type": data.type,
"datecreated": data.datecreated,
"depart": data.depart,
"arrive": data.arrive,
"mode": data.mode,
"exp": data.exp,
"emotion": data.emotion,
};
$http({
method: 'POST',
url: blazerAPI_V2 + '/index.php/logger/update_trip',
data: $.param(requestData),
headers: { 'Content-Type': 'application/x-www-form-urlencoded' }
}).success(function(responseData) {
console.log("[ SUCCESS ]", JSON.stringify(responseData));
deferred.resolve(responseData);
$ionicLoading.hide();
return responseData;
}).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;
},
NoTrip: function(data) {
console.log("****** ON ENTER NO TRIP DETAILS SERVICE ******");
var deferred = $q.defer();
var promise = deferred.promise;
console.log("[ ENTRY DATA ] -> ", JSON.stringify(data));
$ionicLoading.show({ template: '<ion-spinner icon="crescent"></ion-spinner>', duration: 30000 });
var requestData = {
"username": data.username,
"id": data.id,
"mode": data.mode,
"date": data.date, // YYYY-MM-DD
};
$http({
method: 'POST',
url: blazerAPI_V2 + '/index.php/logger/no_trip',
data: $.param(requestData),
headers: { 'Content-Type': 'application/x-www-form-urlencoded' }
}).success(function(responseData) {
console.log("[ SUCCESS ]", JSON.stringify(responseData));
deferred.resolve(responseData);
$ionicLoading.hide();
return responseData;
}).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;
},
VerifyTrip: function(data) {
console.log("****** ON ENTER VERIFY TRIP DETAILS SERVICE ******");
var deferred = $q.defer();
var promise = deferred.promise;
console.log("[ ENTRY DATA ] -> ", JSON.stringify(data));
$ionicLoading.show({ template: '<ion-spinner icon="crescent"></ion-spinner>', duration: 30000 });
var requestData = {
"username": data.username,
"date": data.date, // YYYY-MM-DD
};
$http({
method: 'POST',
url: blazerAPI_V2 + '/index.php/logger/verify',
data: $.param(requestData),
headers: { 'Content-Type': 'application/x-www-form-urlencoded' }
}).success(function(responseData) {
console.log("[ SUCCESS ]", JSON.stringify(responseData));
deferred.resolve(responseData);
$ionicLoading.hide();
return responseData;
}).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;
},
HometoSchoolTravelTimes: function(data) {
console.log("****** ON ENTER HOME TO SCHOOL TRIP DETAILS SERVICE ******");
var deferred = $q.defer();
var promise = deferred.promise;
console.log("[ ENTRY DATA ] -> ", JSON.stringify(data));
$ionicLoading.show({ template: '<ion-spinner icon="crescent"></ion-spinner>', duration: 30000 });
var requestData = {
"username": data.username,
"start_date": data.start_date, // YYYY-MM-DD
"end_date": data.end_date // YYYY-MM-DD
};
$http({
method: 'POST',
url: blazerAPI_V2 + '/index.php/summary/get_home_to_school_travel_time',
data: $.param(requestData),
headers: { 'Content-Type': 'application/x-www-form-urlencoded' }
}).success(function(responseData) {
console.log("[ SUCCESS ]", JSON.stringify(responseData));
deferred.resolve(responseData);
$ionicLoading.hide();
return responseData;
}).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;
},
TripLogGraph: function(data) {
console.log("****** ON ENTER TRIP LOG GRAPH DETAILS SERVICE ******");
var deferred = $q.defer();
var promise = deferred.promise;
console.log("[ ENTRY DATA ] -> ", JSON.stringify(data));
$ionicLoading.show({ template: '<ion-spinner icon="crescent"></ion-spinner>', duration: 30000 });
var requestData = {
"username": data.username,
"month": data.month, // YYYY-MM-DD
"year": data.year // YYYY-MM-DD
};
$http({
method: 'POST',
url: blazerAPI_V2 + '/index.php/summary/trip_log_graph',
data: $.param(requestData),
headers: { 'Content-Type': 'application/x-www-form-urlencoded' }
}).success(function(responseData) {
console.log("[ SUCCESS ]", JSON.stringify(responseData));
deferred.resolve(responseData);
$ionicLoading.hide();
return responseData;
}).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;
},
PerformanceSummary: function(data) {
console.log("****** ON ENTER PERFORMANCE SUMMARY DETAILS SERVICE ******");
var deferred = $q.defer();
var promise = deferred.promise;
console.log("[ ENTRY DATA ] -> ", JSON.stringify(data));
$ionicLoading.show({ template: '<ion-spinner icon="crescent"></ion-spinner>', duration: 30000 });
var requestData = {
"user_id": data.user_id,
"date": data.date, // YYYY-MM-DD
};
$http({
method: 'POST',
url: blazerAPI_V2 + '/index.php/summary/performance',
data: $.param(requestData),
headers: { 'Content-Type': 'application/x-www-form-urlencoded' }
}).success(function(responseData) {
console.log("[ SUCCESS ]", JSON.stringify(responseData));
deferred.resolve(responseData);
$ionicLoading.hide();
return responseData;
}).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;
},
/*********** MAP DIRECTIVES ***********/
.service('LocationService', function($q){
var autocompleteService = new google.maps.places.AutocompleteService();
var detailsService = new google.maps.places.PlacesService(document.createElement("input"));
return {
searchAddress: function(input) {
var deferred = $q.defer();
autocompleteService.getPlacePredictions({
input: input
}, function(result, status) {
if(status == google.maps.places.PlacesServiceStatus.OK){
console.log(status);
deferred.resolve(result);
}else{
deferred.reject(status)
}
});
return deferred.promise;
},
getDetails: function(placeId) {
var deferred = $q.defer();
detailsService.getDetails({placeId: placeId}, function(result) {
deferred.resolve(result);
});
return deferred.promise;
}
};
})
.directive('locationSuggestion', function($ionicModal, LocationService){
return {
restrict: 'A',
scope: {
location: '='
},
link: function($scope, element){
console.log('locationSuggestion started!');
$scope.search = {};
$scope.search.suggestions = [];
$scope.search.query = "";
$ionicModal.fromTemplateUrl('app/offerride/popover/location.html', {
scope: $scope,
focusFirstInput: true
}).then(function(modal) {
$scope.modal = modal;
});
element[0].addEventListener('focus', function(event) {
$scope.open();
});
$scope.$watch('search.query', function(newValue) {
if (newValue) {
LocationService.searchAddress(newValue).then(function(result) {
$scope.search.error = null;
$scope.search.suggestions = result;
}, function(status){
$scope.search.error = "There was an error :( " + status;
});
};
$scope.open = function() {
$scope.modal.show();
};
$scope.close = function() {
$scope.modal.hide();
};
$scope.choosePlace = function(place) {
LocationService.getDetails(place.place_id).then(function(location) {
$scope.location = location;
$scope.close();
});
/*********** MAP DIRECTIVES ***********/
.service('LocationService', function($q) {
var autocompleteService = new google.maps.places.AutocompleteService();
var detailsService = new google.maps.places.PlacesService(document.createElement("input"));
return {
searchAddress: function(input) {
var deferred = $q.defer();
autocompleteService.getPlacePredictions({
input: input
}, function(result, status) {
if (status == google.maps.places.PlacesServiceStatus.OK) {
console.log(status);
deferred.resolve(result);
} else {
deferred.reject(status)
}
});
return deferred.promise;
},
getDetails: function(placeId) {
var deferred = $q.defer();
detailsService.getDetails({ placeId: placeId }, function(result) {
deferred.resolve(result);
});
return deferred.promise;
}
};
});
}
}
})
;
})
.directive('locationSuggestion', function($ionicModal, LocationService) {
return {
restrict: 'A',
scope: {
location: '='
},
link: function($scope, element) {
console.log('locationSuggestion started!');
$scope.search = {};
$scope.search.suggestions = [];
$scope.search.query = "";
$ionicModal.fromTemplateUrl('app/offerride/popover/location.html', {
scope: $scope,
focusFirstInput: true
}).then(function(modal) {
$scope.modal = modal;
});
element[0].addEventListener('focus', function(event) {
$scope.open();
});
$scope.$watch('search.query', function(newValue) {
if (newValue) {
LocationService.searchAddress(newValue).then(function(result) {
$scope.search.error = null;
$scope.search.suggestions = result;
}, function(status) {
$scope.search.error = "There was an error :( " + status;
});
};
$scope.open = function() {
$scope.modal.show();
};
$scope.close = function() {
$scope.modal.hide();
};
$scope.choosePlace = function(place) {
LocationService.getDetails(place.place_id).then(function(location) {
$scope.location = location;
$scope.close();
});
};
});
}
}
});
\ No newline at end of file
var blazerAPI = 'http://blaze.eacomm.com/api';
var appVersion = '1.0.0';
var buildNumber = '1.0.0';
var blazerAPI_V2 = 'http://blaze.eacomm.com/api_v2';
var appVersion = '2.0.0';
var buildNumber = '0.0.1';
var maplayer = 'http://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png';
// 'https://api.mapbox.com/styles/v1/mapbox/streets-v9/tiles/256/{z}/{x}/{y}?access_token=pk.eyJ1IjoiemVyb2Rlbm5pcyIsImEiOiJjaXNjeGxheWkwMDJtMm52bzMzd2lyNmZ4In0.IkVfNZVJ6eE8WCssMvrJiA'
\ No newline at end of file
(function (factory) {
'use strict';
if (typeof exports === 'object') {
// Node/CommonJS
module.exports = factory(
typeof angular !== 'undefined' ? angular : require('angular'),
typeof Chart !== 'undefined' ? Chart : require('chart.js'));
} else if (typeof define === 'function' && define.amd) {
// AMD. Register as an anonymous module.
define(['angular', 'chart'], factory);
} else {
// Browser globals
factory(angular, Chart);
}
}(function (angular, Chart) {
'use strict';
Chart.defaults.global.responsive = true;
Chart.defaults.global.multiTooltipTemplate = '<%if (datasetLabel){%><%=datasetLabel%>: <%}%><%= value %>';
Chart.defaults.global.colours = [
'#97BBCD', // blue
'#DCDCDC', // light grey
'#F7464A', // red
'#46BFBD', // green
'#FDB45C', // yellow
'#949FB1', // grey
'#4D5360' // dark grey
];
var usingExcanvas = typeof window.G_vmlCanvasManager === 'object' &&
window.G_vmlCanvasManager !== null &&
typeof window.G_vmlCanvasManager.initElement === 'function';
if (usingExcanvas) Chart.defaults.global.animation = false;
return angular.module('chart.js', [])
.provider('ChartJs', ChartJsProvider)
.factory('ChartJsFactory', ['ChartJs', '$timeout', ChartJsFactory])
.directive('chartBase', ['ChartJsFactory', function (ChartJsFactory) { return new ChartJsFactory(); }])
.directive('chartLine', ['ChartJsFactory', function (ChartJsFactory) { return new ChartJsFactory('Line'); }])
.directive('chartBar', ['ChartJsFactory', function (ChartJsFactory) { return new ChartJsFactory('Bar'); }])
.directive('chartRadar', ['ChartJsFactory', function (ChartJsFactory) { return new ChartJsFactory('Radar'); }])
.directive('chartDoughnut', ['ChartJsFactory', function (ChartJsFactory) { return new ChartJsFactory('Doughnut'); }])
.directive('chartPie', ['ChartJsFactory', function (ChartJsFactory) { return new ChartJsFactory('Pie'); }])
.directive('chartPolarArea', ['ChartJsFactory', function (ChartJsFactory) { return new ChartJsFactory('PolarArea'); }]);
/**
* Wrapper for chart.js
* Allows configuring chart js using the provider
*
* angular.module('myModule', ['chart.js']).config(function(ChartJsProvider) {
* ChartJsProvider.setOptions({ responsive: true });
* ChartJsProvider.setOptions('Line', { responsive: false });
* })))
*/
function ChartJsProvider () {
var options = {};
var ChartJs = {
Chart: Chart,
getOptions: function (type) {
var typeOptions = type && options[type] || {};
return angular.extend({}, options, typeOptions);
}
};
(function(factory) {
'use strict';
if (typeof exports === 'object') {
// Node/CommonJS
module.exports = factory(
typeof angular !== 'undefined' ? angular : require('angular'),
typeof Chart !== 'undefined' ? Chart : require('chart.js'));
} else if (typeof define === 'function' && define.amd) {
// AMD. Register as an anonymous module.
define(['angular', 'chart'], factory);
} else {
// Browser globals
factory(angular, Chart);
}
}(function(angular, Chart) {
'use strict';
Chart.defaults.global.responsive = true;
Chart.defaults.global.multiTooltipTemplate = '<%if (datasetLabel){%><%=datasetLabel%>: <%}%><%= value %>';
Chart.defaults.global.colours = [
'#97BBCD', // blue
'#DCDCDC', // light grey
'#F7464A', // red
'#46BFBD', // green
'#FDB45C', // yellow
'#949FB1', // grey
'#4D5360' // dark grey
];
var usingExcanvas = typeof window.G_vmlCanvasManager === 'object' &&
window.G_vmlCanvasManager !== null &&
typeof window.G_vmlCanvasManager.initElement === 'function';
if (usingExcanvas) Chart.defaults.global.animation = false;
return angular.module('chart.js', [])
.provider('ChartJs', ChartJsProvider)
.factory('ChartJsFactory', ['ChartJs', '$timeout', ChartJsFactory])
.directive('chartBase', ['ChartJsFactory', function(ChartJsFactory) { return new ChartJsFactory(); }])
.directive('chartLine', ['ChartJsFactory', function(ChartJsFactory) { return new ChartJsFactory('Line'); }])
.directive('chartBar', ['ChartJsFactory', function(ChartJsFactory) { return new ChartJsFactory('Bar'); }])
.directive('chartRadar', ['ChartJsFactory', function(ChartJsFactory) { return new ChartJsFactory('Radar'); }])
.directive('chartDoughnut', ['ChartJsFactory', function(ChartJsFactory) { return new ChartJsFactory('Doughnut'); }])
.directive('chartPie', ['ChartJsFactory', function(ChartJsFactory) { return new ChartJsFactory('Pie'); }])
.directive('chartPolarArea', ['ChartJsFactory', function(ChartJsFactory) { return new ChartJsFactory('PolarArea'); }]);
/**
* Allow to set global options during configuration
* Wrapper for chart.js
* Allows configuring chart js using the provider
*
* angular.module('myModule', ['chart.js']).config(function(ChartJsProvider) {
* ChartJsProvider.setOptions({ responsive: true });
* ChartJsProvider.setOptions('Line', { responsive: false });
* })))
*/
this.setOptions = function (type, customOptions) {
// If no type was specified set option for the global object
if (! customOptions) {
customOptions = type;
options = angular.extend(options, customOptions);
return;
}
// Set options for the specific chart
options[type] = angular.extend(options[type] || {}, customOptions);
};
this.$get = function () {
return ChartJs;
};
}
function ChartJsFactory (ChartJs, $timeout) {
return function chart (type) {
return {
restrict: 'CA',
scope: {
data: '=?',
labels: '=?',
options: '=?',
series: '=?',
colours: '=?',
getColour: '=?',
chartType: '=',
legend: '@',
click: '=?',
hover: '=?',
chartData: '=?',
chartLabels: '=?',
chartOptions: '=?',
chartSeries: '=?',
chartColours: '=?',
chartLegend: '@',
chartClick: '=?',
chartHover: '=?'
},
link: function (scope, elem/*, attrs */) {
var chart, container = document.createElement('div');
container.className = 'chart-container';
elem.replaceWith(container);
container.appendChild(elem[0]);
if (usingExcanvas) window.G_vmlCanvasManager.initElement(elem[0]);
['data', 'labels', 'options', 'series', 'colours', 'legend', 'click', 'hover'].forEach(deprecated);
function aliasVar (fromName, toName) {
scope.$watch(fromName, function (newVal) {
if (typeof newVal === 'undefined') return;
scope[toName] = newVal;
});
}
/* provide backward compatibility to "old" directive names, by
* having an alias point from the new names to the old names. */
aliasVar('chartData', 'data');
aliasVar('chartLabels', 'labels');
aliasVar('chartOptions', 'options');
aliasVar('chartSeries', 'series');
aliasVar('chartColours', 'colours');
aliasVar('chartLegend', 'legend');
aliasVar('chartClick', 'click');
aliasVar('chartHover', 'hover');
// Order of setting "watch" matter
scope.$watch('data', function (newVal, oldVal) {
if (! newVal || ! newVal.length || (Array.isArray(newVal[0]) && ! newVal[0].length)) return;
var chartType = type || scope.chartType;
if (! chartType) return;
if (chart) {
if (canUpdateChart(newVal, oldVal)) return updateChart(chart, newVal, scope, elem);
chart.destroy();
function ChartJsProvider() {
var options = {};
var ChartJs = {
Chart: Chart,
getOptions: function(type) {
var typeOptions = type && options[type] || {};
return angular.extend({}, options, typeOptions);
}
createChart(chartType);
}, true);
scope.$watch('series', resetChart, true);
scope.$watch('labels', resetChart, true);
scope.$watch('options', resetChart, true);
scope.$watch('colours', resetChart, true);
scope.$watch('chartType', function (newVal, oldVal) {
if (isEmpty(newVal)) return;
if (angular.equals(newVal, oldVal)) return;
if (chart) chart.destroy();
createChart(newVal);
});
scope.$on('$destroy', function () {
if (chart) chart.destroy();
});
function resetChart (newVal, oldVal) {
if (isEmpty(newVal)) return;
if (angular.equals(newVal, oldVal)) return;
var chartType = type || scope.chartType;
if (! chartType) return;
// chart.update() doesn't work for series and labels
// so we have to re-create the chart entirely
if (chart) chart.destroy();
createChart(chartType);
}
function createChart (type) {
if (isResponsive(type, scope) && elem[0].clientHeight === 0 && container.clientHeight === 0) {
return $timeout(function () {
createChart(type);
}, 50, false);
};
/**
* Allow to set global options during configuration
*/
this.setOptions = function(type, customOptions) {
// If no type was specified set option for the global object
if (!customOptions) {
customOptions = type;
options = angular.extend(options, customOptions);
return;
}
if (! scope.data || ! scope.data.length) return;
scope.getColour = typeof scope.getColour === 'function' ? scope.getColour : getRandomColour;
scope.colours = getColours(type, scope);
var cvs = elem[0], ctx = cvs.getContext('2d');
var data = Array.isArray(scope.data[0]) ?
getDataSets(scope.labels, scope.data, scope.series || [], scope.colours) :
getData(scope.labels, scope.data, scope.colours);
var options = angular.extend({}, ChartJs.getOptions(type), scope.options);
chart = new ChartJs.Chart(ctx)[type](data, options);
scope.$emit('create', chart);
// Bind events
cvs.onclick = scope.click ? getEventHandler(scope, chart, 'click', false) : angular.noop;
cvs.onmousemove = scope.hover ? getEventHandler(scope, chart, 'hover', true) : angular.noop;
// Set options for the specific chart
options[type] = angular.extend(options[type] || {}, customOptions);
};
if (scope.legend && scope.legend !== 'false') setLegend(elem, chart);
}
function deprecated (attr) {
if (typeof console !== 'undefined' && ChartJs.getOptions().env !== 'test') {
var warn = typeof console.warn === 'function' ? console.warn : console.log;
if (!! scope[attr]) {
warn.call(console, '"%s" is deprecated and will be removed in a future version. ' +
'Please use "chart-%s" instead.', attr, attr);
}
this.$get = function() {
return ChartJs;
};
}
function ChartJsFactory(ChartJs, $timeout) {
return function chart(type) {
return {
restrict: 'CA',
scope: {
data: '=?',
labels: '=?',
options: '=?',
series: '=?',
colours: '=?',
getColour: '=?',
chartType: '=',
legend: '@',
click: '=?',
hover: '=?',
chartData: '=?',
chartLabels: '=?',
chartOptions: '=?',
chartSeries: '=?',
chartColours: '=?',
chartLegend: '@',
chartClick: '=?',
chartHover: '=?'
},
link: function(scope, elem /*, attrs */ ) {
var chart, container = document.createElement('div');
container.className = 'chart-container';
elem.replaceWith(container);
container.appendChild(elem[0]);
if (usingExcanvas) window.G_vmlCanvasManager.initElement(elem[0]);
['data', 'labels', 'options', 'series', 'colours', 'legend', 'click', 'hover'].forEach(deprecated);
function aliasVar(fromName, toName) {
scope.$watch(fromName, function(newVal) {
if (typeof newVal === 'undefined') return;
scope[toName] = newVal;
});
}
/* provide backward compatibility to "old" directive names, by
* having an alias point from the new names to the old names. */
aliasVar('chartData', 'data');
aliasVar('chartLabels', 'labels');
aliasVar('chartOptions', 'options');
aliasVar('chartSeries', 'series');
aliasVar('chartColours', 'colours');
aliasVar('chartLegend', 'legend');
aliasVar('chartClick', 'click');
aliasVar('chartHover', 'hover');
// Order of setting "watch" matter
scope.$watch('data', function(newVal, oldVal) {
if (!newVal || !newVal.length || (Array.isArray(newVal[0]) && !newVal[0].length)) return;
var chartType = type || scope.chartType;
if (!chartType) return;
if (chart) {
if (canUpdateChart(newVal, oldVal)) return updateChart(chart, newVal, scope, elem);
chart.destroy();
}
createChart(chartType);
}, true);
scope.$watch('series', resetChart, true);
scope.$watch('labels', resetChart, true);
scope.$watch('options', resetChart, true);
scope.$watch('colours', resetChart, true);
scope.$watch('chartType', function(newVal, oldVal) {
if (isEmpty(newVal)) return;
if (angular.equals(newVal, oldVal)) return;
if (chart) chart.destroy();
createChart(newVal);
});
scope.$on('$destroy', function() {
if (chart) chart.destroy();
});
function resetChart(newVal, oldVal) {
if (isEmpty(newVal)) return;
if (angular.equals(newVal, oldVal)) return;
var chartType = type || scope.chartType;
if (!chartType) return;
// chart.update() doesn't work for series and labels
// so we have to re-create the chart entirely
if (chart) chart.destroy();
createChart(chartType);
}
function createChart(type) {
if (isResponsive(type, scope) && elem[0].clientHeight === 0 && container.clientHeight === 0) {
return $timeout(function() {
createChart(type);
}, 50, false);
}
if (!scope.data || !scope.data.length) return;
scope.getColour = typeof scope.getColour === 'function' ? scope.getColour : getRandomColour;
scope.colours = getColours(type, scope);
var cvs = elem[0],
ctx = cvs.getContext('2d');
var data = Array.isArray(scope.data[0]) ?
getDataSets(scope.labels, scope.data, scope.series || [], scope.colours) :
getData(scope.labels, scope.data, scope.colours);
var options = angular.extend({}, ChartJs.getOptions(type), scope.options);
chart = new ChartJs.Chart(ctx)[type](data, options);
scope.$emit('create', chart);
// Bind events
cvs.onclick = scope.click ? getEventHandler(scope, chart, 'click', false) : angular.noop;
cvs.onmousemove = scope.hover ? getEventHandler(scope, chart, 'hover', true) : angular.noop;
if (scope.legend && scope.legend !== 'false') setLegend(elem, chart);
}
function deprecated(attr) {
if (typeof console !== 'undefined' && ChartJs.getOptions().env !== 'test') {
var warn = typeof console.warn === 'function' ? console.warn : console.log;
if (!!scope[attr]) {
warn.call(console, '"%s" is deprecated and will be removed in a future version. ' +
'Please use "chart-%s" instead.', attr, attr);
}
}
}
}
};
};
function canUpdateChart(newVal, oldVal) {
if (newVal && oldVal && newVal.length && oldVal.length) {
return Array.isArray(newVal[0]) ?
newVal.length === oldVal.length && newVal.every(function(element, index) {
return element.length === oldVal[index].length;
}) :
oldVal.reduce(sum, 0) > 0 ? newVal.length === oldVal.length : false;
}
}
return false;
}
};
};
function canUpdateChart (newVal, oldVal) {
if (newVal && oldVal && newVal.length && oldVal.length) {
return Array.isArray(newVal[0]) ?
newVal.length === oldVal.length && newVal.every(function (element, index) {
return element.length === oldVal[index].length; }) :
oldVal.reduce(sum, 0) > 0 ? newVal.length === oldVal.length : false;
}
return false;
}
function sum (carry, val) {
return carry + val;
}
function sum(carry, val) {
return carry + val;
}
function getEventHandler (scope, chart, action, triggerOnlyOnChange) {
var lastState = null;
return function (evt) {
var atEvent = chart.getPointsAtEvent || chart.getBarsAtEvent || chart.getSegmentsAtEvent;
if (atEvent) {
var activePoints = atEvent.call(chart, evt);
if (triggerOnlyOnChange === false || angular.equals(lastState, activePoints) === false) {
lastState = activePoints;
scope[action](activePoints, evt);
scope.$apply();
}
function getEventHandler(scope, chart, action, triggerOnlyOnChange) {
var lastState = null;
return function(evt) {
var atEvent = chart.getPointsAtEvent || chart.getBarsAtEvent || chart.getSegmentsAtEvent;
if (atEvent) {
var activePoints = atEvent.call(chart, evt);
if (triggerOnlyOnChange === false || angular.equals(lastState, activePoints) === false) {
lastState = activePoints;
scope[action](activePoints, evt);
scope.$apply();
}
}
};
}
};
}
function getColours (type, scope) {
var colours = angular.copy(scope.colours ||
ChartJs.getOptions(type).colours ||
Chart.defaults.global.colours
);
while (colours.length < scope.data.length) {
colours.push(scope.getColour());
}
return colours.map(convertColour);
}
function getColours(type, scope) {
var colours = angular.copy(scope.colours ||
ChartJs.getOptions(type).colours ||
Chart.defaults.global.colours
);
while (colours.length < scope.data.length) {
colours.push(scope.getColour());
}
return colours.map(convertColour);
}
function convertColour (colour) {
if (typeof colour === 'object' && colour !== null) return colour;
if (typeof colour === 'string' && colour[0] === '#') return getColour(hexToRgb(colour.substr(1)));
return getRandomColour();
}
function convertColour(colour) {
if (typeof colour === 'object' && colour !== null) return colour;
if (typeof colour === 'string' && colour[0] === '#') return getColour(hexToRgb(colour.substr(1)));
return getRandomColour();
}
function getRandomColour () {
var colour = [getRandomInt(0, 255), getRandomInt(0, 255), getRandomInt(0, 255)];
return getColour(colour);
}
function getRandomColour() {
var colour = [getRandomInt(0, 255), getRandomInt(0, 255), getRandomInt(0, 255)];
return getColour(colour);
}
function getColour (colour) {
return {
fillColor: rgba(colour, 0.2),
strokeColor: rgba(colour, 1),
pointColor: rgba(colour, 1),
pointStrokeColor: '#fff',
pointHighlightFill: '#fff',
pointHighlightStroke: rgba(colour, 0.8)
};
}
function getColour(colour) {
return {
fillColor: rgba(colour, 0.2),
strokeColor: rgba(colour, 1),
pointColor: rgba(colour, 1),
pointStrokeColor: '#fff',
pointHighlightFill: '#fff',
pointHighlightStroke: rgba(colour, 0.8)
};
}
function getRandomInt (min, max) {
return Math.floor(Math.random() * (max - min + 1)) + min;
}
function getRandomInt(min, max) {
return Math.floor(Math.random() * (max - min + 1)) + min;
}
function rgba (colour, alpha) {
if (usingExcanvas) {
// rgba not supported by IE8
return 'rgb(' + colour.join(',') + ')';
} else {
return 'rgba(' + colour.concat(alpha).join(',') + ')';
}
}
function rgba(colour, alpha) {
if (usingExcanvas) {
// rgba not supported by IE8
return 'rgb(' + colour.join(',') + ')';
} else {
return 'rgba(' + colour.concat(alpha).join(',') + ')';
}
}
// Credit: http://stackoverflow.com/a/11508164/1190235
function hexToRgb (hex) {
var bigint = parseInt(hex, 16),
r = (bigint >> 16) & 255,
g = (bigint >> 8) & 255,
b = bigint & 255;
// Credit: http://stackoverflow.com/a/11508164/1190235
function hexToRgb(hex) {
var bigint = parseInt(hex, 16),
r = (bigint >> 16) & 255,
g = (bigint >> 8) & 255,
b = bigint & 255;
return [r, g, b];
}
return [r, g, b];
}
function getDataSets (labels, data, series, colours) {
return {
labels: labels,
datasets: data.map(function (item, i) {
return angular.extend({}, colours[i], {
label: series[i],
data: item
});
})
};
}
function getDataSets(labels, data, series, colours) {
return {
labels: labels,
datasets: data.map(function(item, i) {
return angular.extend({}, colours[i], {
label: series[i],
data: item
});
})
};
}
function getData (labels, data, colours) {
return labels.map(function (label, i) {
return angular.extend({}, colours[i], {
label: label,
value: data[i],
color: colours[i].strokeColor,
highlight: colours[i].pointHighlightStroke
});
});
}
function getData(labels, data, colours) {
return labels.map(function(label, i) {
return angular.extend({}, colours[i], {
label: label,
value: data[i],
color: colours[i].strokeColor,
highlight: colours[i].pointHighlightStroke
});
});
}
function setLegend (elem, chart) {
var $parent = elem.parent(),
$oldLegend = $parent.find('chart-legend'),
legend = '<chart-legend>' + chart.generateLegend() + '</chart-legend>';
if ($oldLegend.length) $oldLegend.replaceWith(legend);
else $parent.append(legend);
}
function setLegend(elem, chart) {
var $parent = elem.parent(),
$oldLegend = $parent.find('chart-legend'),
legend = '<chart-legend>' + chart.generateLegend() + '</chart-legend>';
if ($oldLegend.length) $oldLegend.replaceWith(legend);
else $parent.append(legend);
}
function updateChart (chart, values, scope, elem) {
if (Array.isArray(scope.data[0])) {
chart.datasets.forEach(function (dataset, i) {
(dataset.points || dataset.bars).forEach(function (dataItem, j) {
dataItem.value = values[i][j];
});
});
} else {
chart.segments.forEach(function (segment, i) {
segment.value = values[i];
});
}
chart.update();
scope.$emit('update', chart);
if (scope.legend && scope.legend !== 'false') setLegend(elem, chart);
}
function updateChart(chart, values, scope, elem) {
if (Array.isArray(scope.data[0])) {
chart.datasets.forEach(function(dataset, i) {
(dataset.points || dataset.bars).forEach(function(dataItem, j) {
dataItem.value = values[i][j];
});
});
} else {
chart.segments.forEach(function(segment, i) {
segment.value = values[i];
});
}
chart.update();
scope.$emit('update', chart);
if (scope.legend && scope.legend !== 'false') setLegend(elem, chart);
}
function isEmpty (value) {
return ! value ||
(Array.isArray(value) && ! value.length) ||
(typeof value === 'object' && ! Object.keys(value).length);
}
function isEmpty(value) {
return !value ||
(Array.isArray(value) && !value.length) ||
(typeof value === 'object' && !Object.keys(value).length);
}
function isResponsive (type, scope) {
var options = angular.extend({}, Chart.defaults.global, ChartJs.getOptions(type), scope.options);
return options.responsive;
function isResponsive(type, scope) {
var options = angular.extend({}, Chart.defaults.global, ChartJs.getOptions(type), scope.options);
return options.responsive;
}
}
}
}));
}));
\ No newline at end of file
/*
* L.TileLayer is used for standard xyz-numbered tile layers.
*/
L.Google = L.Class.extend({
includes: L.Mixin.Events,
options: {
minZoom: 0,
maxZoom: 18,
tileSize: 256,
subdomains: 'abc',
errorTileUrl: '',
attribution: '',
opacity: 1,
continuousWorld: false,
noWrap: false,
},
// Possible types: SATELLITE, ROADMAP, HYBRID
initialize: function(type, options) {
L.Util.setOptions(this, options);
this._type = google.maps.MapTypeId[type || 'SATELLITE'];
},
onAdd: function(map, insertAtTheBottom) {
this._map = map;
this._insertAtTheBottom = insertAtTheBottom;
// create a container div for tiles
this._initContainer();
this._initMapObject();
// set up events
map.on('viewreset', this._resetCallback, this);
this._limitedUpdate = L.Util.limitExecByInterval(this._update, 150, this);
map.on('move', this._update, this);
//map.on('moveend', this._update, this);
this._reset();
this._update();
},
onRemove: function(map) {
this._map._container.removeChild(this._container);
//this._container = null;
this._map.off('viewreset', this._resetCallback, this);
this._map.off('move', this._update, this);
//this._map.off('moveend', this._update, this);
},
getAttribution: function() {
return this.options.attribution;
},
setOpacity: function(opacity) {
this.options.opacity = opacity;
if (opacity < 1) {
L.DomUtil.setOpacity(this._container, opacity);
}
},
_initContainer: function() {
var tilePane = this._map._container
first = tilePane.firstChild;
if (!this._container) {
this._container = L.DomUtil.create('div', 'leaflet-google-layer leaflet-top leaflet-left');
this._container.id = "_GMapContainer";
}
if (true) {
tilePane.insertBefore(this._container, first);
this.setOpacity(this.options.opacity);
var size = this._map.getSize();
this._container.style.width = size.x + 'px';
this._container.style.height = size.y + 'px';
}
},
_initMapObject: function() {
this._google_center = new google.maps.LatLng(0, 0);
var map = new google.maps.Map(this._container, {
center: this._google_center,
zoom: 0,
mapTypeId: this._type,
disableDefaultUI: true,
keyboardShortcuts: false,
draggable: false,
disableDoubleClickZoom: true,
scrollwheel: false,
streetViewControl: false
});
var _this = this;
this._reposition = google.maps.event.addListenerOnce(map, "center_changed",
function() { _this.onReposition(); });
map.backgroundColor = '#ff0000';
this._google = map;
},
_resetCallback: function(e) {
this._reset(e.hard);
},
_reset: function(clearOldContainer) {
this._initContainer();
},
_update: function() {
this._resize();
var bounds = this._map.getBounds();
var ne = bounds.getNorthEast();
var sw = bounds.getSouthWest();
var google_bounds = new google.maps.LatLngBounds(
new google.maps.LatLng(sw.lat, sw.lng),
new google.maps.LatLng(ne.lat, ne.lng)
);
var center = this._map.getCenter();
var _center = new google.maps.LatLng(center.lat, center.lng);
this._google.setCenter(_center);
this._google.setZoom(this._map.getZoom());
//this._google.fitBounds(google_bounds);
},
_resize: function() {
var size = this._map.getSize();
if (this._container.style.width == size.x &&
this._container.style.height == size.y)
return;
this._container.style.width = size.x + 'px';
this._container.style.height = size.y + 'px';
google.maps.event.trigger(this._google, "resize");
},
onReposition: function() {
//google.maps.event.trigger(this._google, "resize");
}
});
\ No newline at end of file
<ion-view view-title="My Trip Diary" ng-init="loadComparisonMessages();">
<ion-nav-buttons side="right">
</ion-nav-buttons>
<ion-content padding="true">
<ion-refresher pulling-text="Pull to refresh" on-refresh="loadComparisonMessages(); clearGraphs();"></ion-refresher>
<div class="card">
<div class="item item-header item-clear bgbluegreen text-light"> Comparison Message </div>
<div class="item item-body">
<p>Some Interesting Facts:</p>
<p>"Your shortest travel time is {{comparisonMessage.best_time}} minutes."</p>
<p>"Your worst travel time is {{comparisonMessage.worst_time}} minutes."</p>
<p>"By comparison, {{comparisonMessage.zero_car_user}} who lives in the same area as you do achieved the shortest travel time of {{comparisonMessage.best_near_car_blazer}} minutes."</p>
</div>
</form>
</div>
<div class="card">
<div class="item item-header item-clear bgbluegreen text-light"> Home to School Travel Times </div>
<div class="item">
<form name="form_1">
<label class="item item-input">
<span class="input-label">Start Date:</span>
<input type="date" ng-model="request.start_date" required>
</label>
<label class="item item-input">
<span class="input-label">End Date:</span>
<input type="date" ng-model="request.end_date" required>
</label>
<button class="button button-block button-dark button-outline" ng-disabled="form_1.$invalid" ng-click="loadHometoSchoolTravel();"> Show </button>
</div>
<div class="item item-body">
<p>Range: {{request.start_date | date:'mediumDate'}} - {{request.end_date | date:'mediumDate'}}</p>
<canvas id="line" class="chart chart-line" chart-data="htsdata" chart-labels="htslabels" chart-options="options" chart-dataset-override="datasetOverride" chart-click="onClick"></canvas>
</div>
</form>
</div>
<div class="card">
<div class="item item-header item-clear bgbluegreen text-light"> Mode Use by Trips </div>
<div class="item item-body">
<form name="form_2">
<label class="item item-input">
<span class="input-label">Start Date:</span>
<input type="date" ng-model="requestMode.start_date" required>
</label>
<label class="item item-input">
<span class="input-label">End Date:</span>
<input type="date" ng-model="requestMode.end_date" required>
</label>
<button class="button button-block button-dark button-outline" ng-disabled="form_2.$invalid" ng-click="loadModeUseTravel();"> Show </button>
</div>
<div class="item item-body">
<p>Range: {{requestMode.start_date | date:'mediumDate'}} - {{requestMode.end_date | date:'mediumDate'}}</p>
<canvas id="pie" class="chart chart-pie" chart-data="hmadata" chart-labels="hmalabels"></canvas>
</div>
</div>
</ion-content>
</ion-view>
\ No newline at end of file
angular.module('blazer.diarycontrollers', [])
.controller('DiaryCtrl', function($scope, $filter, getBlazer, postBlazer) {
$scope.request = {};
$scope.travelData = {};
$scope.htslabels = {};
$scope.htsdata = {};
$scope.loadHometoSchoolTravel = function() {
$scope.htslabels = [];
$scope.htsdata = [];
var request = {
username: localStorage.getItem("username"),
start_date: $filter('date')($scope.request.start_date, 'yyyy-MM-dd'),
end_date: $filter('date')($scope.request.end_date, 'yyyy-MM-dd'),
}
postBlazer.HometoSchoolTravelTimes(request)
.success(function(response) {
console.log("HOME TO SCHOOL DATA", JSON.stringify(response));
$scope.travelData = response.travel_times;
$scope.htslabels = [];
$scope.htsdata = [];
for (var i = 0; i < $scope.travelData.length; i++) {
console.log("[ PARSED DATA ]", JSON.stringify($scope.travelData[i]));
var string_data = $scope.travelData[i].date;
$scope.htslabels.push([string_data.toString()]);
$scope.htsdata.push([$scope.travelData[i].time]);
}
console.log(JSON.stringify($scope.htslabels));
console.log(JSON.stringify($scope.htsdata));
})
.error(function(response) {
console.error("HOME TO SCHOOL ERROR", response);
});
}
$scope.requestMode = {};
$scope.hmadata = [];
$scope.hmalabels = [];
$scope.loadModeUseTravel = function() {
$scope.hmadata = [];
$scope.hmalabels = [];
var requestMode = {
username: localStorage.getItem("username"),
start_date: $filter('date')($scope.request.start_date, 'yyyy-MM-dd'),
end_date: $filter('date')($scope.request.end_date, 'yyyy-MM-dd'),
}
getBlazer.getHowYouMoveAround(requestMode.start_date, requestMode.end_date, requestMode.username).then(function(data) {
console.log("[ TRAVEL MODE ]", JSON.stringify(data));
if (!data) {
$ionicLoading.show({ template: "No data for this request", duration: 1000 });
} else {
angular.forEach(data, function(value, key) {
$scope.hmalabels.push([key]);
$scope.hmadata.push(value);
});
console.log($scope.hmalabels);
console.log($scope.hmadata);
}
});
}
$scope.comparisonMessage = {};
$scope.loadComparisonMessages = function() {
$scope.$broadcast('scroll.refreshComplete');
var requestMode = {
username: localStorage.getItem("username")
}
getBlazer.getComparisonMessage(requestMode.username).then(function(data) {
console.log("[ TRAVEL MODE ]", JSON.stringify(data));
$scope.comparisonMessage = {
best_time: data.fact_1.best_time,
worst_time: data.fact_1.worst_time,
best_time_near: data.fact_1.best_time_near,
total_car_usage: data.fact_2.total_car_usage,
best_near_car_usage: data.fact_2.best_near_car_usage,
best_near_car_blazer: data.fact_2.best_near_car_blazer,
zero_car_user: data.fact_2.zero_car_user
}
});
}
$scope.clearGraphs = function() {
$scope.$broadcast('scroll.refreshComplete');
$scope.requestMode = {};
$scope.hmadata = [];
$scope.hmalabels = [];
$scope.request = {};
$scope.travelData = {};
$scope.htslabels = {};
$scope.htsdata = {};
}
});
\ No newline at end of file
......@@ -12,9 +12,14 @@ angular.module('blazer.mapcontrollers', [])
}
/* MAP DEFAULTS */
// var map = new L.map('mapid', { center: new L.LatLng(14.5818, 120.9771), zoom: 12 });
// var googleLayer = new L.Google('ROADMAP');
// map.addLayer(googleLayer);
//GOOGLE MAP
var map = L.map('mapid');
map.setView(new L.LatLng(14.5818, 120.9771), 12);
//MAP BOX
//LEAFLET
L.tileLayer(maplayer, {
maxZoom: 18,
......@@ -388,6 +393,16 @@ angular.module('blazer.mapcontrollers', [])
console.debug("********** Load Heat Map **********");
}
/* Show Blazers Data */
$scope.blazersData = {};
$scope.getBlazersDataV2 = function() {
getBlazer.getMapData().then(function(data) {
$scope.blazersData = data;
console.log("[ Blazer Data V2 ]", JSON.stringify($scope.blazersData));
$scope.plotBlazers();
});
}
/* Show Blazers Data */
$scope.blazersData = {};
$scope.getBlazersData = function() {
......@@ -402,54 +417,86 @@ angular.module('blazer.mapcontrollers', [])
var parsedData = [];
var geojsonLayer = [];
$scope.plotBlazers = function() {
console.debug("********** Plot Blazers on Map **********");
parsedData = [];
angular.forEach($scope.blazersData, function(value, key) {
console.log("[ VALUE SCOPE ]", JSON.stringify(value));
var formatData = {
"type": "Feature",
"properties": {
"username": "Anonymous Blazer",
"barangay_name": value.barangay_name,
"blazer_count": value.blazer_count,
"car_percentage": value.car_percentage,
},
"geometry": {
"type": "Point",
"coordinates": [value.longitude, value.latitude]
"coordinates": [value.lon, value.lat]
}
}
parsedData.push(formatData);
});
// Map Icon Options
// ICON
// var iconOptions = L.icon({
// iconUrl: 'img/mapicon.png',
// iconSize: [35, 37],
// iconAnchor: [18, 2]
// });
// POINTS
var iconOptions = {
radius: 8,
fillColor: "green",
color: "green",
weight: 1,
opacity: 1,
fillOpacity: 0.8
};
// PLOT DATA
function onEachFeature(feature, layer) {
if (feature.properties && feature.properties.username) {
layer.bindPopup('<div class="pop-up-containter">Blazer</h4><div style="font-size: 15px">' + feature.properties.username + '</div></div>');
if (feature.properties && feature.properties.barangay_name) {
layer.bindPopup('<div class="pop-up-containter">' + feature.properties.barangay_name + '</div>');
}
}
/*
The colors refer to the car percentage. If car percentage is above 50%, the color is shades of red (the redder, the closer to 100% car percentage). Yellow is 50%. Below 50%, then shades of green. Very green means 0% car use.
*/
/*
The size refers to the blazer count. If blaze count <= 20, then, small. If blazer count is more than or equal to 50, then size is big. Medium is between 20 and 50.
*/
geojsonLayer = L.geoJson(parsedData, {
onEachFeature: onEachFeature,
pointToLayer: function(feature, latlng) {
return L.circleMarker(latlng, iconOptions);
var circle_radius = '';
var circle_fill = '';
var circle_opacity = '';
// RADIUS SETTER
if (parseInt(feature.properties.blazer_count) >= 50) {
console.log("BIG");
circle_radius = 500;
} else if (parseInt(feature.properties.blazer_count) < 50 && parseInt(feature.properties.blazer_count) > 20) {
console.log("MEDIUM");
circle_radius = 250;
} else if (parseInt(feature.properties.blazer_count) <= 20) {
console.log("SMALL");
circle_radius = 100;
}
// COLOR SETTER
if (feature.properties.car_percentage > 80) {
console.log("RED");
circle_fill = "red";
circle_opacity = 0.8;
} else if (feature.properties.car_percentage > 50 && feature.properties.car_percentage <= 80) {
console.log("LIGHT RED");
circle_fill = "red";
circle_opacity = 0.3;
} else if (feature.properties.car_percentage <= 50 && feature.properties.car_percentage >= 30) {
console.log("YELLOW");
circle_fill = "yellow";
circle_opacity = 0.8;
} else if (feature.properties.car_percentage < 30 && feature.properties.car_percentage >= 20) {
console.log("LIGHT YELLOW");
circle_fill = "yellow";
circle_opacity = 0.3;
} else if (feature.properties.car_percentage < 20) {
circle_fill = "green";
circle_opacity = 0.8;
}
// return L.circleMarker(latlng, iconOptions);
return L.circle(latlng, circle_radius, {
color: '',
fillColor: circle_fill,
fillOpacity: circle_opacity,
})
}
}).addTo(map);
map.fitBounds(geojsonLayer.getBounds());
......@@ -463,7 +510,7 @@ angular.module('blazer.mapcontrollers', [])
var dayToday = $filter('date')(newDate, 'EEEE');
console.log("[ Date Today ]", currentDate);
if (dayToday == 'Friday' || dayToday == 'Saturday') {
if (dayToday == 'Friday' || dayToday == 'Saturday' || dayToday == 'Sunday') {
if (localStorage.getItem(currentDate) === null) {
var tripPopup = $ionicPopup.show({
title: 'Hey it\'s ' + dayToday + '!',
......@@ -497,30 +544,35 @@ angular.module('blazer.mapcontrollers', [])
var dayToday = $filter('date')(newDate, 'EEEE');
console.log("[ Date Today ]", currentDate);
if (localStorage.getItem(currentDate) === null) {
var tripPopup = $ionicPopup.show({
title: 'Hey it\'s ' + dayToday + '!',
subTitle: 'Take the weekly survey. You are awesome!',
scope: $scope,
buttons: [{
text: 'Let\s go!',
type: 'button-dark button-outline',
onTap: function(e) {
console.log("[ TAKE WEEKLY SURVEY ]");
$scope.openWeeklySurvey();
}
},
{
text: 'Later',
type: 'button-dark button-outline',
onTap: function(e) {
console.log("[ NO WEEKLY SURVEY ]")
if (dayToday == 'Friday' || dayToday == 'Saturday' || dayToday == 'Sunday') {
if (localStorage.getItem(currentDate) === null) {
var tripPopup = $ionicPopup.show({
title: 'Hey it\'s ' + dayToday + '!',
subTitle: 'Take the weekly survey. You are awesome!',
scope: $scope,
buttons: [{
text: 'Let\s go!',
type: 'button-dark button-outline',
onTap: function(e) {
console.log("[ TAKE WEEKLY SURVEY ]");
$scope.openWeeklySurvey();
}
},
{
text: 'Later',
type: 'button-dark button-outline',
onTap: function(e) {
console.log("[ NO WEEKLY SURVEY ]")
}
}
}
]
});
]
});
} else {
$cordovaDialogs.alert('You\'ve already taken this weeks\' weekly survey. Thank you.', 'Weekly Survey', "OKAY");
}
} else {
$cordovaDialogs.alert('You\'ve already taken this weeks\' weekly survey. Thank you.', 'Weekly Survey', "OKAY");
console.log("Cannot Take Survey Today");
$cordovaDialogs.alert('Sorry. But you may only take the weekly survey on Friday, Saturday, or Sunday. Thank you.', 'Weekly Survey', "OKAY");
}
}
......@@ -551,7 +603,7 @@ angular.module('blazer.mapcontrollers', [])
$scope.modalEndTrip.show();
};
// Weekly Survey Modal
$ionicModal.fromTemplateUrl('app/survey/weekly.html', {
$ionicModal.fromTemplateUrl('app/survey/weekly_v2.html', {
scope: $scope,
animation: 'slide-in-up'
}).then(function(modal) {
......
<ion-view view-title="BLAZE" ng-init="initializedLocateUser();loadWeeklySurvey();getAllBarangay();">
<ion-nav-buttons side="left">
<button ng-click="openMenu()" class="button button-icon ion-android-menu" ng-disabled="tripStatus"></button>
</ion-nav-buttons>
<ion-nav-buttons side="right">
<button ng-click="openPopover($event);" class="button button-icon ion-android-apps" ng-disabled="tripStatus"></button>
</ion-nav-buttons>
<ion-nav-buttons side="left">
<button ng-click="openMenu()" class="button button-icon ion-android-menu" ng-disabled="tripStatus"></button>
</ion-nav-buttons>
<ion-nav-buttons side="right">
<button ng-click="openPopover($event);" class="button button-icon ion-android-apps" ng-disabled="tripStatus"></button>
</ion-nav-buttons>
<ion-floating-button style='opacity: 0.8;'' click="refreshMap();" has-footer="true" button-color="#333333" icon="ion-android-refresh" icon-color="#fff" ng-hide="tripStatus">
</ion-floating-button>
<ion-floating-button style='opacity: 0.8;' click="refreshMap();" has-footer="true" button-color="#333333" icon="ion-android-refresh" icon-color="#fff" ng-hide="tripStatus">
</ion-floating-button>
<div class="bar bar-subheader bar-clear darkblue item-input-inset">
<a class="item-input-wrapper" ng-click="onLoadSelection();">
<i class="icon ion-ios-search placeholder-icon"></i>
<input type="text" placeholder="Search Barangay" ng-model="selectedBarangayData" disabled>
</a>
<button class="button button-stable" style="color: #000000;" ng-click="loadBarangayData();" ng-disabled="!selectedBarangayData">
<div class="bar bar-subheader bar-clear darkblue item-input-inset">
<a class="item-input-wrapper" ng-click="onLoadSelection();">
<i class="icon ion-ios-search placeholder-icon"></i>
<input type="text" placeholder="Search Barangay" ng-model="selectedBarangayData" disabled>
</a>
<button class="button button-stable" style="color: #000000;" ng-click="loadBarangayData();" ng-disabled="!selectedBarangayData">
Show
</button>
</div>
</div>
<ion-content class="has-subheader" data-tap-disabled="true">
<div id="mapid"></div>
</ion-content>
<ion-content class="has-subheader" data-tap-disabled="true">
<div id="mapid"></div>
</ion-content>
<ion-footer-bar align-title="center" class="bar bar-clear darkblue">
<div class="button-bar">
<div class="button-bar" ng-if="!tripStatus">
<button ng-click="confirmTripDestination();" class="button button-icon ion-android-arrow-dropright-circle light"> Start Trip</button>
</div>
<div class="button-bar" ng-if="tripStatus">
<button ng-click="tripEnd();" class="button button-icon ion-android-cancel stable"> Stop Trip</button>
</div>
</div>
</ion-footer-bar>
<ion-footer-bar align-title="center" class="bar bar-clear darkblue">
<div class="button-bar">
<div class="button-bar" ng-if="!tripStatus">
<button ng-click="confirmTripDestination();" class="button button-icon ion-android-arrow-dropright-circle light"> Start Trip</button>
</div>
<div class="button-bar" ng-if="tripStatus">
<button ng-click="tripEnd();" class="button button-icon ion-android-cancel stable"> Stop Trip</button>
</div>
</div>
</ion-footer-bar>
</ion-view>
</ion-view>
\ No newline at end of file
<ion-popover-view class="fit">
<ion-content scroll="false">
<div class="list">
<a ng-click="getBlazersData();closePopover($event);" class="item item-icon-left">
<i class="icon ion-android-pin"></i>
Show Blazers
</a>
<!--<a ng-click="loadHeatMap();" class="item item-icon-left">
<i class="icon ion-android-pin"></i>
Load Heatmap
</a>-->
<a ng-click="triggerWeeklySurvey();closePopover($event);" class="item item-icon-left">
<i class="icon ion-android-clipboard"></i>
Weekly Survey
</a>
</div>
</ion-content>
</ion-popover-view>
<ion-content scroll="false">
<div class="list">
<a ng-click="getBlazersDataV2();closePopover($event);" class="item item-icon-left">
<i class="icon ion-android-pin"></i> Show Blazers
</a>
<a ng-click="triggerWeeklySurvey();closePopover($event);" class="item item-icon-left">
<i class="icon ion-android-clipboard"></i> Weekly Survey
</a>
</div>
</ion-content>
</ion-popover-view>
\ No newline at end of file
......@@ -23,8 +23,8 @@
<!-- <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/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 Diary</ion-item>
<ion-item nav-clear menu-close href="#/app/status" class="item-icon item-icon-left"><i class="icon ion-android-wifi"></i>Trip Logging</ion-item>
<ion-item nav-clear menu-close href="#/app/diary" class="item-icon item-icon-left"><i class="icon ion-bookmark"></i>My Trip Diary</ion-item>
<!--<ion-item nav-clear menu-close href="#/app/status" class="item-icon item-icon-left"><i class="icon ion-edit"></i>Trip Logging</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/settings" class="item-icon item-icon-left"><i class="icon ion-android-settings"></i>Settings</ion-item>
</ion-content>
......
<ion-view view-title="Offer a Ride" ng-init="getUserLocation();">
<ion-nav-buttons side="right">
<!--<button class="button button-clear button-light" ng-click="resetOfferRide();" ng-disabled="setPosition == true">Referesh</button>-->
</ion-nav-buttons>
<ion-content data-tap-disabled="false">
<form name="offerride">
<div class="item item-divider"> Offer Ride </div>
<p class="text-dark note-style"><b>Note: </b> Drag the marker to a specific point of Destination.</p>
<div class="item item-divider item-light"> Destination </div>
<!--<label class="item item-input">
<ion-nav-buttons side="right">
<!--<button class="button button-clear button-light" ng-click="resetOfferRide();" ng-disabled="setPosition == true">Referesh</button>-->
</ion-nav-buttons>
<ion-content data-tap-disabled="false">
<form name="offerride">
<div class="item item-divider"> Offer Ride </div>
<p class="text-dark note-style"><b>Note: </b> Drag the marker to a specific point of Destination.</p>
<div class="item item-divider item-light"> Destination </div>
<!--<label class="item item-input">
<input type="text" placeholder="Destination Address" location-suggestion location="location" ng-model="location.formatted_address">
</label>-->
<div id="mapdestination"></div>
<p class="text-dark note-style"><b>Note: </b> Drag the marker to a specific Pick-up Location.</p>
<div class="item item-divider item-light"> Pick-up Location (specify) </div>
<div id="mappickup"></div>
<div class="item item-stacked-label" ion-datetime-picker am-pm ng-model="offer.assembly" required>
<span class="input-label">Date and Time</span>
<p>{{offer.assembly| date: "MMMM dd, yyyy 'at' H:mm:ss a"}}</p>
</div>
<label class="item item-input item-stacked-label border-bottom-select">
<div id="mapdestination"></div>
<p class="text-dark note-style"><b>Note: </b> Drag the marker to a specific Pick-up Location.</p>
<div class="item item-divider item-light"> Pick-up Location (specify) </div>
<div id="mappickup"></div>
<div class="item item-stacked-label" ion-datetime-picker am-pm ng-model="offer.assembly" required>
<span class="input-label">Date and Time</span>
<p>{{offer.assembly| date: "MMMM dd, yyyy 'at' H:mm:ss a"}}</p>
</div>
<label class="item item-input item-stacked-label border-bottom-select">
<span class="input-label"> Car Brand</span>
</label>
<label class="item item-input item-select border-top">
<label class="item item-input item-select border-top">
<div class="input-label">
&nbsp;
</div>
......@@ -70,14 +70,14 @@
<option value="Volvo">Volvo</option>
</select>
</label>
<label class="item item-input item-stacked-label">
<label class="item item-input item-stacked-label">
<span class="input-label">Plate Number</span>
<input type="text" ng-model="offer.platenumber" placeholder="ABC123 or ABCD123" max-length="8" ng-maxlength="7" required/>
</label>
<label class="item item-input item-stacked-label border-bottom-select">
<label class="item item-input item-stacked-label border-bottom-select">
<span class="input-label"> Capacity</span>
</label>
<label class="item item-input item-select border-top">
<label class="item item-input item-select border-top">
<div class="input-label">
&nbsp;
</div>
......@@ -98,19 +98,19 @@
<option value="15">15 Seater</option>
</select>
</label>
<label class="item item-input item-stacked-label">
<label class="item item-input item-stacked-label">
<span class="input-label">Mobile Number</span>
<input type="number" ng-model="offer.mobile" placeholder="(09)** *** ****" maxlength="11" ng-maxlength="11" required/>
</label>
<label class="item item-input item-stacked-label">
<label class="item item-input item-stacked-label">
<span class="input-label"> Other Details</span>
<textarea type="text" placeholder="Fuel contribution" ng-model="offer.notes" style="height: 100px;"></textarea>
</label>
<div class="padding">
<button class="button button-block button-dark button-outline" ng-disabled="offerride.$invalid" ng-click="offerRide(location);">
<div class="padding">
<button class="button button-block button-dark button-outline" ng-disabled="offerride.$invalid" ng-click="offerRide(location);">
Offer Ride
</button>
</div>
</form>
</ion-content>
</div>
</form>
</ion-content>
</ion-view>
\ No newline at end of file
<ion-view view-title="My Travel Stats" ng-init="getTravelStats();">
<ion-nav-buttons side="right">
</ion-nav-buttons>
<ion-content>
<ion-refresher pulling-text="Pull to refresh" on-refresh="getTravelStats();"></ion-refresher>
<div class="list">
<div class="item item-divider"> Mode of Use </div>
<div class="item">
<i class="button button-block button-clear bgbluegreen text-light">Latest</i>
<i class="button button-block icon-left ion-android-car"><b>{{ blazersStats.mode_latest }}</b></i>
<i class="button button-block icon-left ion-android-bulb"><b>{{ blazersStats.emo_latest }}</b></i>
<!--<i class="button button-block icon-left ion-android-time"><b>{{blazersStats.time_latest}}</b></i>-->
</div>
<div class="item">
<i class="button button-block button-clear bgbluegreen text-light">Frequently Used</i>
<i class="button button-block icon-left ion-android-car"><b>{{ blazersStats.mode_frequent }}</b></i>
<i class="button button-block icon-left ion-android-bulb"><b>{{ blazersStats.emo_frequent }}</b></i>
<!--<i class="button button-block icon-left ion-android-time"><b>{{blazersStats.time_average}}</b></i>-->
</div>
<div class="item">
<i class="button button-block button-clear bgbluegreen text-light">Low-Carbon</i>
<i class="button button-block icon-left ion-android-car"><b>{{ blazersStats.mode_best }}</b></i>
<i class="button button-block icon-left ion-android-bulb"><b>{{ blazersStats.emo_frequent_positive }}</b></i>
<!--<i class="button button-block icon-left ion-android-time"><b>{{blazersStats.time_best}}</b></i>-->
</div>
<!--<div class="item item-thumbnail-left item-borderless">
<img ng-src="img/info.png">
<i> Latest </i>
<p>Transportation: <i ng-if="!blazersStats.mode_latest">NULL</i>{{ blazersStats.mode_latest }}</p>
<p>Mood: <i ng-if="!blazersStats.emo_latest">NULL</i>{{ blazersStats.emo_latest }}</p>
</div>
<div class="item item-thumbnail-left item-borderless">
<img ng-src="img/info.png">
<i>Frequently Used</i>
<p>Transportation: <i ng-if="!blazersStats.mode_frequent">NULL</i>{{ blazersStats.mode_frequent }}</p>
<p>Mood: <i ng-if="!blazersStats.emo_frequent">NULL</i>{{ blazersStats.emo_frequent }}</p>
</div>
<div class="item item-thumbnail-left item-borderless">
<img ng-src="img/info.png">
<i>Low-Carbon</i>
<p>Transportation: <i ng-if="!blazersStats.mode_best">NULL</i>{{ blazersStats.mode_best }}</p>
<p>Mood: <i ng-if="!blazersStats.emo_frequent_positive">NULL</i>{{ blazersStats.emo_frequent_positive }}</p>
</div>-->
<div class="item item-divider"> Time </div>
<div class="item">
<i class="button button-block button-clear bgbluegreen text-light">Latest</i>
<i class="button button-block icon-left ion-android-time"><b>{{ blazersStats.time_latest }}</b></i>
</div>
<div class="item">
<i class="button button-block button-clear bgbluegreen text-light">Average</i>
<i class="button button-block icon-left ion-android-time"><b>{{ blazersStats.time_average }}</b></i>
</div>
<div class="item">
<i class="button button-block button-clear bgbluegreen text-light">Best</i>
<i class="button button-block icon-left ion-android-time"><b>{{ blazersStats.time_best }}</b></i>
</div>
<!--<div class="item item-borderless item-icon-left">
<i class="icon ion-android-wifi"></i>
Latest
<span class="item-note"> <i ng-if="!blazersStats.time_latest">NULL</i>{{ blazersStats.time_latest }} </span>
</div>
<div class="item item-borderless item-icon-left">
<i class="icon ion-android-wifi"></i>
Average
<span class="item-note"> <i ng-if="!blazersStats.time_average">NULL</i>{{ blazersStats.time_average }} </span>
</div>
<div class="item item-borderless item-icon-left">
<i class="icon ion-android-wifi"></i>
Best
<span class="item-note"> <i ng-if="!blazersStats.time_best">NULL</i>{{ blazersStats.time_best }} </span>
</div>-->
</div>
</ion-content>
</ion-view>
<ion-nav-buttons side="right">
</ion-nav-buttons>
<ion-content>
<ion-refresher pulling-text="Pull to refresh" on-refresh="getTravelStats();"></ion-refresher>
<div class="list card">
<div class="item item-divider"> Mode of Use </div>
<div class="item">
<i class="button button-block button-clear bgbluegreen text-light">Latest</i>
<i class="button button-block icon-left ion-android-car"><b>{{ blazersStats.mode_latest }}</b></i>
<i class="button button-block icon-left ion-android-bulb"><b>{{ blazersStats.emo_latest }}</b></i>
<!--<i class="button button-block icon-left ion-android-time"><b>{{blazersStats.time_latest}}</b></i>-->
</div>
<div class="item">
<i class="button button-block button-clear bgbluegreen text-light">Frequently Used</i>
<i class="button button-block icon-left ion-android-car"><b>{{ blazersStats.mode_frequent }}</b></i>
<i class="button button-block icon-left ion-android-bulb"><b>{{ blazersStats.emo_frequent }}</b></i>
</div>
<div class="item">
<i class="button button-block button-clear bgbluegreen text-light">Low-Carbon</i>
<i class="button button-block icon-left ion-android-car"><b>{{ blazersStats.mode_best }}</b></i>
<i class="button button-block icon-left ion-android-bulb"><b>{{ blazersStats.emo_frequent_positive }}</b></i>
</div>
</div>
<div class="list card">
<div class="item item-divider"> Time </div>
<div class="item">
<i class="button button-block button-clear bgbluegreen text-light">Latest</i>
<i class="button button-block icon-left ion-android-time"><b>{{ blazersStats.time_latest }}</b></i>
</div>
<div class="item">
<i class="button button-block button-clear bgbluegreen text-light">Average</i>
<i class="button button-block icon-left ion-android-time"><b>{{ blazersStats.time_average }}</b></i>
</div>
<div class="item">
<i class="button button-block button-clear bgbluegreen text-light">Best</i>
<i class="button button-block icon-left ion-android-time"><b>{{ blazersStats.time_best }}</b></i>
</div>
</div>
</ion-content>
</ion-view>
\ No newline at end of file
......@@ -2,260 +2,241 @@ angular.module('blazer.surveycontrollers', [])
.controller('SurveyCtrl', function($scope, $ionicModal, $filter, $ionicSlideBoxDelegate, $ionicScrollDelegate, postBlazer, $cordovaNetwork, $cordovaDialogs) {
$scope.closeEndTripModal = function() {
$scope.modalEndTrip.hide();
};
$scope.closeWeeklyModal = function() {
$scope.modalWeeklyTrip.hide();
};
$scope.endtrip = {};
$scope.postEndTripSurvey = function(){
/* CHECK IF MOBILE IS ONLINE */
console.log("[ NETWORK STATUS ]", $cordovaNetwork.getNetwork());
if($cordovaNetwork.getNetwork() == Connection.WIFI || $cordovaNetwork.getNetwork() == Connection.CELL_2G || $cordovaNetwork.getNetwork() == Connection.CELL_3G ||$cordovaNetwork.getNetwork() == Connection.CELL_4G){
var tripID = localStorage.getItem("tripid");
var username = localStorage.getItem("username");
var startTime = localStorage.getItem("starttime");
var endTime = localStorage.getItem("endtime");
var newDate = new Date();
var timeStamp = newDate.getTime();
var currentTrip = localStorage.getItem("currentTrip");
var postdata = {
"trip_id" : tripID,
"username": username,
"depart": startTime,
"arrive": endTime,
"mode": $scope.endtrip.mode,
"exp": $scope.endtrip.overallxp,
"emotion": $scope.endtrip.emotion,
"type": currentTrip
}
console.log("[ POST END TRIP SURVEY ]");
postBlazer.EndTripSurvey(postdata)
.success(function(response) {
$scope.closeEndTripModal();
$scope.endtrip = {};
console.log("SEND ENDTRIP SURVEY SUCCESS", response);
})
.error(function(response) {
$scope.closeEndTripModal();
$scope.endtrip = {};
console.error("SEND ENDTRIP SURVEY ERROR", response);
});
}
else {
$cordovaDialogs.alert('Network Connection is required before taking this action. Thank you!', 'Ooops', "OKAY");
}
}
$scope.disableSwipe = function() {
$ionicSlideBoxDelegate.enableSlide(false);
};
$scope.currentIndex = '';
$scope.backSlide = function(){
$ionicScrollDelegate.scrollTop(true);
$ionicSlideBoxDelegate.previous();
$scope.currentIndex = $ionicSlideBoxDelegate.currentIndex();
}
$scope.nextPageSlide = function(){
$ionicScrollDelegate.scrollTop(true);
$ionicSlideBoxDelegate.next();
$scope.currentIndex = $ionicSlideBoxDelegate.currentIndex();
}
$scope.weekly = {};
$scope.postWeeklySurvey = function(){
console.log("[ NETWORK STATUS ]", $cordovaNetwork.getNetwork());
if($cordovaNetwork.getNetwork() == Connection.WIFI || $cordovaNetwork.getNetwork() == Connection.CELL_2G || $cordovaNetwork.getNetwork() == Connection.CELL_3G ||$cordovaNetwork.getNetwork() == Connection.CELL_4G){
var userID = localStorage.getItem("userID");
var username = localStorage.getItem("username");
var newDate = new Date();
var currentDate = $filter('date')(newDate, 'yyyyMMww');
var dayToday = $filter('date')(newDate, 'EEEE');
var dateCreated = $filter('date')(newDate, 'yyyy - MM - dd HH: mm: ss');
var surveyAnswer = [];
/* LOOP SCOPE OF CHOICES */
if($scope.weekly.main == 1 || $scope.weekly.main == 2){
angular.forEach($scope.choice1, function(value, key){
surveyAnswer.push(parseInt(value));
})
}
else if($scope.weekly.main == 3){
angular.forEach($scope.choice3, function(value, key){
surveyAnswer.push(parseInt(value));
})
}
else if($scope.weekly.main == 4){
angular.forEach($scope.choice4, function(value, key){
surveyAnswer.push(parseInt(value));
})
}
else if($scope.weekly.main == 5){
angular.forEach($scope.choice5, function(value, key){
surveyAnswer.push(parseInt(value));
})
}
else if($scope.weekly.main == 'C'){
surveyAnswer = null;
}
// var surveyAns = surveyAnswer;
// var surveyAnsStr = surveyAns.join(",");
$scope.closeEndTripModal = function() {
$scope.modalEndTrip.hide();
};
var surveyString = surveyAnswer.toString();
$scope.closeWeeklyModal = function() {
$scope.modalWeeklyTrip.hide();
};
console.log("[ WEEKLY SURVEY ANSWERS ]", JSON.stringify(surveyString));
var postdata = {
"user_id": userID,
"username": username,
"choice": $scope.weekly.main,
"survey_ans": surveyString,
"date_created": dateCreated
}
postBlazer.WeeklySurvey(postdata)
.success(function(response) {
console.log("SEND WEEKLY SURVEY SUCCESS", response);
localStorage.setItem(currentDate, currentDate);
$scope.resetValues();
$scope.closeWeeklyModal();
})
.error(function(response) {
console.error("SEND WEEKLY SURVEY ERROR", response);
$scope.resetValues();
$scope.closeWeeklyModal();
});
}
else {
$cordovaDialogs.alert('Network Connection is required before taking this action. Thank you!', 'Ooops', "OKAY");
}
}
$scope.endtrip = {};
$scope.postEndTripSurvey = function() {
/* CHECK IF MOBILE IS ONLINE */
console.log("[ NETWORK STATUS ]", $cordovaNetwork.getNetwork());
if ($cordovaNetwork.getNetwork() == Connection.WIFI || $cordovaNetwork.getNetwork() == Connection.CELL_2G || $cordovaNetwork.getNetwork() == Connection.CELL_3G || $cordovaNetwork.getNetwork() == Connection.CELL_4G) {
var tripID = localStorage.getItem("tripid");
var username = localStorage.getItem("username");
var startTime = localStorage.getItem("starttime");
var endTime = localStorage.getItem("endtime");
var newDate = new Date();
var timeStamp = newDate.getTime();
var currentTrip = localStorage.getItem("currentTrip");
var postdata = {
"trip_id": tripID,
"username": username,
"depart": startTime,
"arrive": endTime,
"mode": $scope.endtrip.mode,
"exp": $scope.endtrip.overallxp,
"emotion": $scope.endtrip.emotion,
"type": currentTrip
}
console.log("[ POST END TRIP SURVEY ]");
postBlazer.EndTripSurvey(postdata)
.success(function(response) {
$scope.closeEndTripModal();
$scope.endtrip = {};
console.log("SEND ENDTRIP SURVEY SUCCESS", response);
})
.error(function(response) {
$scope.closeEndTripModal();
$scope.endtrip = {};
console.error("SEND ENDTRIP SURVEY ERROR", response);
});
} else {
$cordovaDialogs.alert('Network Connection is required before taking this action. Thank you!', 'Ooops', "OKAY");
}
}
$scope.disableSwipe = function() {
$ionicSlideBoxDelegate.enableSlide(false);
};
$scope.currentIndex = '';
$scope.backSlide = function() {
$ionicScrollDelegate.scrollTop(true);
$ionicSlideBoxDelegate.previous();
$scope.currentIndex = $ionicSlideBoxDelegate.currentIndex();
}
$scope.nextPageSlide = function() {
$ionicScrollDelegate.scrollTop(true);
$ionicSlideBoxDelegate.next();
$scope.currentIndex = $ionicSlideBoxDelegate.currentIndex();
}
$scope.resetValues = function(){
$scope.weekly = {};
$scope.postWeeklySurvey = function() {
console.log("[ NETWORK STATUS ]", $cordovaNetwork.getNetwork());
if ($cordovaNetwork.getNetwork() == Connection.WIFI || $cordovaNetwork.getNetwork() == Connection.CELL_2G || $cordovaNetwork.getNetwork() == Connection.CELL_3G || $cordovaNetwork.getNetwork() == Connection.CELL_4G) {
var userID = localStorage.getItem("userID");
var username = localStorage.getItem("username");
var newDate = new Date();
var currentDate = $filter('date')(newDate, 'yyyyMMww');
var dayToday = $filter('date')(newDate, 'EEEE');
var dateCreated = $filter('date')(newDate, 'yyyy - MM - dd HH: mm: ss');
var surveyAnswer = [];
/* LOOP SCOPE OF CHOICES */
if ($scope.weekly.main == 1 || $scope.weekly.main == 2 || $scope.weekly.main == 3 || $scope.weekly.main == 4 || $scope.weekly.main == 5 || $scope.weekly.main == 6) {
angular.forEach($scope.choice1, function(value, key) {
if (value == 'N/A') {
surveyAnswer.push(value);
} else {
surveyAnswer.push(parseInt(value));
}
})
} else if ($scope.weekly.main == 'C') {
surveyAnswer = null;
}
var surveyString = surveyAnswer.toString();
console.log("[ WEEKLY SURVEY ANSWERS ]", JSON.stringify(surveyString));
var postdata = {
"user_id": userID,
"username": username,
"choice": $scope.weekly.main,
"survey_ans": surveyString,
"date_created": dateCreated
}
postBlazer.WeeklySurvey(postdata)
.success(function(response) {
console.log("SEND WEEKLY SURVEY SUCCESS", response);
localStorage.setItem(currentDate, currentDate);
$scope.resetValues();
$scope.closeWeeklyModal();
})
.error(function(response) {
console.error("SEND WEEKLY SURVEY ERROR", response);
$scope.resetValues();
$scope.closeWeeklyModal();
});
} else {
$cordovaDialogs.alert('Network Connection is required before taking this action. Thank you!', 'Ooops', "OKAY");
}
}
$scope.resetValues = function() {
$scope.weekly = {};
$scope.choice1 = {
one: "0",
two: "0",
three: "0",
four: "0",
five: "0",
six: "0",
seven: "0",
eight: "0"
};
$scope.choice3 = {
one: "0",
two: "0",
three: "0",
four: "0",
five: "0",
six: "0",
seven: "0",
eight: "0",
nine: "0",
ten: "0"
};
$scope.choice4 = {
one: "0",
two: "0",
three: "0",
four: "0",
five: "0",
six: "0",
seven: "0"
};
$scope.choice5 = {
one: "0",
two: "0",
three: "0",
four: "0",
five: "0",
six: "0",
seven: "0"
};
}
$scope.choiceOneA = [
{ text: "0", value: "0" },
{ text: "1", value: "1" },
{ text: "2", value: "2" },
{ text: "3", value: "3" },
{ text: "4", value: "4" },
{ text: "5", value: "5" }
];
$scope.choiceOneB = [
{ text: "6", value: "6" },
{ text: "7", value: "7" },
{ text: "8", value: "8" },
{ text: "9", value: "9" },
{ text: "10", value: "10" }
];
$scope.choice1 = {
one: "0",
two: "0",
three: "0",
four: "0",
five: "0",
six: "0",
seven: "0",
eight: "0"
one: "0",
two: "0",
three: "0",
four: "0",
five: "0",
six: "0",
seven: "0",
eight: "0"
};
$scope.choice3 = {
one: "0",
two: "0",
three: "0",
four: "0",
five: "0",
six: "0",
seven: "0",
eight: "0",
nine: "0",
ten: "0"
one: "0",
two: "0",
three: "0",
four: "0",
five: "0",
six: "0",
seven: "0",
eight: "0",
nine: "0",
ten: "0"
};
$scope.choice4 = {
one: "0",
two: "0",
three: "0",
four: "0",
five: "0",
six: "0",
seven: "0"
one: "0",
two: "0",
three: "0",
four: "0",
five: "0",
six: "0",
seven: "0"
};
$scope.choice5 = {
one: "0",
two: "0",
three: "0",
four: "0",
five: "0",
six: "0",
seven: "0"
one: "0",
two: "0",
three: "0",
four: "0",
five: "0",
six: "0",
seven: "0"
};
}
$scope.choiceOneA = [
{ text: "0", value: "0" },
{ text: "1", value: "1" },
{ text: "2", value: "2" },
{ text: "3", value: "3" },
{ text: "4", value: "4" },
{ text: "5", value: "5" }
];
$scope.choiceOneB = [
{ text: "6", value: "6" },
{ text: "7", value: "7" },
{ text: "8", value: "8" },
{ text: "9", value: "9" },
{ text: "10", value: "10" }
];
$scope.choice1 = {
one: "0",
two: "0",
three: "0",
four: "0",
five: "0",
six: "0",
seven: "0",
eight: "0"
};
$scope.choice3 = {
one: "0",
two: "0",
three: "0",
four: "0",
five: "0",
six: "0",
seven: "0",
eight: "0",
nine: "0",
ten: "0"
};
$scope.choice4 = {
one: "0",
two: "0",
three: "0",
four: "0",
five: "0",
six: "0",
seven: "0"
};
$scope.choice5 = {
one: "0",
two: "0",
three: "0",
four: "0",
five: "0",
six: "0",
seven: "0"
};
$scope.items = [
{ number: 1 },
{ number: 2 },
{ number: 3 },
{ number: 4 },
{ number: 5 },
{ number: 6 },
{ number: 7 },
{ number: 8 },
{ number: 9 },
{ number: 10 },
{ number: 11 },
{ number: 12 },
{ number: 13 },
{ number: 14 },
{ number: 15 }
];
$scope.selectedItem = $scope.items[2];
});
$scope.items = [
{ number: 1 },
{ number: 2 },
{ number: 3 },
{ number: 4 },
{ number: 5 },
{ number: 6 },
{ number: 7 },
{ number: 8 },
{ number: 9 },
{ number: 10 },
{ number: 11 },
{ number: 12 },
{ number: 13 },
{ number: 14 },
{ number: 15 }
];
$scope.selectedItem = $scope.items[2];
});
\ No newline at end of file
<ion-modal-view ng-controller="SurveyCtrl">
<form name="survey">
<ion-header-bar align-title="center" class="bar bar-clear darkblue">
<div class="buttons">
<button class="button button-clear button-light" ng-if="currentIndex!=0" ng-click="backSlide();"><i class="button-icon icon ion-back"></i>Back</button>
</div>
<h1 class="title">Weekly Survey</h1>
<div class="buttons">
<button class="button button-clear button-light" ng-disabled="survey.$invalid" ng-click="postWeeklySurvey()"><i class="button-icon icon ion-android-send"></i></button>
</div>
</ion-header-bar>
<ion-content padding="true">
<ion-slide-box on-slide-changed="slideHasChanged($index)" show-pager="false" ng-init="disableSwipe(); resetValues();" class="dynamic-slider">
<ion-slide>
<div class="item item-light item-text-wrap">
<p class="text-dark">Choose one statement that best describes your car use in the past 4-5 days and how you feel about it.</p>
</div>
<ion-radio class="item item-text-wrap justify" ng-model="weekly.main" ng-value=1 ng-click="nextPageSlide()"><b>A:</b> "These past few days, I used car frequently to school, either driving or being driven alone. I am happy about it and I am not at all thinking of lessening my car use."</ion-radio>
<ion-radio class="item item-text-wrap justify" ng-model="weekly.main" ng-value=2 ng-click="nextPageSlide()"><b>B:</b> "I used car frequently to school over the last few days. I don't know if I can reduce my car use but I am willing to explore possible ways to change my behavior."</ion-radio>
<ion-radio class="item item-text-wrap justify " ng-model="weekly.main" ng-value=3 ng-click="nextPageSlide()"><b>C:</b> "I used car frequently to school in the past 4-5 days. I want to reduce my car use but I don't know how to. In the coming week, I will try to make a plan on how I can achieve my goal of going by alternative modes for some
of my trips to the university."</ion-radio>
<ion-radio class="item item-text-wrap justify" ng-model="weekly.main" ng-value=4 ng-click="nextPageSlide()"><b>D:</b> "I used car frequently to school in the last few days. I already have some plan on how to go to school by alternatives but I have not implemented it yet. In the coming week, I will attempt to finally implement it."</ion-radio>
<ion-radio class="item item-text-wrap justify" ng-model="weekly.main" ng-value=5 ng-click="nextPageSlide()"><b>E:</b> "I was able to reduce (further?) my level of car use these past 4-5 days. I will try to maintain this or reduce it more in the coming week."</ion-radio>
<ion-radio class="item item-text-wrap justify" ng-model="weekly.main" ng-value=6 ng-click="nextPageSlide()"><b>F:</b> "These past few days, I mostly used alternative modes even though I could use car."</ion-radio>
<ion-radio class="item item-text-wrap justify" ng-model="weekly.main" ng-value="'C'" ng-click="postWeeklySurvey()"><b>G:</b> "As I do not own/have access to a car, I have no choice butto use alternative modes."</ion-radio>
</ion-slide>
<ion-slide>
<div class="item item-light item-text-wrap">
<p class="text-dark">Kindly read carefully and tell us how much you agree or disagree with each of the 15 statements. Choose N/A if thestatement is not applicable to you.</p>
</div>
<!-- FIRST -->
<label class="item item-stacked-label item-text-wrap justify" style="border-bottom: 0px;">
<span><b>1:</b> "I will feel good about myself if I am able to use alternatives for my trips to school." </span>
</label>
<div class="button-bar" style="border-bottom: 0px; border-top: 0px;">
<p class="button button-clear button-positive" ng-click="choice1.one =-5">Disagree</p>
<p class="button button-clear button-positive" ng-click="choice1.one =0">Neutral</p>
<p class="button button-clear button-positive" ng-click="choice1.one =5">Agree</p>
</div>
<div class="item range range-positive" style="border-top: 0px;">
<input type="range" name="choice1one" min=-5 max=5 step=1 ng-value=0 ng-model="choice1.one" value="{{choice1.one}}"> {{choice1.one}}
</div>
<ion-checkbox class="button-bar checkbox-positive" ng-model="choice1.one" ng-true-value="'N/A'" ng-false-value="''">
Not applicable
</ion-checkbox>
<label class="item item-stacked-label item-text-wrap justify" style="border-bottom: 0px;">
<span><b>2:</b> "I will feel bad if I do nothing to adopt a more pro-environmental mobility lifestyle." </span>
</label>
<div class="button-bar" style="border-bottom: 0px;">
<p class="button button-clear button-positive" ng-click="choice1.two =-5">Disagree</p>
<p class="button button-clear button-positive" ng-click="choice1.two =0">Neutral</p>
<p class="button button-clear button-positive" ng-click="choice1.two =5">Agree</p>
</div>
<div class="item range range-positive" style="border-top: 0px;">
<input type="range" name="choice1two" min=-5 max=5 step=1 ng-value=0 ng-model="choice1.two" value="{{choice1.two}}"> {{choice1.two}}
</div>
<ion-checkbox class="button-bar checkbox-positive" ng-model="choice1.two" ng-true-value="'N/A'" ng-false-value="''">
Not applicable
</ion-checkbox>
<label class="item item-stacked-label item-text-wrap justify" style="border-bottom: 0px;">
<span><b>3:</b> "Before I make the trip by car, I first consider if I can make the same trip by alternatives. Cars should be seen as mode of last resort." </span>
</label>
<div class="button-bar" style="border-bottom: 0px;">
<p class="button button-clear button-positive" ng-click="choice1.three =-5">Disagree</p>
<p class="button button-clear button-positive" ng-click="choice1.three =0">Neutral</p>
<p class="button button-clear button-positive" ng-click="choice1.three =5">Agree</p>
</div>
<div class="item range range-positive" style="border-top: 0px;">
<input type="range" name="choice1three" min=-5 max=5 step=1 ng-value=0 ng-model="choice1.three" value="{{choice1.three}}"> {{choice1.three}}
</div>
<ion-checkbox class="button-bar checkbox-positive" ng-model="choice1.three" ng-true-value="'N/A'" ng-false-value="''">
Not applicable
</ion-checkbox>
<label class="item item-stacked-label item-text-wrap justify" style="border-bottom: 0px;">
<span><b>4:</b> “I know some Ateneans who, though have access to cars, go to school by alternatives. They somehow motivate me to travel like them." </span>
</label>
<div class="button-bar" style="border-bottom: 0px;">
<p class="button button-clear button-positive" ng-click="choice1.four =-5">Disagree</p>
<p class="button button-clear button-positive" ng-click="choice1.four =0">Neutral</p>
<p class="button button-clear button-positive" ng-click="choice1.four =5">Agree</p>
</div>
<div class="item range range-positive" style="border-top: 0px;">
<input type="range" name="choice1four" min=-5 max=5 step=1 ng-value=0 ng-model="choice1.four" value="{{choice1.four}}"> {{choice1.four}}
</div>
<ion-checkbox class="button-bar checkbox-positive" ng-model="choice1.four" ng-true-value="'N/A'" ng-false-value="''">
Not applicable
</ion-checkbox>
<label class="item item-stacked-label item-text-wrap justify" style="border-bottom: 0px;">
<span><b>5:</b> "Each of us can contribute in solving eco-problems associated with car use by using car less or ridesharing with others if possible." </span>
</label>
<div class="button-bar" style="border-bottom: 0px;">
<p class="button button-clear button-positive" ng-click="choice1.five =-5">Disagree</p>
<p class="button button-clear button-positive" ng-click="choice1.five =0">Neutral</p>
<p class="button button-clear button-positive" ng-click="choice1.five =5">Agree</p>
</div>
<div class="item range range-positive" style="border-top: 0px;">
<input type="range" name="choice1five" min=-5 max=5 step=1 ng-value=0 ng-model="choice1.five" value="{{choice1.five}}"> {{choice1.five}}
</div>
<ion-checkbox class="button-bar checkbox-positive" ng-model="choice1.five" ng-true-value="'N/A'" ng-false-value="''">
Not applicable
</ion-checkbox>
<label class="item item-stacked-label item-text-wrap justify" style="border-bottom: 0px;">
<span><b>6:</b> "There are social costs associated with car use: traffic congestion, traffic accidents, air pollution and global warming." </span>
</label>
<div class="button-bar" style="border-bottom: 0px;">
<p class="button button-clear button-positive" ng-click="choice1.six =-5">Disagree</p>
<p class="button button-clear button-positive" ng-click="choice1.six =0">Neutral</p>
<p class="button button-clear button-positive" ng-click="choice1.six =5">Agree</p>
</div>
<div class="item range range-positive" style="border-top: 0px;">
<input type="range" name="choice1six" min=-5 max=5 step=1 ng-value=0 ng-model="choice1.six" value="{{choice1.six}}"> {{choice1.six}}
</div>
<ion-checkbox class="button-bar checkbox-positive" ng-model="choice1.six" ng-true-value="'N/A'" ng-false-value="''">
Not applicable
</ion-checkbox>
<label class="item item-stacked-label item-text-wrap justify" style="border-bottom: 0px;">
<span><b>7:</b> "It is possible for me to go to the university (more often) by carpool or other alternative modes." </span>
</label>
<div class="button-bar" style="border-bottom: 0px;">
<p class="button button-clear button-positive" ng-click="choice1.seven =-5">Disagree</p>
<p class="button button-clear button-positive" ng-click="choice1.seven =0">Neutral</p>
<p class="button button-clear button-positive" ng-click="choice1.seven =5">Agree</p>
</div>
<div class="item range range-positive" style="border-top: 0px;">
<input type="range" name="choice1seven" min=-5 max=5 step=1 ng-value=0 ng-model="choice1.seven" value="{{choice1.seven}}"> {{choice1.seven}}
</div>
<ion-checkbox class="button-bar checkbox-positive" ng-model="choice1.seven" ng-true-value="'N/A'" ng-false-value="''">
Not applicable
</ion-checkbox>
<label class="item item-stacked-label item-text-wrap justify" style="border-bottom: 0px;">
<span><b>8:</b> "I intend to contribute in taking cars off the roads, either by taking alternative means or pooling with others car trips going to same destination." </span>
</label>
<div class="button-bar" style="border-bottom: 0px;">
<p class="button button-clear button-positive" ng-click="choice1.eight =-5">Disagree</p>
<p class="button button-clear button-positive" ng-click="choice1.eight =0">Neutral</p>
<p class="button button-clear button-positive" ng-click="choice1.eight =5">Agree</p>
</div>
<div class="item range range-positive" style="border-top: 0px;">
<input type="range" name="choice1eight" min=-5 max=5 step=1 ng-value=0 ng-model="choice1.eight" value="{{choice1.eight}}"> {{choice1.eight}}
</div>
<ion-checkbox class="button-bar checkbox-positive" ng-model="choice1.eight" ng-true-value="'N/A'" ng-false-value="''">
Not applicable
</ion-checkbox>
<label class="item item-stacked-label item-text-wrap justify" style="border-bottom: 0px;">
<span><b>9:</b> "Among the different mode options to go to the university, there is one option, except driving alone or being the only passenger driven, that is favorable for me." </span>
</label>
<div class="button-bar" style="border-bottom: 0px;">
<p class="button button-clear button-positive" ng-click="choice1.nine =-5">Disagree</p>
<p class="button button-clear button-positive" ng-click="choice1.nine =0">Neutral</p>
<p class="button button-clear button-positive" ng-click="choice1.nine =5">Agree</p>
</div>
<div class="item range range-positive" style="border-top: 0px;">
<input type="range" name="choice1nine" min=-5 max=5 step=1 ng-value=0 ng-model="choice1.nine" value="{{choice1.nine}}"> {{choice1.nine}}
</div>
<ion-checkbox class="button-bar checkbox-positive" ng-model="choice1.nine" ng-true-value="'N/A'" ng-false-value="''">
Not applicable
</ion-checkbox>
<label class="item item-stacked-label item-text-wrap justify" style="border-bottom: 0px;">
<span><b>10:</b> "I have decided which mode to use as substitute for my car for some of my trips to the university. I intend to make a plan on how to go to the university using this mode." </span>
</label>
<div class="button-bar" style="border-bottom: 0px;">
<p class="button button-clear button-positive" ng-click="choice1.ten =-5">Disagree</p>
<p class="button button-clear button-positive" ng-click="choice1.ten =0">Neutral</p>
<p class="button button-clear button-positive" ng-click="choice1.ten =5">Agree</p>
</div>
<div class="item range range-positive" style="border-top: 0px;">
<input type="range" name="choice1ten" min=-5 max=5 step=1 ng-value=0 ng-model="choice1.ten" value="{{choice1.ten}}"> {{choice1.ten}}
</div>
<ion-checkbox class="button-bar checkbox-positive" ng-model="choice1.ten" ng-true-value="'N/A'" ng-false-value="''">
Not applicable
</ion-checkbox>
<label class="item item-stacked-label item-text-wrap justify" style="border-bottom: 0px;">
<span><b>11:</b> "I have plan on how to go to school by alternatives, and I have already run through my head on how to best carry out this plan." </span>
</label>
<div class="button-bar" style="border-bottom: 0px;">
<p class="button button-clear button-positive" ng-click="choice1.eleven =-5">Disagree</p>
<p class="button button-clear button-positive" ng-click="choice1.eleven =0">Neutral</p>
<p class="button button-clear button-positive" ng-click="choice1.eleven =5">Agree</p>
</div>
<div class="item range range-positive" style="border-top: 0px;">
<input type="range" name="choice1eleven" min=-5 max=5 step=1 ng-value=0 ng-model="choice1.eleven" value="{{choice1.eleven}}"> {{choice1.eleven}}
</div>
<ion-checkbox class="button-bar checkbox-positive" ng-model="choice1.eleven" ng-true-value="'N/A'" ng-false-value="''">
Not applicable
</ion-checkbox>
<label class="item item-stacked-label item-text-wrap justify" style="border-bottom: 0px;">
<span><b>12:</b> "I have anticipated all the possible problems that can occur and hinder me as I put this plan into practice." </span>
</label>
<div class="button-bar" style="border-bottom: 0px;">
<p class="button button-clear button-positive" ng-click="choice1.twelve =-5">Disagree</p>
<p class="button button-clear button-positive" ng-click="choice1.twelve =0">Neutral</p>
<p class="button button-clear button-positive" ng-click="choice1.twelve =5">Agree</p>
</div>
<div class="item range range-positive" style="border-top: 0px;">
<input type="range" name="choice1twelve" min=-5 max=5 step=1 ng-value=0 ng-model="choice1.twelve" value="{{choice1.twelve}}"> {{choice1.twelve}}
</div>
<ion-checkbox class="button-bar checkbox-positive" ng-model="choice1.twelve" ng-true-value="'N/A'" ng-false-value="''">
Not applicable
</ion-checkbox>
<label class="item item-stacked-label item-text-wrap justify" style="border-bottom: 0px;">
<span><b>13:</b> "I have already mentally developed ways to overcome such problems and obstacles or to be flexible depending on the situation." </span>
</label>
<div class="button-bar" style="border-bottom: 0px;">
<p class="button button-clear button-positive" ng-click="choice1.thirteen =-5">Disagree</p>
<p class="button button-clear button-positive" ng-click="choice1.thirteen =0">Neutral</p>
<p class="button button-clear button-positive" ng-click="choice1.thirteen =5">Agree</p>
</div>
<div class="item range range-positive" style="border-top: 0px;">
<input type="range" name="choice1thirteen" min=-5 max=5 step=1 ng-value=0 ng-model="choice1.thirteen" value="{{choice1.thirteen}}"> {{choice1.thirteen}}
</div>
<ion-checkbox class="button-bar checkbox-positive" ng-model="choice1.thirteen" ng-true-value="'N/A'" ng-false-value="''">
Not applicable
</ion-checkbox>
<label class="item item-stacked-label item-text-wrap justify" style="border-bottom: 0px;">
<span><b>14:</b> "Within the next seven days, I intend to actually use (more) public transport or rideshare in going to the university/home." </span>
</label>
<div class="button-bar" style="border-bottom: 0px;">
<p class="button button-clear button-positive" ng-click="choice1.fourteen =-5">Disagree</p>
<p class="button button-clear button-positive" ng-click="choice1.fourteen =0">Neutral</p>
<p class="button button-clear button-positive" ng-click="choice1.fourteen =5">Agree</p>
</div>
<div class="item range range-positive" style="border-top: 0px;">
<input type="range" name="choice1fourteen" min=-5 max=5 step=1 ng-value=0 ng-model="choice1.fourteen" value="{{choice1.fourteen}}"> {{choice1.fourteen}}
</div>
<ion-checkbox class="button-bar checkbox-positive" ng-model="choice1.fourteen" ng-true-value="'N/A'" ng-false-value="''">
Not applicable
</ion-checkbox>
<label class="item item-stacked-label item-text-wrap justify" style="border-bottom: 0px;">
<span><b>15:</b> "I will continue to use alternatives to go to school, even though this may be inconvenient." </span>
</label>
<div class="button-bar" style="border-bottom: 0px;">
<p class="button button-clear button-positive" ng-click="choice1.fifteen =-5">Disagree</p>
<p class="button button-clear button-positive" ng-click="choice1.fifteen =0">Neutral</p>
<p class="button button-clear button-positive" ng-click="choice1.fifteen =5">Agree</p>
</div>
<div class="item range range-positive" style="border-top: 0px;">
<input type="range" name="choice1fifteen" min=-5 max=5 step=1 ng-value=0 ng-model="choice1.fifteen" value="{{choice1.fifteen}}"> {{choice1.fifteen}}
</div>
<ion-checkbox class="button-bar checkbox-positive" ng-model="choice1.fifteen" ng-true-value="'N/A'" ng-false-value="''">
Not applicable
</ion-checkbox>
</ion-slide>
</ion-slide-box>
</form>
</ion-content>
</ion-modal-view>
\ No newline at end of file
......@@ -14,111 +14,156 @@
.leaflet-zoom-box,
.leaflet-image-layer,
.leaflet-layer {
position: absolute;
left: 0;
top: 0;
position: absolute;
left: 0;
top: 0;
}
.leaflet-container {
overflow: hidden;
-ms-touch-action: none;
overflow: hidden;
-ms-touch-action: none;
touch-action: none;
}
.leaflet-tile,
.leaflet-marker-icon,
.leaflet-marker-shadow {
-webkit-user-select: none;
-moz-user-select: none;
user-select: none;
-webkit-user-drag: none;
-webkit-user-select: none;
-moz-user-select: none;
user-select: none;
-webkit-user-drag: none;
}
.leaflet-marker-icon,
.leaflet-marker-shadow {
display: block;
display: block;
}
/* map is broken in FF if you have max-width: 100% on tiles */
.leaflet-container img {
max-width: none !important;
max-width: none !important;
}
/* stupid Android 2 doesn't understand "max-width: none" properly */
.leaflet-container img.leaflet-image-layer {
max-width: 15000px !important;
max-width: 15000px !important;
}
.leaflet-tile {
filter: inherit;
visibility: hidden;
filter: inherit;
visibility: hidden;
}
.leaflet-tile-loaded {
visibility: inherit;
visibility: inherit;
}
.leaflet-zoom-box {
width: 0;
height: 0;
width: 0;
height: 0;
}
/* workaround for https://bugzilla.mozilla.org/show_bug.cgi?id=888319 */
.leaflet-overlay-pane svg {
-moz-user-select: none;
-moz-user-select: none;
}
.leaflet-tile-pane { z-index: 2; }
.leaflet-objects-pane { z-index: 3; }
.leaflet-overlay-pane { z-index: 4; }
.leaflet-shadow-pane { z-index: 5; }
.leaflet-marker-pane { z-index: 6; }
.leaflet-popup-pane { z-index: 7; }
.leaflet-tile-pane {
z-index: 2;
}
.leaflet-objects-pane {
z-index: 3;
}
.leaflet-overlay-pane {
z-index: 4;
}
.leaflet-shadow-pane {
z-index: 5;
}
.leaflet-marker-pane {
z-index: 6;
}
.leaflet-popup-pane {
z-index: 7;
}
.leaflet-vml-shape {
width: 1px;
height: 1px;
width: 1px;
height: 1px;
}
.lvml {
behavior: url(#default#VML);
display: inline-block;
position: absolute;
behavior: url(#default#VML);
display: inline-block;
position: absolute;
}
/* control positioning */
.leaflet-control {
position: relative;
z-index: 7;
pointer-events: auto;
position: relative;
z-index: 7;
pointer-events: auto;
}
.leaflet-top,
.leaflet-bottom {
position: absolute;
z-index: 1000;
pointer-events: none;
position: absolute;
z-index: 1000;
pointer-events: none;
}
.leaflet-top {
top: 0;
top: 0;
}
.leaflet-right {
right: 0;
right: 0;
}
.leaflet-bottom {
bottom: 0;
bottom: 0;
}
.leaflet-left {
left: 0;
left: 0;
}
.leaflet-control {
float: left;
clear: both;
float: left;
clear: both;
}
.leaflet-right .leaflet-control {
float: right;
float: right;
}
.leaflet-top .leaflet-control {
margin-top: 10px;
margin-top: 10px;
}
.leaflet-bottom .leaflet-control {
margin-bottom: 10px;
margin-bottom: 10px;
}
.leaflet-left .leaflet-control {
margin-left: 10px;
margin-left: 10px;
}
.leaflet-right .leaflet-control {
margin-right: 10px;
margin-right: 10px;
}
......@@ -126,128 +171,143 @@
.leaflet-fade-anim .leaflet-tile,
.leaflet-fade-anim .leaflet-popup {
opacity: 0;
-webkit-transition: opacity 0.2s linear;
-moz-transition: opacity 0.2s linear;
-o-transition: opacity 0.2s linear;
transition: opacity 0.2s linear;
opacity: 0;
-webkit-transition: opacity 0.2s linear;
-moz-transition: opacity 0.2s linear;
-o-transition: opacity 0.2s linear;
transition: opacity 0.2s linear;
}
.leaflet-fade-anim .leaflet-tile-loaded,
.leaflet-fade-anim .leaflet-map-pane .leaflet-popup {
opacity: 1;
opacity: 1;
}
.leaflet-zoom-anim .leaflet-zoom-animated {
-webkit-transition: -webkit-transform 0.25s cubic-bezier(0,0,0.25,1);
-moz-transition: -moz-transform 0.25s cubic-bezier(0,0,0.25,1);
-o-transition: -o-transform 0.25s cubic-bezier(0,0,0.25,1);
transition: transform 0.25s cubic-bezier(0,0,0.25,1);
-webkit-transition: -webkit-transform 0.25s cubic-bezier(0, 0, 0.25, 1);
-moz-transition: -moz-transform 0.25s cubic-bezier(0, 0, 0.25, 1);
-o-transition: -o-transform 0.25s cubic-bezier(0, 0, 0.25, 1);
transition: transform 0.25s cubic-bezier(0, 0, 0.25, 1);
}
.leaflet-zoom-anim .leaflet-tile,
.leaflet-pan-anim .leaflet-tile,
.leaflet-touching .leaflet-zoom-animated {
-webkit-transition: none;
-moz-transition: none;
-o-transition: none;
transition: none;
-webkit-transition: none;
-moz-transition: none;
-o-transition: none;
transition: none;
}
.leaflet-zoom-anim .leaflet-zoom-hide {
visibility: hidden;
visibility: hidden;
}
/* cursors */
.leaflet-clickable {
cursor: pointer;
cursor: pointer;
}
.leaflet-container {
cursor: -webkit-grab;
cursor: -moz-grab;
cursor: -webkit-grab;
cursor: -moz-grab;
}
.leaflet-popup-pane,
.leaflet-control {
cursor: auto;
cursor: auto;
}
.leaflet-dragging .leaflet-container,
.leaflet-dragging .leaflet-clickable {
cursor: move;
cursor: -webkit-grabbing;
cursor: -moz-grabbing;
cursor: move;
cursor: -webkit-grabbing;
cursor: -moz-grabbing;
}
/* visual tweaks */
.leaflet-container {
background: #ddd;
outline: 0;
background: #ddd;
outline: 0;
}
.leaflet-container a {
color: #0078A8;
color: #0078A8;
}
.leaflet-container a.leaflet-active {
outline: 2px solid orange;
outline: 2px solid orange;
}
.leaflet-zoom-box {
border: 2px dotted #38f;
background: rgba(255,255,255,0.5);
border: 2px dotted #38f;
background: rgba(255, 255, 255, 0.5);
}
/* general typography */
.leaflet-container {
font: 12px/1.5 "Helvetica Neue", Arial, Helvetica, sans-serif;
font: 12px/1.5 "Helvetica Neue", Arial, Helvetica, sans-serif;
}
/* general toolbar styles */
.leaflet-bar {
box-shadow: 0 1px 5px rgba(0,0,0,0.65);
border-radius: 4px;
box-shadow: 0 1px 5px rgba(0, 0, 0, 0.65);
border-radius: 4px;
}
.leaflet-bar a,
.leaflet-bar a:hover {
background-color: #fff;
border-bottom: 1px solid #ccc;
width: 26px;
height: 26px;
line-height: 26px;
display: block;
text-align: center;
text-decoration: none;
color: black;
background-color: #fff;
border-bottom: 1px solid #ccc;
width: 26px;
height: 26px;
line-height: 26px;
display: block;
text-align: center;
text-decoration: none;
color: black;
}
.leaflet-bar a,
.leaflet-control-layers-toggle {
background-position: 50% 50%;
background-repeat: no-repeat;
display: block;
background-position: 50% 50%;
background-repeat: no-repeat;
display: block;
}
.leaflet-bar a:hover {
background-color: #f4f4f4;
background-color: #f4f4f4;
}
.leaflet-bar a:first-child {
border-top-left-radius: 4px;
border-top-right-radius: 4px;
border-top-left-radius: 4px;
border-top-right-radius: 4px;
}
.leaflet-bar a:last-child {
border-bottom-left-radius: 4px;
border-bottom-right-radius: 4px;
border-bottom: none;
border-bottom-left-radius: 4px;
border-bottom-right-radius: 4px;
border-bottom: none;
}
.leaflet-bar a.leaflet-disabled {
cursor: default;
background-color: #f4f4f4;
color: #bbb;
cursor: default;
background-color: #f4f4f4;
color: #bbb;
}
.leaflet-touch .leaflet-bar a {
width: 30px;
height: 30px;
line-height: 30px;
width: 30px;
height: 30px;
line-height: 30px;
}
......@@ -255,224 +315,251 @@
.leaflet-control-zoom-in,
.leaflet-control-zoom-out {
font: bold 18px 'Lucida Console', Monaco, monospace;
text-indent: 1px;
font: bold 18px 'Lucida Console', Monaco, monospace;
text-indent: 1px;
}
.leaflet-control-zoom-out {
font-size: 20px;
font-size: 20px;
}
.leaflet-touch .leaflet-control-zoom-in {
font-size: 22px;
font-size: 22px;
}
.leaflet-touch .leaflet-control-zoom-out {
font-size: 24px;
font-size: 24px;
}
/* layers control */
.leaflet-control-layers {
box-shadow: 0 1px 5px rgba(0,0,0,0.4);
background: #fff;
border-radius: 5px;
box-shadow: 0 1px 5px rgba(0, 0, 0, 0.4);
background: #fff;
border-radius: 5px;
}
.leaflet-control-layers-toggle {
background-image: url(images/layers.png);
width: 36px;
height: 36px;
background-image: url(images/layers.png);
width: 36px;
height: 36px;
}
.leaflet-retina .leaflet-control-layers-toggle {
background-image: url(images/layers-2x.png);
background-size: 26px 26px;
background-image: url(images/layers-2x.png);
background-size: 26px 26px;
}
.leaflet-touch .leaflet-control-layers-toggle {
width: 44px;
height: 44px;
width: 44px;
height: 44px;
}
.leaflet-control-layers .leaflet-control-layers-list,
.leaflet-control-layers-expanded .leaflet-control-layers-toggle {
display: none;
display: none;
}
.leaflet-control-layers-expanded .leaflet-control-layers-list {
display: block;
position: relative;
display: block;
position: relative;
}
.leaflet-control-layers-expanded {
padding: 6px 10px 6px 6px;
color: #333;
background: #fff;
padding: 6px 10px 6px 6px;
color: #333;
background: #fff;
}
.leaflet-control-layers-selector {
margin-top: 2px;
position: relative;
top: 1px;
margin-top: 2px;
position: relative;
top: 1px;
}
.leaflet-control-layers label {
display: block;
display: block;
}
.leaflet-control-layers-separator {
height: 0;
border-top: 1px solid #ddd;
margin: 5px -10px 5px -6px;
height: 0;
border-top: 1px solid #ddd;
margin: 5px -10px 5px -6px;
}
/* attribution and scale controls */
.leaflet-container .leaflet-control-attribution {
background: #fff;
background: rgba(255, 255, 255, 0.7);
margin: 0;
background: #fff;
background: rgba(255, 255, 255, 0.7);
margin: 0;
}
.leaflet-control-attribution,
.leaflet-control-scale-line {
padding: 0 5px;
color: #333;
padding: 0 5px;
color: #333;
}
.leaflet-control-attribution a {
text-decoration: none;
text-decoration: none;
}
.leaflet-control-attribution a:hover {
text-decoration: underline;
text-decoration: underline;
}
.leaflet-container .leaflet-control-attribution,
.leaflet-container .leaflet-control-scale {
font-size: 11px;
font-size: 11px;
}
.leaflet-left .leaflet-control-scale {
margin-left: 5px;
margin-left: 5px;
}
.leaflet-bottom .leaflet-control-scale {
margin-bottom: 5px;
margin-bottom: 5px;
}
.leaflet-control-scale-line {
border: 2px solid #777;
border-top: none;
line-height: 1.1;
padding: 2px 5px 1px;
font-size: 11px;
white-space: nowrap;
overflow: hidden;
-moz-box-sizing: content-box;
box-sizing: content-box;
background: #fff;
background: rgba(255, 255, 255, 0.5);
border: 2px solid #777;
border-top: none;
line-height: 1.1;
padding: 2px 5px 1px;
font-size: 11px;
white-space: nowrap;
overflow: hidden;
-moz-box-sizing: content-box;
box-sizing: content-box;
background: #fff;
background: rgba(255, 255, 255, 0.5);
}
.leaflet-control-scale-line:not(:first-child) {
border-top: 2px solid #777;
border-bottom: none;
margin-top: -2px;
border-top: 2px solid #777;
border-bottom: none;
margin-top: -2px;
}
.leaflet-control-scale-line:not(:first-child):not(:last-child) {
border-bottom: 2px solid #777;
border-bottom: 2px solid #777;
}
.leaflet-touch .leaflet-control-attribution,
.leaflet-touch .leaflet-control-layers,
.leaflet-touch .leaflet-bar {
box-shadow: none;
box-shadow: none;
}
.leaflet-touch .leaflet-control-layers,
.leaflet-touch .leaflet-bar {
border: 2px solid rgba(0,0,0,0.2);
background-clip: padding-box;
border: 2px solid rgba(0, 0, 0, 0.2);
background-clip: padding-box;
}
/* popup */
.leaflet-popup {
position: absolute;
text-align: center;
position: absolute;
text-align: center;
}
.leaflet-popup-content-wrapper {
padding: 1px;
text-align: left;
border-radius: 12px;
padding: 1px;
text-align: left;
border-radius: 12px;
}
.leaflet-popup-content {
margin: 13px 19px;
line-height: 1.4;
margin: 13px 19px;
line-height: 1.4;
}
.leaflet-popup-content p {
margin: 18px 0;
margin: 18px 0;
}
.leaflet-popup-tip-container {
margin: 0 auto;
width: 40px;
height: 20px;
position: relative;
overflow: hidden;
margin: 0 auto;
width: 40px;
height: 20px;
position: relative;
overflow: hidden;
}
.leaflet-popup-tip {
width: 17px;
height: 17px;
padding: 1px;
margin: -10px auto 0;
-webkit-transform: rotate(45deg);
-moz-transform: rotate(45deg);
-ms-transform: rotate(45deg);
-o-transform: rotate(45deg);
transform: rotate(45deg);
.leaflet-popup-tip {
width: 17px;
height: 17px;
padding: 1px;
margin: -10px auto 0;
-webkit-transform: rotate(45deg);
-moz-transform: rotate(45deg);
-ms-transform: rotate(45deg);
-o-transform: rotate(45deg);
transform: rotate(45deg);
}
.leaflet-popup-content-wrapper,
.leaflet-popup-tip {
background: white;
box-shadow: 0 3px 14px rgba(0,0,0,0.4);
background: white;
box-shadow: 0 3px 14px rgba(0, 0, 0, 0.4);
}
.leaflet-container a.leaflet-popup-close-button {
position: absolute;
top: 0;
right: 0;
padding: 4px 4px 0 0;
text-align: center;
width: 18px;
height: 14px;
font: 16px/14px Tahoma, Verdana, sans-serif;
color: #c3c3c3;
text-decoration: none;
font-weight: bold;
background: transparent;
position: absolute;
top: 0;
right: 0;
padding: 4px 4px 0 0;
text-align: center;
width: 18px;
height: 14px;
font: 16px/14px Tahoma, Verdana, sans-serif;
color: #c3c3c3;
text-decoration: none;
font-weight: bold;
background: transparent;
}
.leaflet-container a.leaflet-popup-close-button:hover {
color: #999;
color: #999;
}
.leaflet-popup-scrolled {
overflow: auto;
border-bottom: 1px solid #ddd;
border-top: 1px solid #ddd;
overflow: auto;
border-bottom: 1px solid #ddd;
border-top: 1px solid #ddd;
}
.leaflet-oldie .leaflet-popup-content-wrapper {
zoom: 1;
zoom: 1;
}
.leaflet-oldie .leaflet-popup-tip {
width: 24px;
margin: 0 auto;
-ms-filter: "progid:DXImageTransform.Microsoft.Matrix(M11=0.70710678, M12=0.70710678, M21=-0.70710678, M22=0.70710678)";
filter: progid:DXImageTransform.Microsoft.Matrix(M11=0.70710678, M12=0.70710678, M21=-0.70710678, M22=0.70710678);
.leaflet-oldie .leaflet-popup-tip {
width: 24px;
margin: 0 auto;
-ms-filter: "progid:DXImageTransform.Microsoft.Matrix(M11=0.70710678, M12=0.70710678, M21=-0.70710678, M22=0.70710678)";
filter: progid: DXImageTransform.Microsoft.Matrix(M11=0.70710678, M12=0.70710678, M21=-0.70710678, M22=0.70710678);
}
.leaflet-oldie .leaflet-popup-tip-container {
margin-top: -1px;
margin-top: -1px;
}
.leaflet-oldie .leaflet-control-zoom,
.leaflet-oldie .leaflet-control-layers,
.leaflet-oldie .leaflet-popup-content-wrapper,
.leaflet-oldie .leaflet-popup-tip {
border: 1px solid #999;
border: 1px solid #999;
}
/* div icon */
.leaflet-div-icon {
background: #fff;
border: 1px solid #666;
}
background: #fff;
border: 1px solid #666;
}
\ No newline at end of file
<!DOCTYPE html>
<html>
<head>
<head>
<meta charset="utf-8">
<meta name="viewport" content="initial-scale=1, maximum-scale=1, user-scalable=no, width=device-width">
<!--<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no" />-->
......@@ -11,7 +12,7 @@
<link href="css/style.css" rel="stylesheet">
<link rel="stylesheet" href="css/leaflet.css">
<link rel="stylesheet" href="css/leaflet-routing-machine.css">
<link href="lib/ion-floating-menu/dist/ion-floating-menu.css" rel="stylesheet" type="text/css">
<!--<link href="lib/leaflet-markercluster/dist/MarkerCluster.css" rel="stylesheet" type="text/css"/>-->
<link href="lib/ion-datetime-picker/release/ion-datetime-picker.min.css" rel="stylesheet">
......@@ -27,8 +28,9 @@
<!-- cordova script (this will be a 404 during development) -->
<script src="lib/ngCordova/ng-cordova.min.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 src="https://maps.googleapis.com/maps/api/js?libraries=places&sensor=false"></script>
<!--<script src="lib/leaflet/leaflet-google.js"></script>-->
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script>
<!-- your app's js -->
......@@ -45,6 +47,7 @@
<script src="app/misc/js/misc.js"></script>
<script src="app/ride/js/ride.js"></script>
<script src="app/message/js/message.js"></script>
<script src="app/diary/js/diary.js"></script>
<script src="js/config.js"></script>
<script src="js/blazerAPI.js"></script>
......@@ -53,12 +56,15 @@
<script src="lib/ion-floating-menu/dist/ion-floating-menu.js" type="text/javascript"></script>
<!--<script src="lib/leaflet-markercluster/dist/leaflet.markercluster.js" type="text/javascript"></script>-->
<script src="lib/ion-datetime-picker/release/ion-datetime-picker.min.js"></script>
<script src="js/directives/radioButtons.js"></script>
</head>
<body ng-app="blazer">
</head>
<body ng-app="blazer">
<ion-nav-view></ion-nav-view>
</body>
</html>
</body>
</html>
\ No newline at end of file
angular.module('blazer', [
'ionic',
'blazer.landingcontrollers',
'blazer.menucontrollers',
'blazer.authenticationcontrollers',
'blazer.mapcontrollers',
'blazer.offerridecontrollers',
'blazer.sharedridecontrollers',
'blazer.statuscontrollers',
'blazer.tripcontrollers',
'blazer.misccontrollers',
'blazer.surveycontrollers',
'blazer.apiservices',
'blazer.rideinformation',
'blazer.composemessage',
'ionic-letter-avatar',
'ngCordova',
'radioButtons',
'ion-floating-menu',
'ion-datetime-picker',
'chart.js'
'ionic',
'blazer.landingcontrollers',
'blazer.menucontrollers',
'blazer.authenticationcontrollers',
'blazer.mapcontrollers',
'blazer.offerridecontrollers',
'blazer.sharedridecontrollers',
'blazer.statuscontrollers',
'blazer.tripcontrollers',
'blazer.misccontrollers',
'blazer.surveycontrollers',
'blazer.diarycontrollers',
'blazer.apiservices',
'blazer.rideinformation',
'blazer.composemessage',
'ionic-letter-avatar',
'ngCordova',
'radioButtons',
'ion-floating-menu',
'ion-datetime-picker',
'chart.js'
])
.run(function($ionicPlatform, $ionicPickerI18n) {
$ionicPlatform.ready(function() {
if (window.cordova && window.cordova.plugins.Keyboard) {
cordova.plugins.Keyboard.hideKeyboardAccessoryBar(true);
cordova.plugins.Keyboard.disableScroll(true);
}
if (window.StatusBar) {
// org.apache.cordova.statusbar required
StatusBar.styleDefault();
}
$ionicPickerI18n.ok = "Set";
$ionicPickerI18n.okClass = "button-dark button-outline";
$ionicPickerI18n.cancelClass = "button-dark button-outline";
});
$ionicPlatform.registerBackButtonAction(function (event) {
event.preventDefault();
$ionicPlatform.ready(function() {
if (window.cordova && window.cordova.plugins.Keyboard) {
cordova.plugins.Keyboard.hideKeyboardAccessoryBar(true);
cordova.plugins.Keyboard.disableScroll(true);
}
if (window.StatusBar) {
// org.apache.cordova.statusbar required
StatusBar.styleDefault();
}
$ionicPickerI18n.ok = "Set";
$ionicPickerI18n.okClass = "button-dark button-outline";
$ionicPickerI18n.cancelClass = "button-dark button-outline";
});
$ionicPlatform.registerBackButtonAction(function(event) {
event.preventDefault();
}, 100);
})
.config(function($stateProvider, $urlRouterProvider, $ionicConfigProvider) {
$ionicConfigProvider.tabs.position('bottom'); // other values: top
$ionicConfigProvider.tabs.style('standard');
$ionicConfigProvider.spinner.icon('lines');
$stateProvider
/* LANDING */
.state('landing', {
url: '/landing',
templateUrl: 'app/landing/landing.html',
controller: 'LandingCtrl'
})
/* MENU */
.state('app', {
url: '/app',
abstract: true,
templateUrl: 'app/menu/menu.html',
controller: 'MenuCtrl'
})
/* LOGIN */
.state('login', {
url: '/login',
templateUrl: 'app/auth/login.html',
controller: 'AuthCtrl'
})
/* HOME */
.state('app.map', {
url: '/map',
views: {
'menuContent': {
templateUrl: 'app/map/map.html',
controller: 'MapCtrl'
}
}
})
/* TRIP */
.state('app.trip', {
url: '/trip',
views: {
'menuContent': {
templateUrl: 'app/trip/trip.html',
controller: 'TripCtrl'
}
}
})
/* SHAREDRIDE */
.state('app.offerride', {
url: '/offerride',
views: {
'menuContent': {
templateUrl: 'app/offerride/offerride.html',
controller: 'OfferRideCtrl'
}
}
})
/* SHAREDRIDE */
.state('app.sharedride', {
url: '/sharedride',
views: {
'menuContent': {
templateUrl: 'app/sharedride/sharedride.html',
controller: 'SharedRideCtrl'
}
}
})
/* STATUS */
.state('app.status', {
url: '/status',
views: {
'menuContent': {
templateUrl: 'app/status/status.html',
controller: 'StatusCtrl'
}
}
})
/* PROFILE */
.state('app.profile', {
url: '/profile',
views: {
'menuContent': {
templateUrl: 'app/misc/profile.html',
controller: 'MiscCtrl'
}
}
})
/* ABOUT */
.state('app.about', {
url: '/about',
views: {
'menuContent': {
templateUrl: 'app/misc/about.html',
controller: 'MiscCtrl'
}
}
})
/* SETTINGS */
.state('app.settings', {
url: '/settings',
views: {
'menuContent': {
templateUrl: 'app/misc/settings.html',
controller: 'MiscCtrl'
}
}
})
/* RIDE INFORMATION */
.state('app.ride', {
url: '/ride/:id',
views: {
'menuContent': {
templateUrl: 'app/ride/ride.html',
controller: 'RideInfoCtrl'
}
}
})
/* COMPOSE MESSAGE */
.state('app.message', {
url: '/message',
views: {
'menuContent': {
templateUrl: 'app/message/message.html',
controller: 'MsgCtrl'
}
}
})
$urlRouterProvider.otherwise('/landing');
$ionicConfigProvider.tabs.position('bottom'); // other values: top
$ionicConfigProvider.tabs.style('standard');
$ionicConfigProvider.spinner.icon('lines');
$stateProvider
/* LANDING */
.state('landing', {
url: '/landing',
templateUrl: 'app/landing/landing.html',
controller: 'LandingCtrl'
})
/* MENU */
.state('app', {
url: '/app',
abstract: true,
templateUrl: 'app/menu/menu.html',
controller: 'MenuCtrl'
})
/* LOGIN */
.state('login', {
url: '/login',
templateUrl: 'app/auth/login.html',
controller: 'AuthCtrl'
})
/* HOME */
.state('app.map', {
url: '/map',
views: {
'menuContent': {
templateUrl: 'app/map/map.html',
controller: 'MapCtrl'
}
}
})
/* TRIP */
.state('app.trip', {
url: '/trip',
views: {
'menuContent': {
templateUrl: 'app/trip/trip.html',
controller: 'TripCtrl'
}
}
})
/* SHAREDRIDE */
.state('app.offerride', {
url: '/offerride',
views: {
'menuContent': {
templateUrl: 'app/offerride/offerride.html',
controller: 'OfferRideCtrl'
}
}
})
/* SHAREDRIDE */
.state('app.sharedride', {
url: '/sharedride',
views: {
'menuContent': {
templateUrl: 'app/sharedride/sharedride.html',
controller: 'SharedRideCtrl'
}
}
})
/* STATUS */
.state('app.status', {
url: '/status',
views: {
'menuContent': {
templateUrl: 'app/status/status.html',
controller: 'StatusCtrl'
}
}
})
/* PROFILE */
.state('app.profile', {
url: '/profile',
views: {
'menuContent': {
templateUrl: 'app/misc/profile.html',
controller: 'MiscCtrl'
}
}
})
/* ABOUT */
.state('app.about', {
url: '/about',
views: {
'menuContent': {
templateUrl: 'app/misc/about.html',
controller: 'MiscCtrl'
}
}
})
/* SETTINGS */
.state('app.settings', {
url: '/settings',
views: {
'menuContent': {
templateUrl: 'app/misc/settings.html',
controller: 'MiscCtrl'
}
}
})
/* RIDE INFORMATION */
.state('app.ride', {
url: '/ride/:id',
views: {
'menuContent': {
templateUrl: 'app/ride/ride.html',
controller: 'RideInfoCtrl'
}
}
})
/* COMPOSE MESSAGE */
.state('app.message', {
url: '/message',
views: {
'menuContent': {
templateUrl: 'app/message/message.html',
controller: 'MsgCtrl'
}
}
})
/* DIARY */
.state('app.diary', {
url: '/diary',
views: {
'menuContent': {
templateUrl: 'app/diary/diary.html',
controller: 'DiaryCtrl'
}
}
})
$urlRouterProvider.otherwise('/landing');
})
\ No newline at end of file
......@@ -4,622 +4,1106 @@
angular.module('blazer.apiservices', [])
/*-------------------------------------------------- GET -------------------------------------------------- */
.factory('getBlazer', function($http, $ionicLoading){
var AllBlazerData = [];
var AllUserData = [];
var AllTravelStatus = [];
var AllSharedRideData = [];
var DetailedSharedRide = {};
var AllModesofTransport = {};
var AllBarangay = [];
return {
getBlazerDataInfo: function(){
$ionicLoading.show({ template: '<ion-spinner icon="crescent"></ion-spinner>'});
return $http.get(blazerAPI + '/blazer_data.php', {headers : {'Content-Type': 'application/x-www-form-urlencoded'}}).then(function(response) {
console.log('[ SUCCESS ]', JSON.stringify(response));
AllBlazerData = response.data;
$ionicLoading.hide();
return AllBlazerData;
}, function(err) {
console.error('[ ERROR ]', JSON.stringify(err));
$ionicLoading.hide();
return ;
})
},
getUserProfile: function(username) {
console.log("****** ON ENTER GET USER PROFILE SERVICE ******");
// $ionicLoading.show({ template: '<ion-spinner icon="crescent"></ion-spinner>'});
return $http.get(blazerAPI+'/user_profile.php?username='+username, {headers : {'Content-Type': 'application/x-www-form-urlencoded'}}).then(function(response) {
console.log('[ SUCCESS ]', JSON.stringify(response));
AllUserData = response.data[0];
$ionicLoading.hide();
return AllUserData;
}, function(err) {
console.error('[ ERROR ]', JSON.stringify(err));
$ionicLoading.hide();
return ;
})
},
getTravelStats: function(username) {
console.log("****** ON ENTER GET USER TRAVEL STATUS SERVICE ******");
// $ionicLoading.show({ template: '<ion-spinner icon="crescent"></ion-spinner>'});
return $http.get(blazerAPI+'/travel_stats.php?username='+username, {headers : {'Content-Type': 'application/x-www-form-urlencoded'}}).then(function(response) {
console.log('[ SUCCESS ]', JSON.stringify(response));
AllTravelStatus = response.data;
$ionicLoading.hide();
return AllTravelStatus;
}, function(err) {
console.error('[ ERROR ]', JSON.stringify(err));
$ionicLoading.hide();
return ;
})
},
/* NOT USED */
getSharedRide: function() {
console.log("****** ON ENTER GET SHARED RIDE SERVICE ******");
// $ionicLoading.show( { template: '<ion-spinner icon="crescent"></ion-spinner>'} );
return $http.get(blazerAPI+'/take_shared_ride_data.php', {headers : {'Content-Type': 'application/x-www-form-urlencoded'}}).then(function(response) {
console.log('[ SUCCESS ]', JSON.stringify(response));
AllSharedRideData = response.data;
$ionicLoading.hide();
return AllSharedRideData;
}, function(err) {
console.error('[ ERROR ]', JSON.stringify(err));
$ionicLoading.hide();
return ;
})
},
getTakeSharedRide: function(username) {
console.log("****** ON ENTER GET TAKE A SHARED RIDE SERVICE ******");
// $ionicLoading.show( { template: '<ion-spinner icon="crescent"></ion-spinner>'} );
return $http.get(blazerAPI+'/take_shared_ride_data.php?username='+username, {headers : {'Content-Type': 'application/x-www-form-urlencoded'}}).then(function(response) {
console.log('[ SUCCESS ]', JSON.stringify(response));
AllSharedRideData = response.data;
$ionicLoading.hide();
return AllSharedRideData;
}, function(err) {
console.error('[ ERROR ]', JSON.stringify(err));
$ionicLoading.hide();
return ;
})
},
getDetailedSharedRide: function(rideID, username) {
DetailedSharedRide = {};
console.log("[ RIDE ID ]", rideID);
console.log("****** ON ENTER GET DETAILED SHARED RIDE SERVICE ******");
$ionicLoading.show( { template: '<ion-spinner icon="crescent"></ion-spinner>'} );
return $http.get(blazerAPI+'/take_shared_ride_data.php?username='+username, {headers : {'Content-Type': 'application/x-www-form-urlencoded'}}).then(function(response) {
// console.log('[ SUCCESS ]', JSON.stringify(response));
AllSharedRideData = response.data;
angular.forEach(AllSharedRideData, function(value, key) {
if (value.id === rideID) {
DetailedSharedRide = { "id": value.id, "createdby": value.createdby, "destination": value.destination, "pickuplocation": value.pickuplocation, "pickup_lat": value.pickup_lat, "pickup_long": value.pickup_long, "assemblytime": value.assemblytime, "model": value.model, "mobilenum": value.mobilenum, "otherdetails": value.otherdetails, "subscribers": value.subscribers, "capacityleft": value.capacityleft, "avatar": value.avatar, "ride_status": value.ride_status, "interested_status": value.interested_status }
console.log("[ DETAILED SHARED RIDE ]", JSON.stringify(DetailedSharedRide));
$ionicLoading.hide();
}
});
return DetailedSharedRide;
}, function(err) {
console.error('[ ERROR ]', JSON.stringify(err));
$ionicLoading.hide();
return ;
})
},
/* PENDING PENDING PENDING PENDING PENDING PENDING PENDING */
getModeofTransportation: function(rideID) {
console.log("****** ON ENTER MODE OF TRANSPORT SERVICE ******");
$ionicLoading.show( { template: '<ion-spinner icon="crescent"></ion-spinner>'} );
return $http.get(blazerAPI+'/get_transportation_mode.php', {headers : {'Content-Type': 'application/x-www-form-urlencoded'}}).then(function(response) {
// console.log('[ SUCCESS ]', JSON.stringify(response));
AllModesofTransport = response.data;
angular.forEach(AllModesofTransport, function(value, key) {
if (value.id === rideID) {
AllModesofTransport = {};
console.log("[ MODE OF TRANSPORT ]", JSON.stringify(AllModesofTransport));
$ionicLoading.hide();
}
});
return AllModesofTransport;
}, function(err) {
console.error('[ ERROR ]', JSON.stringify(err));
$ionicLoading.hide();
return ;
})
},
getAllBarangay: function(){
$ionicLoading.show({ template: '<ion-spinner icon="crescent"></ion-spinner>'});
return $http.get(blazerAPI + '/get_barangay.php', {headers : {'Content-Type': 'application/x-www-form-urlencoded'}}).then(function(response) {
console.log('[ SUCCESS ]', JSON.stringify(response));
AllBarangay = response.data;
// LOOP BARANGAY DATA
var BarangayData = [];
for(var i = 0; i < AllBarangay.length; i++){
console.log("Barangay "+i,AllBarangay[i]);
BarangayData.push({"name":AllBarangay[i]});
}
$ionicLoading.hide();
return BarangayData;
}, function(err) {
console.error('[ ERROR ]', JSON.stringify(err));
$ionicLoading.hide();
return ;
})
},
}
.factory('getBlazer', function($http, $ionicLoading) {
var TempData = [];
return {
getBlazerDataInfo: function() {
$ionicLoading.show({ template: '<ion-spinner icon="crescent"></ion-spinner>' });
return $http.get(blazerAPI + '/blazer_data.php', { headers: { 'Content-Type': 'application/x-www-form-urlencoded' } }).then(function(response) {
console.log('[ SUCCESS ]', JSON.stringify(response));
TempData = response.data;
$ionicLoading.hide();
return TempData;
}, function(err) {
console.error('[ ERROR ]', JSON.stringify(err));
$ionicLoading.hide();
return;
})
},
getUserProfile: function(username) {
console.log("****** ON ENTER GET USER PROFILE SERVICE ******");
// $ionicLoading.show({ template: '<ion-spinner icon="crescent"></ion-spinner>'});
return $http.get(blazerAPI + '/user_profile.php?username=' + username, { headers: { 'Content-Type': 'application/x-www-form-urlencoded' } }).then(function(response) {
console.log('[ SUCCESS ]', JSON.stringify(response));
TempData = response.data[0];
$ionicLoading.hide();
return TempData;
}, function(err) {
console.error('[ ERROR ]', JSON.stringify(err));
$ionicLoading.hide();
return;
})
},
getTravelStats: function(username) {
console.log("****** ON ENTER GET USER TRAVEL STATUS SERVICE ******");
// $ionicLoading.show({ template: '<ion-spinner icon="crescent"></ion-spinner>'});
return $http.get(blazerAPI + '/travel_stats.php?username=' + username, { headers: { 'Content-Type': 'application/x-www-form-urlencoded' } }).then(function(response) {
console.log('[ SUCCESS ]', JSON.stringify(response));
TempData = response.data;
$ionicLoading.hide();
return TempData;
}, function(err) {
console.error('[ ERROR ]', JSON.stringify(err));
$ionicLoading.hide();
return;
})
},
/* NOT USED */
getSharedRide: function() {
console.log("****** ON ENTER GET SHARED RIDE SERVICE ******");
// $ionicLoading.show( { template: '<ion-spinner icon="crescent"></ion-spinner>'} );
return $http.get(blazerAPI + '/take_shared_ride_data.php', { headers: { 'Content-Type': 'application/x-www-form-urlencoded' } }).then(function(response) {
console.log('[ SUCCESS ]', JSON.stringify(response));
TempData = response.data;
$ionicLoading.hide();
return TempData;
}, function(err) {
console.error('[ ERROR ]', JSON.stringify(err));
$ionicLoading.hide();
return;
})
},
getTakeSharedRide: function(username) {
console.log("****** ON ENTER GET TAKE A SHARED RIDE SERVICE ******");
// $ionicLoading.show( { template: '<ion-spinner icon="crescent"></ion-spinner>'} );
return $http.get(blazerAPI + '/take_shared_ride_data.php?username=' + username, { headers: { 'Content-Type': 'application/x-www-form-urlencoded' } }).then(function(response) {
console.log('[ SUCCESS ]', JSON.stringify(response));
TempData = response.data;
$ionicLoading.hide();
return TempData;
}, function(err) {
console.error('[ ERROR ]', JSON.stringify(err));
$ionicLoading.hide();
return;
})
},
getDetailedSharedRide: function(rideID, username) {
DetailedSharedRide = {};
console.log("[ RIDE ID ]", rideID);
console.log("****** ON ENTER GET DETAILED SHARED RIDE SERVICE ******");
$ionicLoading.show({ template: '<ion-spinner icon="crescent"></ion-spinner>' });
return $http.get(blazerAPI + '/take_shared_ride_data.php?username=' + username, { headers: { 'Content-Type': 'application/x-www-form-urlencoded' } }).then(function(response) {
// console.log('[ SUCCESS ]', JSON.stringify(response));
TempData = response.data;
angular.forEach(TempData, function(value, key) {
if (value.id === rideID) {
DetailedSharedRide = { "id": value.id, "createdby": value.createdby, "destination": value.destination, "pickuplocation": value.pickuplocation, "pickup_lat": value.pickup_lat, "pickup_long": value.pickup_long, "assemblytime": value.assemblytime, "model": value.model, "mobilenum": value.mobilenum, "otherdetails": value.otherdetails, "subscribers": value.subscribers, "capacityleft": value.capacityleft, "avatar": value.avatar, "ride_status": value.ride_status, "interested_status": value.interested_status }
console.log("[ DETAILED SHARED RIDE ]", JSON.stringify(DetailedSharedRide));
$ionicLoading.hide();
}
});
return DetailedSharedRide;
}, function(err) {
console.error('[ ERROR ]', JSON.stringify(err));
$ionicLoading.hide();
return;
})
},
/* PENDING PENDING PENDING PENDING PENDING PENDING PENDING */
getModeofTransportation: function(rideID) {
console.log("****** ON ENTER MODE OF TRANSPORT SERVICE ******");
$ionicLoading.show({ template: '<ion-spinner icon="crescent"></ion-spinner>' });
return $http.get(blazerAPI + '/get_transportation_mode.php', { headers: { 'Content-Type': 'application/x-www-form-urlencoded' } }).then(function(response) {
// console.log('[ SUCCESS ]', JSON.stringify(response));
TempData = response.data;
angular.forEach(TempData, function(value, key) {
if (value.id === rideID) {
TempData = {};
console.log("[ MODE OF TRANSPORT ]", JSON.stringify(TempData));
$ionicLoading.hide();
}
});
return TempData;
}, function(err) {
console.error('[ ERROR ]', JSON.stringify(err));
$ionicLoading.hide();
return;
})
},
getAllBarangay: function() {
$ionicLoading.show({ template: '<ion-spinner icon="crescent"></ion-spinner>' });
return $http.get(blazerAPI + '/get_barangay.php', { headers: { 'Content-Type': 'application/x-www-form-urlencoded' } }).then(function(response) {
console.log('[ SUCCESS ]', JSON.stringify(response));
TempData = response.data;
// LOOP BARANGAY DATA
var BarangayData = [];
for (var i = 0; i < TempData.length; i++) {
console.log("Barangay " + i, TempData[i]);
BarangayData.push({ "name": TempData[i] });
}
$ionicLoading.hide();
return BarangayData;
}, function(err) {
console.error('[ ERROR ]', JSON.stringify(err));
$ionicLoading.hide();
return;
})
},
getMapData: function() {
$ionicLoading.show({ template: '<ion-spinner icon="crescent"></ion-spinner>' });
return $http.get(blazerAPI_V2 + '/index.php/map/barangay_visualization', { headers: { 'Content-Type': 'application/x-www-form-urlencoded' } }).then(function(response) {
console.log('[ SUCCESS ]', JSON.stringify(response));
TempData = response.data;
$ionicLoading.hide();
return TempData;
}, function(err) {
console.error('[ ERROR ]', JSON.stringify(err));
$ionicLoading.hide();
return;
})
},
getMostPopulatNonCarMode: function(barangay, time) {
$ionicLoading.show({ template: '<ion-spinner icon="crescent"></ion-spinner>' });
return $http.get(blazerAPI_V2 + '/index.php/barangay/most_popular_non_car/' + barangay + '/' + time, { headers: { 'Content-Type': 'application/x-www-form-urlencoded' } }).then(function(response) {
console.log('[ SUCCESS ]', JSON.stringify(response));
TempData = response.data;
$ionicLoading.hide();
return TempData;
}, function(err) {
console.error('[ ERROR ]', JSON.stringify(err));
$ionicLoading.hide();
return;
})
},
getHowYouMoveAround: function(start, end, username) {
$ionicLoading.show({ template: '<ion-spinner icon="crescent"></ion-spinner>' });
return $http.get(blazerAPI_V2 + '/index.php/diary/how_you_moved/' + start + '/' + end + '/' + username, { headers: { 'Content-Type': 'application/x-www-form-urlencoded' } }).then(function(response) {
console.log('[ SUCCESS ]', JSON.stringify(response));
TempData = response.data;
$ionicLoading.hide();
return TempData;
}, function(err) {
console.error('[ ERROR ]', JSON.stringify(err));
$ionicLoading.hide();
return;
})
},
getHowYouMoveAround: function(start, end, username) {
$ionicLoading.show({ template: '<ion-spinner icon="crescent"></ion-spinner>' });
return $http.get(blazerAPI_V2 + '/index.php/diary/how_you_moved/' + start + '/' + end + '/' + username, { headers: { 'Content-Type': 'application/x-www-form-urlencoded' } }).then(function(response) {
console.log('[ SUCCESS ]', JSON.stringify(response));
TempData = response.data;
$ionicLoading.hide();
return TempData;
}, function(err) {
console.error('[ ERROR ]', JSON.stringify(err));
$ionicLoading.hide();
return;
})
},
getComparisonMessage: function(username) {
return $http.get('http://blaze.eacomm.com/includes/get_facts.php?username=' + username, { headers: { 'Content-Type': 'application/x-www-form-urlencoded' } }).then(function(response) {
console.log('[ SUCCESS ]', JSON.stringify(response));
TempData = response.data;
return TempData;
},
function(err) {
console.error('[ ERROR ]', JSON.stringify(err));
$ionicLoading.hide();
return;
})
},
}
})
/*-------------------------------------------------- POST -------------------------------------------------- */
.service('postBlazer', function($q, $http, $ionicLoading) {
return {
LoginUser: function(user) {
console.log("****** ON ENTER LOGIN SERVICE ******");
var deferred = $q.defer();
var promise = deferred.promise;
console.log("[ USER CREDENTIALS ] -> ", JSON.stringify(user));
$ionicLoading.show({ template: '<ion-spinner icon="crescent"></ion-spinner>', duration: 30000});
$http({method: 'POST', url: blazerAPI + '/login.php',
data: $.param(user),
headers : {'Content-Type': 'application/x-www-form-urlencoded'}
}).success(function(responseData) {
console.log("[ LOGIN RESPONSE ]", JSON.stringify(responseData));
if(responseData.status == 0){
$ionicLoading.show({ template: 'Invalid Credentials. Try again!', duration: 1000});
deferred.reject('Error');
}
else if(responseData.status == 1){
deferred.resolve('Success');
// $ionicLoading.show({ template: "Success!", duration: 500});
$ionicLoading.hide();
localStorage.setItem("userID", responseData.user.id);
console.log("[ USER ID ]", responseData.user.id);
}
}).error(function(responseData) {
console.error("[ ERROR ]", JSON.stringify(responseData));
deferred.reject('Error');
$ionicLoading.show({ template: "Check your connection!", duration: 500});
});
promise.success = function(fn) {
promise.then(fn);
return promise;
}
promise.error = function(fn) {
promise.then(null, fn);
return promise;
}
return promise;
},
LogTrip: function(coords, username) {
console.log("****** ON ENTER TRIP LOGGING SERVICE ******");
var deferred = $q.defer();
var promise = deferred.promise;
$ionicLoading.show({ template: '<ion-spinner icon="crescent"></ion-spinner>', duration: 500});
var logTrip = {};
var currentTrip = localStorage.getItem("currentTrip");
logTrip = {
username: username,
type: currentTrip,
coordinates: coords
}
console.log("[ TRIP JSON ]", JSON.stringify(logTrip));
$http({ method: 'POST', url: blazerAPI + '/log_trip.php',
data: $.param(logTrip),
headers : {'Content-Type': 'application/x-www-form-urlencoded'}
}).success(function(responseData) {
console.log("[ SUCCESS ]", JSON.stringify(responseData));
localStorage.setItem("tripid", responseData.trip_id);
deferred.resolve('Success');
// $ionicLoading.show({ template: "Success!", duration: 1000});
}).error(function(responseData) {
console.error("[ ERROR ]", JSON.stringify(responseData));
deferred.reject('Error');
$ionicLoading.show({ template: "Sending Error!", duration: 1000});
});
promise.success = function(fn) {
promise.then(fn);
return promise;
}
promise.error = function(fn) {
promise.then(null, fn);
return promise;
}
return promise;
},
EndTripSurvey: function(data) {
console.log("****** ON ENTER TRIP END SERVICE ******");
var deferred = $q.defer();
var promise = deferred.promise;
var endtripdata = {
"trip_id" : data.trip_id,
"username": data.username,
"depart": data.depart,
"arrive": data.arrive,
"mode": data.mode,
"exp": data.exp,
"emotion": data.emotion,
"type": data.type
};
var stringendtripdata = angular.fromJson(endtripdata);
console.log("[ END TRIP SURVEY ] -> ", JSON.stringify(data));
$ionicLoading.show({ template: '<ion-spinner icon="crescent"></ion-spinner>', duration: 30000});
$http({method: 'POST', url: blazerAPI + '/end_trip.php',
data: $.param(stringendtripdata),
headers : {'Content-Type': 'application/x-www-form-urlencoded'}
}).success(function(responseData) {
console.log("[ SUCCESS ]", JSON.stringify(responseData));
deferred.resolve('Success');
$ionicLoading.show({ template: "Submitted!", duration: 1000});
}).error(function(responseData) {
console.error("[ ERROR ]", JSON.stringify(responseData));
deferred.reject('Error');
$ionicLoading.show({ template: "Try Again!", duration: 1000});
});
promise.success = function(fn) {
promise.then(fn);
return promise;
}
promise.error = function(fn) {
promise.then(null, fn);
return promise;
}
return promise;
},
WeeklySurvey: function(data) {
console.log("****** ON ENTER WEEKLY SURVEY SERVICE ******");
var deferred = $q.defer();
var promise = deferred.promise;
console.log("[ WEEKLY DATA ] -> ", JSON.stringify(data));
$ionicLoading.show({ template: '<ion-spinner icon="crescent"></ion-spinner>', duration: 30000});
var weeklysurveydata = {
"user_id": data.user_id,
"username": data.username,
"choice": data.choice,
"survey_ans": data.survey_ans,
"date_created": data.date_created
};
$http({method: 'POST', url: blazerAPI + '/weekly_survey.php',
data: $.param(weeklysurveydata),
headers : {'Content-Type': 'application/x-www-form-urlencoded'}
}).success(function(responseData) {
console.log("[ SUCCESS ]", JSON.stringify(responseData));
deferred.resolve('Success');
$ionicLoading.show({ template: "Submitted!", duration: 1000});
}).error(function(responseData) {
console.error("[ ERROR ]", JSON.stringify(responseData));
deferred.reject('Error');
$ionicLoading.show({ template: "Try Again!", duration: 1000});
});
promise.success = function(fn) {
promise.then(fn);
return promise;
}
promise.error = function(fn) {
promise.then(null, fn);
return promise;
}
return promise;
},
TakeSharedRide: function(data) {
console.log("****** ON ENTER TAKE SHARED RIDE SERVICE ******");
var deferred = $q.defer();
var promise = deferred.promise;
console.log("[ TAKE A SHAREDRIDE DATA ] -> ", JSON.stringify(data));
$ionicLoading.show({ template: '<ion-spinner icon="crescent"></ion-spinner>', duration: 30000});
var sharedRideData = {
"ride_id": data.ride_id,
"user": data.username
};
$http({method: 'POST', url: blazerAPI + '/take_shared_ride_post.php',
data: $.param(sharedRideData),
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;
},
InterestedRide: function(data) {
console.log("****** ON ENTER INTERESTED RIDE SERVICE ******");
var deferred = $q.defer();
var promise = deferred.promise;
console.log("[ INTERESTED DATA ] -> ", JSON.stringify(data));
$ionicLoading.show({ template: '<ion-spinner icon="crescent"></ion-spinner>', duration: 30000});
var interestedRideData = {
"ride_id": data.ride_id,
"username": data.username
};
$http({method: 'POST', url: blazerAPI + '/interested_ride_post.php',
data: $.param(interestedRideData),
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;
},
OfferRide: function(data) {
console.log("****** ON ENTER OFFER RIDE SERVICE ******");
var deferred = $q.defer();
var promise = deferred.promise;
console.log("[ OFFER DATA ] -> ", JSON.stringify(data));
$ionicLoading.show({ template: '<ion-spinner icon="crescent"></ion-spinner>', duration: 30000});
var offerRiderData = {
"name": data.name,
"pickup_lat": data.pickup_lat,
"pickup_lng": data.pickup_lng,
"dest_lat": data.dest_lat,
"dest_lng": data.dest_lng,
"assembly_time": data.assembly_time,
"car_model": data.car_model,
"capacity": data.capacity,
"mobile": data.mobile,
"other": data.other
};
$http({method: 'POST', url: blazerAPI + '/offer_ride.php',
data: $.param(offerRiderData),
headers : {'Content-Type': 'application/x-www-form-urlencoded'}
}).success(function(responseData) {
console.log("[ SUCCESS ]", JSON.stringify(responseData));
deferred.resolve('Success');
$ionicLoading.show({ template: "Ride Offered", duration: 1000});
}).error(function(responseData) {
console.error("[ OFFER RIDE 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;
},
BarangayInformation: function(data) {
console.log("****** ON ENTER BARANGAY DATA SERVICE ******");
var deferred = $q.defer();
var promise = deferred.promise;
console.log("[ BARANGAY DATA ] -> ", JSON.stringify(data));
$ionicLoading.show({ template: '<ion-spinner icon="crescent"></ion-spinner>', duration: 30000});
var selectedBarangay = {
"barangay": data.barangay,
"time": data.time
};
$http({method: 'POST', url: 'http://blaze.eacomm.com/includes/barangay/barangay_percentage.php',
data: $.param(selectedBarangay),
headers : {'Content-Type': 'application/x-www-form-urlencoded'}
}).success(function(responseData) {
console.log("[ SUCCESS ]", JSON.stringify(responseData));
deferred.resolve(responseData);
$ionicLoading.hide();
return responseData;
}).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;
},
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;
},
}
})
return {
LoginUser: function(user) {
console.log("****** ON ENTER LOGIN SERVICE ******");
var deferred = $q.defer();
var promise = deferred.promise;
console.log("[ USER CREDENTIALS ] -> ", JSON.stringify(user));
$ionicLoading.show({ template: '<ion-spinner icon="crescent"></ion-spinner>', duration: 30000 });
$http({
method: 'POST',
url: blazerAPI + '/login.php',
data: $.param(user),
headers: { 'Content-Type': 'application/x-www-form-urlencoded' }
}).success(function(responseData) {
console.log("[ LOGIN RESPONSE ]", JSON.stringify(responseData));
if (responseData.status == 0) {
$ionicLoading.show({ template: 'Invalid Credentials. Try again!', duration: 1000 });
deferred.reject('Error');
} else if (responseData.status == 1) {
deferred.resolve('Success');
// $ionicLoading.show({ template: "Success!", duration: 500});
$ionicLoading.hide();
localStorage.setItem("userID", responseData.user.id);
console.log("[ USER ID ]", responseData.user.id);
}
}).error(function(responseData) {
console.error("[ ERROR ]", JSON.stringify(responseData));
deferred.reject('Error');
$ionicLoading.show({ template: "Check your connection!", duration: 500 });
});
promise.success = function(fn) {
promise.then(fn);
return promise;
}
promise.error = function(fn) {
promise.then(null, fn);
return promise;
}
return promise;
},
LogTrip: function(coords, username) {
console.log("****** ON ENTER TRIP LOGGING SERVICE ******");
var deferred = $q.defer();
var promise = deferred.promise;
$ionicLoading.show({ template: '<ion-spinner icon="crescent"></ion-spinner>', duration: 500 });
var logTrip = {};
var currentTrip = localStorage.getItem("currentTrip");
logTrip = {
username: username,
type: currentTrip,
coordinates: coords
}
console.log("[ TRIP JSON ]", JSON.stringify(logTrip));
$http({
method: 'POST',
url: blazerAPI + '/log_trip.php',
data: $.param(logTrip),
headers: { 'Content-Type': 'application/x-www-form-urlencoded' }
}).success(function(responseData) {
console.log("[ SUCCESS ]", JSON.stringify(responseData));
localStorage.setItem("tripid", responseData.trip_id);
deferred.resolve('Success');
// $ionicLoading.show({ template: "Success!", duration: 1000});
}).error(function(responseData) {
console.error("[ ERROR ]", JSON.stringify(responseData));
deferred.reject('Error');
$ionicLoading.show({ template: "Sending Error!", duration: 1000 });
});
promise.success = function(fn) {
promise.then(fn);
return promise;
}
promise.error = function(fn) {
promise.then(null, fn);
return promise;
}
return promise;
},
EndTripSurvey: function(data) {
console.log("****** ON ENTER TRIP END SERVICE ******");
var deferred = $q.defer();
var promise = deferred.promise;
var endtripdata = {
"trip_id": data.trip_id,
"username": data.username,
"depart": data.depart,
"arrive": data.arrive,
"mode": data.mode,
"exp": data.exp,
"emotion": data.emotion,
"type": data.type
};
var stringendtripdata = angular.fromJson(endtripdata);
console.log("[ END TRIP SURVEY ] -> ", JSON.stringify(data));
$ionicLoading.show({ template: '<ion-spinner icon="crescent"></ion-spinner>', duration: 30000 });
$http({
method: 'POST',
url: blazerAPI + '/end_trip.php',
data: $.param(stringendtripdata),
headers: { 'Content-Type': 'application/x-www-form-urlencoded' }
}).success(function(responseData) {
console.log("[ SUCCESS ]", JSON.stringify(responseData));
deferred.resolve('Success');
$ionicLoading.show({ template: "Submitted!", duration: 1000 });
}).error(function(responseData) {
console.error("[ ERROR ]", JSON.stringify(responseData));
deferred.reject('Error');
$ionicLoading.show({ template: "Try Again!", duration: 1000 });
});
promise.success = function(fn) {
promise.then(fn);
return promise;
}
promise.error = function(fn) {
promise.then(null, fn);
return promise;
}
return promise;
},
WeeklySurvey: function(data) {
console.log("****** ON ENTER WEEKLY SURVEY SERVICE ******");
var deferred = $q.defer();
var promise = deferred.promise;
console.log("[ WEEKLY DATA ] -> ", JSON.stringify(data));
$ionicLoading.show({ template: '<ion-spinner icon="crescent"></ion-spinner>', duration: 30000 });
var weeklysurveydata = {
"user_id": data.user_id,
"username": data.username,
"choice": data.choice,
"survey_ans": data.survey_ans,
"date_created": data.date_created
};
$http({
method: 'POST',
url: blazerAPI + '/weekly_survey.php',
data: $.param(weeklysurveydata),
headers: { 'Content-Type': 'application/x-www-form-urlencoded' }
}).success(function(responseData) {
console.log("[ SUCCESS ]", JSON.stringify(responseData));
deferred.resolve('Success');
$ionicLoading.show({ template: "Submitted!", duration: 1000 });
}).error(function(responseData) {
console.error("[ ERROR ]", JSON.stringify(responseData));
deferred.reject('Error');
$ionicLoading.show({ template: "Try Again!", duration: 1000 });
});
promise.success = function(fn) {
promise.then(fn);
return promise;
}
promise.error = function(fn) {
promise.then(null, fn);
return promise;
}
return promise;
},
TakeSharedRide: function(data) {
console.log("****** ON ENTER TAKE SHARED RIDE SERVICE ******");
var deferred = $q.defer();
var promise = deferred.promise;
console.log("[ TAKE A SHAREDRIDE DATA ] -> ", JSON.stringify(data));
$ionicLoading.show({ template: '<ion-spinner icon="crescent"></ion-spinner>', duration: 30000 });
var sharedRideData = {
"ride_id": data.ride_id,
"user": data.username
};
$http({
method: 'POST',
url: blazerAPI + '/take_shared_ride_post.php',
data: $.param(sharedRideData),
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;
},
InterestedRide: function(data) {
console.log("****** ON ENTER INTERESTED RIDE SERVICE ******");
var deferred = $q.defer();
var promise = deferred.promise;
console.log("[ INTERESTED DATA ] -> ", JSON.stringify(data));
$ionicLoading.show({ template: '<ion-spinner icon="crescent"></ion-spinner>', duration: 30000 });
var interestedRideData = {
"ride_id": data.ride_id,
"username": data.username
};
$http({
method: 'POST',
url: blazerAPI + '/interested_ride_post.php',
data: $.param(interestedRideData),
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;
},
OfferRide: function(data) {
console.log("****** ON ENTER OFFER RIDE SERVICE ******");
var deferred = $q.defer();
var promise = deferred.promise;
console.log("[ OFFER DATA ] -> ", JSON.stringify(data));
$ionicLoading.show({ template: '<ion-spinner icon="crescent"></ion-spinner>', duration: 30000 });
var offerRiderData = {
"name": data.name,
"pickup_lat": data.pickup_lat,
"pickup_lng": data.pickup_lng,
"dest_lat": data.dest_lat,
"dest_lng": data.dest_lng,
"assembly_time": data.assembly_time,
"car_model": data.car_model,
"capacity": data.capacity,
"mobile": data.mobile,
"other": data.other
};
$http({
method: 'POST',
url: blazerAPI + '/offer_ride.php',
data: $.param(offerRiderData),
headers: { 'Content-Type': 'application/x-www-form-urlencoded' }
}).success(function(responseData) {
console.log("[ SUCCESS ]", JSON.stringify(responseData));
deferred.resolve('Success');
$ionicLoading.show({ template: "Ride Offered", duration: 1000 });
}).error(function(responseData) {
console.error("[ OFFER RIDE 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;
},
BarangayInformation: function(data) {
console.log("****** ON ENTER BARANGAY DATA SERVICE ******");
var deferred = $q.defer();
var promise = deferred.promise;
console.log("[ BARANGAY DATA ] -> ", JSON.stringify(data));
$ionicLoading.show({ template: '<ion-spinner icon="crescent"></ion-spinner>', duration: 30000 });
var selectedBarangay = {
"barangay": data.barangay,
"time": data.time
};
$http({
method: 'POST',
url: 'http://blaze.eacomm.com/includes/barangay/barangay_percentage.php',
data: $.param(selectedBarangay),
headers: { 'Content-Type': 'application/x-www-form-urlencoded' }
}).success(function(responseData) {
console.log("[ SUCCESS ]", JSON.stringify(responseData));
deferred.resolve(responseData);
$ionicLoading.hide();
return responseData;
}).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;
},
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;
},
/******************** API V2 *********************/
UserSummary: function(data) {
console.log("****** ON ENTER USER SUMMARY SERVICE ******");
var deferred = $q.defer();
var promise = deferred.promise;
console.log("[ ENTRY DATA ] -> ", JSON.stringify(data));
$ionicLoading.show({ template: '<ion-spinner icon="crescent"></ion-spinner>', duration: 30000 });
var requestData = {
"user_id": data.user_id,
"username": data.username
};
$http({
method: 'POST',
url: blazerAPI_V2 + '/index.php/summary/get_summary',
data: $.param(requestData),
headers: { 'Content-Type': 'application/x-www-form-urlencoded' }
}).success(function(responseData) {
console.log("[ SUCCESS ]", JSON.stringify(responseData));
deferred.resolve(responseData);
$ionicLoading.hide();
return responseData;
}).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;
},
GetTripDetails: function(data) {
console.log("****** ON ENTER TRIP DETAILS SERVICE ******");
var deferred = $q.defer();
var promise = deferred.promise;
console.log("[ ENTRY DATA ] -> ", JSON.stringify(data));
$ionicLoading.show({ template: '<ion-spinner icon="crescent"></ion-spinner>', duration: 30000 });
var requestData = {
"username": data.username,
"date": data.date
};
$http({
method: 'POST',
url: blazerAPI_V2 + '/index.php/logger/get_trip',
data: $.param(requestData),
headers: { 'Content-Type': 'application/x-www-form-urlencoded' }
}).success(function(responseData) {
console.log("[ SUCCESS ]", JSON.stringify(responseData));
deferred.resolve(responseData);
$ionicLoading.hide();
return responseData;
}).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;
},
LogTripV2: function(data) {
console.log("****** ON ENTER LOG TRIP DETAILS SERVICE ******");
var deferred = $q.defer();
var promise = deferred.promise;
console.log("[ ENTRY DATA ] -> ", JSON.stringify(data));
$ionicLoading.show({ template: '<ion-spinner icon="crescent"></ion-spinner>', duration: 30000 });
var requestData = {
"origin": data.origin,
"destination": data.destination,
"username": data.username,
"type": data.type,
"datecreated": data.datecreated,
"depart": data.depart,
"arrive": data.arrive,
"mode": data.mode,
"exp": data.exp,
"emotion": data.emotion,
};
$http({
method: 'POST',
url: blazerAPI_V2 + '/index.php/logger/add_trip',
data: $.param(requestData),
headers: { 'Content-Type': 'application/x-www-form-urlencoded' }
}).success(function(responseData) {
console.log("[ SUCCESS ]", JSON.stringify(responseData));
deferred.resolve(responseData);
$ionicLoading.hide();
return responseData;
}).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;
},
UpdateTrip: function(data) {
console.log("****** ON ENTER UPDATE TRIP DETAILS SERVICE ******");
var deferred = $q.defer();
var promise = deferred.promise;
console.log("[ ENTRY DATA ] -> ", JSON.stringify(data));
$ionicLoading.show({ template: '<ion-spinner icon="crescent"></ion-spinner>', duration: 30000 });
var requestData = {
"trip_uploads_id": data.trip_uploads_id,
"origin": data.origin,
"destination": data.destination,
"username": data.username,
"type": data.type,
"datecreated": data.datecreated,
"depart": data.depart,
"arrive": data.arrive,
"mode": data.mode,
"exp": data.exp,
"emotion": data.emotion,
};
$http({
method: 'POST',
url: blazerAPI_V2 + '/index.php/logger/update_trip',
data: $.param(requestData),
headers: { 'Content-Type': 'application/x-www-form-urlencoded' }
}).success(function(responseData) {
console.log("[ SUCCESS ]", JSON.stringify(responseData));
deferred.resolve(responseData);
$ionicLoading.hide();
return responseData;
}).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;
},
NoTrip: function(data) {
console.log("****** ON ENTER NO TRIP DETAILS SERVICE ******");
var deferred = $q.defer();
var promise = deferred.promise;
console.log("[ ENTRY DATA ] -> ", JSON.stringify(data));
$ionicLoading.show({ template: '<ion-spinner icon="crescent"></ion-spinner>', duration: 30000 });
var requestData = {
"username": data.username,
"id": data.id,
"mode": data.mode,
"date": data.date, // YYYY-MM-DD
};
$http({
method: 'POST',
url: blazerAPI_V2 + '/index.php/logger/no_trip',
data: $.param(requestData),
headers: { 'Content-Type': 'application/x-www-form-urlencoded' }
}).success(function(responseData) {
console.log("[ SUCCESS ]", JSON.stringify(responseData));
deferred.resolve(responseData);
$ionicLoading.hide();
return responseData;
}).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;
},
VerifyTrip: function(data) {
console.log("****** ON ENTER VERIFY TRIP DETAILS SERVICE ******");
var deferred = $q.defer();
var promise = deferred.promise;
console.log("[ ENTRY DATA ] -> ", JSON.stringify(data));
$ionicLoading.show({ template: '<ion-spinner icon="crescent"></ion-spinner>', duration: 30000 });
var requestData = {
"username": data.username,
"date": data.date, // YYYY-MM-DD
};
$http({
method: 'POST',
url: blazerAPI_V2 + '/index.php/logger/verify',
data: $.param(requestData),
headers: { 'Content-Type': 'application/x-www-form-urlencoded' }
}).success(function(responseData) {
console.log("[ SUCCESS ]", JSON.stringify(responseData));
deferred.resolve(responseData);
$ionicLoading.hide();
return responseData;
}).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;
},
HometoSchoolTravelTimes: function(data) {
console.log("****** ON ENTER HOME TO SCHOOL TRIP DETAILS SERVICE ******");
var deferred = $q.defer();
var promise = deferred.promise;
console.log("[ ENTRY DATA ] -> ", JSON.stringify(data));
$ionicLoading.show({ template: '<ion-spinner icon="crescent"></ion-spinner>', duration: 30000 });
var requestData = {
"username": data.username,
"start_date": data.start_date, // YYYY-MM-DD
"end_date": data.end_date // YYYY-MM-DD
};
$http({
method: 'POST',
url: blazerAPI_V2 + '/index.php/summary/get_home_to_school_travel_time',
data: $.param(requestData),
headers: { 'Content-Type': 'application/x-www-form-urlencoded' }
}).success(function(responseData) {
console.log("[ SUCCESS ]", JSON.stringify(responseData));
deferred.resolve(responseData);
$ionicLoading.hide();
return responseData;
}).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;
},
TripLogGraph: function(data) {
console.log("****** ON ENTER TRIP LOG GRAPH DETAILS SERVICE ******");
var deferred = $q.defer();
var promise = deferred.promise;
console.log("[ ENTRY DATA ] -> ", JSON.stringify(data));
$ionicLoading.show({ template: '<ion-spinner icon="crescent"></ion-spinner>', duration: 30000 });
var requestData = {
"username": data.username,
"month": data.month, // YYYY-MM-DD
"year": data.year // YYYY-MM-DD
};
$http({
method: 'POST',
url: blazerAPI_V2 + '/index.php/summary/trip_log_graph',
data: $.param(requestData),
headers: { 'Content-Type': 'application/x-www-form-urlencoded' }
}).success(function(responseData) {
console.log("[ SUCCESS ]", JSON.stringify(responseData));
deferred.resolve(responseData);
$ionicLoading.hide();
return responseData;
}).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;
},
PerformanceSummary: function(data) {
console.log("****** ON ENTER PERFORMANCE SUMMARY DETAILS SERVICE ******");
var deferred = $q.defer();
var promise = deferred.promise;
console.log("[ ENTRY DATA ] -> ", JSON.stringify(data));
$ionicLoading.show({ template: '<ion-spinner icon="crescent"></ion-spinner>', duration: 30000 });
var requestData = {
"user_id": data.user_id,
"date": data.date, // YYYY-MM-DD
};
$http({
method: 'POST',
url: blazerAPI_V2 + '/index.php/summary/performance',
data: $.param(requestData),
headers: { 'Content-Type': 'application/x-www-form-urlencoded' }
}).success(function(responseData) {
console.log("[ SUCCESS ]", JSON.stringify(responseData));
deferred.resolve(responseData);
$ionicLoading.hide();
return responseData;
}).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;
},
/*********** MAP DIRECTIVES ***********/
.service('LocationService', function($q){
var autocompleteService = new google.maps.places.AutocompleteService();
var detailsService = new google.maps.places.PlacesService(document.createElement("input"));
return {
searchAddress: function(input) {
var deferred = $q.defer();
autocompleteService.getPlacePredictions({
input: input
}, function(result, status) {
if(status == google.maps.places.PlacesServiceStatus.OK){
console.log(status);
deferred.resolve(result);
}else{
deferred.reject(status)
}
});
return deferred.promise;
},
getDetails: function(placeId) {
var deferred = $q.defer();
detailsService.getDetails({placeId: placeId}, function(result) {
deferred.resolve(result);
});
return deferred.promise;
}
};
})
.directive('locationSuggestion', function($ionicModal, LocationService){
return {
restrict: 'A',
scope: {
location: '='
},
link: function($scope, element){
console.log('locationSuggestion started!');
$scope.search = {};
$scope.search.suggestions = [];
$scope.search.query = "";
$ionicModal.fromTemplateUrl('app/offerride/popover/location.html', {
scope: $scope,
focusFirstInput: true
}).then(function(modal) {
$scope.modal = modal;
});
element[0].addEventListener('focus', function(event) {
$scope.open();
});
$scope.$watch('search.query', function(newValue) {
if (newValue) {
LocationService.searchAddress(newValue).then(function(result) {
$scope.search.error = null;
$scope.search.suggestions = result;
}, function(status){
$scope.search.error = "There was an error :( " + status;
});
};
$scope.open = function() {
$scope.modal.show();
};
$scope.close = function() {
$scope.modal.hide();
};
$scope.choosePlace = function(place) {
LocationService.getDetails(place.place_id).then(function(location) {
$scope.location = location;
$scope.close();
});
/*********** MAP DIRECTIVES ***********/
.service('LocationService', function($q) {
var autocompleteService = new google.maps.places.AutocompleteService();
var detailsService = new google.maps.places.PlacesService(document.createElement("input"));
return {
searchAddress: function(input) {
var deferred = $q.defer();
autocompleteService.getPlacePredictions({
input: input
}, function(result, status) {
if (status == google.maps.places.PlacesServiceStatus.OK) {
console.log(status);
deferred.resolve(result);
} else {
deferred.reject(status)
}
});
return deferred.promise;
},
getDetails: function(placeId) {
var deferred = $q.defer();
detailsService.getDetails({ placeId: placeId }, function(result) {
deferred.resolve(result);
});
return deferred.promise;
}
};
});
}
}
})
;
})
.directive('locationSuggestion', function($ionicModal, LocationService) {
return {
restrict: 'A',
scope: {
location: '='
},
link: function($scope, element) {
console.log('locationSuggestion started!');
$scope.search = {};
$scope.search.suggestions = [];
$scope.search.query = "";
$ionicModal.fromTemplateUrl('app/offerride/popover/location.html', {
scope: $scope,
focusFirstInput: true
}).then(function(modal) {
$scope.modal = modal;
});
element[0].addEventListener('focus', function(event) {
$scope.open();
});
$scope.$watch('search.query', function(newValue) {
if (newValue) {
LocationService.searchAddress(newValue).then(function(result) {
$scope.search.error = null;
$scope.search.suggestions = result;
}, function(status) {
$scope.search.error = "There was an error :( " + status;
});
};
$scope.open = function() {
$scope.modal.show();
};
$scope.close = function() {
$scope.modal.hide();
};
$scope.choosePlace = function(place) {
LocationService.getDetails(place.place_id).then(function(location) {
$scope.location = location;
$scope.close();
});
};
});
}
}
});
\ No newline at end of file
var blazerAPI = 'http://blaze.eacomm.com/api';
var appVersion = '1.0.0';
var blazerAPI_V2 = 'http://blaze.eacomm.com/api_v2';
var appVersion = '2.0.0';
var buildNumber = '0.0.1';
var maplayer = 'http://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png';
......
(function (factory) {
'use strict';
if (typeof exports === 'object') {
// Node/CommonJS
module.exports = factory(
typeof angular !== 'undefined' ? angular : require('angular'),
typeof Chart !== 'undefined' ? Chart : require('chart.js'));
} else if (typeof define === 'function' && define.amd) {
// AMD. Register as an anonymous module.
define(['angular', 'chart'], factory);
} else {
// Browser globals
factory(angular, Chart);
}
}(function (angular, Chart) {
'use strict';
Chart.defaults.global.responsive = true;
Chart.defaults.global.multiTooltipTemplate = '<%if (datasetLabel){%><%=datasetLabel%>: <%}%><%= value %>';
Chart.defaults.global.colours = [
'#97BBCD', // blue
'#DCDCDC', // light grey
'#F7464A', // red
'#46BFBD', // green
'#FDB45C', // yellow
'#949FB1', // grey
'#4D5360' // dark grey
];
var usingExcanvas = typeof window.G_vmlCanvasManager === 'object' &&
window.G_vmlCanvasManager !== null &&
typeof window.G_vmlCanvasManager.initElement === 'function';
if (usingExcanvas) Chart.defaults.global.animation = false;
return angular.module('chart.js', [])
.provider('ChartJs', ChartJsProvider)
.factory('ChartJsFactory', ['ChartJs', '$timeout', ChartJsFactory])
.directive('chartBase', ['ChartJsFactory', function (ChartJsFactory) { return new ChartJsFactory(); }])
.directive('chartLine', ['ChartJsFactory', function (ChartJsFactory) { return new ChartJsFactory('Line'); }])
.directive('chartBar', ['ChartJsFactory', function (ChartJsFactory) { return new ChartJsFactory('Bar'); }])
.directive('chartRadar', ['ChartJsFactory', function (ChartJsFactory) { return new ChartJsFactory('Radar'); }])
.directive('chartDoughnut', ['ChartJsFactory', function (ChartJsFactory) { return new ChartJsFactory('Doughnut'); }])
.directive('chartPie', ['ChartJsFactory', function (ChartJsFactory) { return new ChartJsFactory('Pie'); }])
.directive('chartPolarArea', ['ChartJsFactory', function (ChartJsFactory) { return new ChartJsFactory('PolarArea'); }]);
/**
* Wrapper for chart.js
* Allows configuring chart js using the provider
*
* angular.module('myModule', ['chart.js']).config(function(ChartJsProvider) {
* ChartJsProvider.setOptions({ responsive: true });
* ChartJsProvider.setOptions('Line', { responsive: false });
* })))
*/
function ChartJsProvider () {
var options = {};
var ChartJs = {
Chart: Chart,
getOptions: function (type) {
var typeOptions = type && options[type] || {};
return angular.extend({}, options, typeOptions);
}
};
(function(factory) {
'use strict';
if (typeof exports === 'object') {
// Node/CommonJS
module.exports = factory(
typeof angular !== 'undefined' ? angular : require('angular'),
typeof Chart !== 'undefined' ? Chart : require('chart.js'));
} else if (typeof define === 'function' && define.amd) {
// AMD. Register as an anonymous module.
define(['angular', 'chart'], factory);
} else {
// Browser globals
factory(angular, Chart);
}
}(function(angular, Chart) {
'use strict';
Chart.defaults.global.responsive = true;
Chart.defaults.global.multiTooltipTemplate = '<%if (datasetLabel){%><%=datasetLabel%>: <%}%><%= value %>';
Chart.defaults.global.colours = [
'#97BBCD', // blue
'#DCDCDC', // light grey
'#F7464A', // red
'#46BFBD', // green
'#FDB45C', // yellow
'#949FB1', // grey
'#4D5360' // dark grey
];
var usingExcanvas = typeof window.G_vmlCanvasManager === 'object' &&
window.G_vmlCanvasManager !== null &&
typeof window.G_vmlCanvasManager.initElement === 'function';
if (usingExcanvas) Chart.defaults.global.animation = false;
return angular.module('chart.js', [])
.provider('ChartJs', ChartJsProvider)
.factory('ChartJsFactory', ['ChartJs', '$timeout', ChartJsFactory])
.directive('chartBase', ['ChartJsFactory', function(ChartJsFactory) { return new ChartJsFactory(); }])
.directive('chartLine', ['ChartJsFactory', function(ChartJsFactory) { return new ChartJsFactory('Line'); }])
.directive('chartBar', ['ChartJsFactory', function(ChartJsFactory) { return new ChartJsFactory('Bar'); }])
.directive('chartRadar', ['ChartJsFactory', function(ChartJsFactory) { return new ChartJsFactory('Radar'); }])
.directive('chartDoughnut', ['ChartJsFactory', function(ChartJsFactory) { return new ChartJsFactory('Doughnut'); }])
.directive('chartPie', ['ChartJsFactory', function(ChartJsFactory) { return new ChartJsFactory('Pie'); }])
.directive('chartPolarArea', ['ChartJsFactory', function(ChartJsFactory) { return new ChartJsFactory('PolarArea'); }]);
/**
* Allow to set global options during configuration
* Wrapper for chart.js
* Allows configuring chart js using the provider
*
* angular.module('myModule', ['chart.js']).config(function(ChartJsProvider) {
* ChartJsProvider.setOptions({ responsive: true });
* ChartJsProvider.setOptions('Line', { responsive: false });
* })))
*/
this.setOptions = function (type, customOptions) {
// If no type was specified set option for the global object
if (! customOptions) {
customOptions = type;
options = angular.extend(options, customOptions);
return;
}
// Set options for the specific chart
options[type] = angular.extend(options[type] || {}, customOptions);
};
this.$get = function () {
return ChartJs;
};
}
function ChartJsFactory (ChartJs, $timeout) {
return function chart (type) {
return {
restrict: 'CA',
scope: {
data: '=?',
labels: '=?',
options: '=?',
series: '=?',
colours: '=?',
getColour: '=?',
chartType: '=',
legend: '@',
click: '=?',
hover: '=?',
chartData: '=?',
chartLabels: '=?',
chartOptions: '=?',
chartSeries: '=?',
chartColours: '=?',
chartLegend: '@',
chartClick: '=?',
chartHover: '=?'
},
link: function (scope, elem/*, attrs */) {
var chart, container = document.createElement('div');
container.className = 'chart-container';
elem.replaceWith(container);
container.appendChild(elem[0]);
if (usingExcanvas) window.G_vmlCanvasManager.initElement(elem[0]);
['data', 'labels', 'options', 'series', 'colours', 'legend', 'click', 'hover'].forEach(deprecated);
function aliasVar (fromName, toName) {
scope.$watch(fromName, function (newVal) {
if (typeof newVal === 'undefined') return;
scope[toName] = newVal;
});
}
/* provide backward compatibility to "old" directive names, by
* having an alias point from the new names to the old names. */
aliasVar('chartData', 'data');
aliasVar('chartLabels', 'labels');
aliasVar('chartOptions', 'options');
aliasVar('chartSeries', 'series');
aliasVar('chartColours', 'colours');
aliasVar('chartLegend', 'legend');
aliasVar('chartClick', 'click');
aliasVar('chartHover', 'hover');
// Order of setting "watch" matter
scope.$watch('data', function (newVal, oldVal) {
if (! newVal || ! newVal.length || (Array.isArray(newVal[0]) && ! newVal[0].length)) return;
var chartType = type || scope.chartType;
if (! chartType) return;
if (chart) {
if (canUpdateChart(newVal, oldVal)) return updateChart(chart, newVal, scope, elem);
chart.destroy();
function ChartJsProvider() {
var options = {};
var ChartJs = {
Chart: Chart,
getOptions: function(type) {
var typeOptions = type && options[type] || {};
return angular.extend({}, options, typeOptions);
}
createChart(chartType);
}, true);
scope.$watch('series', resetChart, true);
scope.$watch('labels', resetChart, true);
scope.$watch('options', resetChart, true);
scope.$watch('colours', resetChart, true);
scope.$watch('chartType', function (newVal, oldVal) {
if (isEmpty(newVal)) return;
if (angular.equals(newVal, oldVal)) return;
if (chart) chart.destroy();
createChart(newVal);
});
scope.$on('$destroy', function () {
if (chart) chart.destroy();
});
function resetChart (newVal, oldVal) {
if (isEmpty(newVal)) return;
if (angular.equals(newVal, oldVal)) return;
var chartType = type || scope.chartType;
if (! chartType) return;
// chart.update() doesn't work for series and labels
// so we have to re-create the chart entirely
if (chart) chart.destroy();
createChart(chartType);
}
function createChart (type) {
if (isResponsive(type, scope) && elem[0].clientHeight === 0 && container.clientHeight === 0) {
return $timeout(function () {
createChart(type);
}, 50, false);
};
/**
* Allow to set global options during configuration
*/
this.setOptions = function(type, customOptions) {
// If no type was specified set option for the global object
if (!customOptions) {
customOptions = type;
options = angular.extend(options, customOptions);
return;
}
if (! scope.data || ! scope.data.length) return;
scope.getColour = typeof scope.getColour === 'function' ? scope.getColour : getRandomColour;
scope.colours = getColours(type, scope);
var cvs = elem[0], ctx = cvs.getContext('2d');
var data = Array.isArray(scope.data[0]) ?
getDataSets(scope.labels, scope.data, scope.series || [], scope.colours) :
getData(scope.labels, scope.data, scope.colours);
var options = angular.extend({}, ChartJs.getOptions(type), scope.options);
chart = new ChartJs.Chart(ctx)[type](data, options);
scope.$emit('create', chart);
// Bind events
cvs.onclick = scope.click ? getEventHandler(scope, chart, 'click', false) : angular.noop;
cvs.onmousemove = scope.hover ? getEventHandler(scope, chart, 'hover', true) : angular.noop;
// Set options for the specific chart
options[type] = angular.extend(options[type] || {}, customOptions);
};
if (scope.legend && scope.legend !== 'false') setLegend(elem, chart);
}
function deprecated (attr) {
if (typeof console !== 'undefined' && ChartJs.getOptions().env !== 'test') {
var warn = typeof console.warn === 'function' ? console.warn : console.log;
if (!! scope[attr]) {
warn.call(console, '"%s" is deprecated and will be removed in a future version. ' +
'Please use "chart-%s" instead.', attr, attr);
}
this.$get = function() {
return ChartJs;
};
}
function ChartJsFactory(ChartJs, $timeout) {
return function chart(type) {
return {
restrict: 'CA',
scope: {
data: '=?',
labels: '=?',
options: '=?',
series: '=?',
colours: '=?',
getColour: '=?',
chartType: '=',
legend: '@',
click: '=?',
hover: '=?',
chartData: '=?',
chartLabels: '=?',
chartOptions: '=?',
chartSeries: '=?',
chartColours: '=?',
chartLegend: '@',
chartClick: '=?',
chartHover: '=?'
},
link: function(scope, elem /*, attrs */ ) {
var chart, container = document.createElement('div');
container.className = 'chart-container';
elem.replaceWith(container);
container.appendChild(elem[0]);
if (usingExcanvas) window.G_vmlCanvasManager.initElement(elem[0]);
['data', 'labels', 'options', 'series', 'colours', 'legend', 'click', 'hover'].forEach(deprecated);
function aliasVar(fromName, toName) {
scope.$watch(fromName, function(newVal) {
if (typeof newVal === 'undefined') return;
scope[toName] = newVal;
});
}
/* provide backward compatibility to "old" directive names, by
* having an alias point from the new names to the old names. */
aliasVar('chartData', 'data');
aliasVar('chartLabels', 'labels');
aliasVar('chartOptions', 'options');
aliasVar('chartSeries', 'series');
aliasVar('chartColours', 'colours');
aliasVar('chartLegend', 'legend');
aliasVar('chartClick', 'click');
aliasVar('chartHover', 'hover');
// Order of setting "watch" matter
scope.$watch('data', function(newVal, oldVal) {
if (!newVal || !newVal.length || (Array.isArray(newVal[0]) && !newVal[0].length)) return;
var chartType = type || scope.chartType;
if (!chartType) return;
if (chart) {
if (canUpdateChart(newVal, oldVal)) return updateChart(chart, newVal, scope, elem);
chart.destroy();
}
createChart(chartType);
}, true);
scope.$watch('series', resetChart, true);
scope.$watch('labels', resetChart, true);
scope.$watch('options', resetChart, true);
scope.$watch('colours', resetChart, true);
scope.$watch('chartType', function(newVal, oldVal) {
if (isEmpty(newVal)) return;
if (angular.equals(newVal, oldVal)) return;
if (chart) chart.destroy();
createChart(newVal);
});
scope.$on('$destroy', function() {
if (chart) chart.destroy();
});
function resetChart(newVal, oldVal) {
if (isEmpty(newVal)) return;
if (angular.equals(newVal, oldVal)) return;
var chartType = type || scope.chartType;
if (!chartType) return;
// chart.update() doesn't work for series and labels
// so we have to re-create the chart entirely
if (chart) chart.destroy();
createChart(chartType);
}
function createChart(type) {
if (isResponsive(type, scope) && elem[0].clientHeight === 0 && container.clientHeight === 0) {
return $timeout(function() {
createChart(type);
}, 50, false);
}
if (!scope.data || !scope.data.length) return;
scope.getColour = typeof scope.getColour === 'function' ? scope.getColour : getRandomColour;
scope.colours = getColours(type, scope);
var cvs = elem[0],
ctx = cvs.getContext('2d');
var data = Array.isArray(scope.data[0]) ?
getDataSets(scope.labels, scope.data, scope.series || [], scope.colours) :
getData(scope.labels, scope.data, scope.colours);
var options = angular.extend({}, ChartJs.getOptions(type), scope.options);
chart = new ChartJs.Chart(ctx)[type](data, options);
scope.$emit('create', chart);
// Bind events
cvs.onclick = scope.click ? getEventHandler(scope, chart, 'click', false) : angular.noop;
cvs.onmousemove = scope.hover ? getEventHandler(scope, chart, 'hover', true) : angular.noop;
if (scope.legend && scope.legend !== 'false') setLegend(elem, chart);
}
function deprecated(attr) {
if (typeof console !== 'undefined' && ChartJs.getOptions().env !== 'test') {
var warn = typeof console.warn === 'function' ? console.warn : console.log;
if (!!scope[attr]) {
warn.call(console, '"%s" is deprecated and will be removed in a future version. ' +
'Please use "chart-%s" instead.', attr, attr);
}
}
}
}
};
};
function canUpdateChart(newVal, oldVal) {
if (newVal && oldVal && newVal.length && oldVal.length) {
return Array.isArray(newVal[0]) ?
newVal.length === oldVal.length && newVal.every(function(element, index) {
return element.length === oldVal[index].length;
}) :
oldVal.reduce(sum, 0) > 0 ? newVal.length === oldVal.length : false;
}
}
return false;
}
};
};
function canUpdateChart (newVal, oldVal) {
if (newVal && oldVal && newVal.length && oldVal.length) {
return Array.isArray(newVal[0]) ?
newVal.length === oldVal.length && newVal.every(function (element, index) {
return element.length === oldVal[index].length; }) :
oldVal.reduce(sum, 0) > 0 ? newVal.length === oldVal.length : false;
}
return false;
}
function sum (carry, val) {
return carry + val;
}
function sum(carry, val) {
return carry + val;
}
function getEventHandler (scope, chart, action, triggerOnlyOnChange) {
var lastState = null;
return function (evt) {
var atEvent = chart.getPointsAtEvent || chart.getBarsAtEvent || chart.getSegmentsAtEvent;
if (atEvent) {
var activePoints = atEvent.call(chart, evt);
if (triggerOnlyOnChange === false || angular.equals(lastState, activePoints) === false) {
lastState = activePoints;
scope[action](activePoints, evt);
scope.$apply();
}
function getEventHandler(scope, chart, action, triggerOnlyOnChange) {
var lastState = null;
return function(evt) {
var atEvent = chart.getPointsAtEvent || chart.getBarsAtEvent || chart.getSegmentsAtEvent;
if (atEvent) {
var activePoints = atEvent.call(chart, evt);
if (triggerOnlyOnChange === false || angular.equals(lastState, activePoints) === false) {
lastState = activePoints;
scope[action](activePoints, evt);
scope.$apply();
}
}
};
}
};
}
function getColours (type, scope) {
var colours = angular.copy(scope.colours ||
ChartJs.getOptions(type).colours ||
Chart.defaults.global.colours
);
while (colours.length < scope.data.length) {
colours.push(scope.getColour());
}
return colours.map(convertColour);
}
function getColours(type, scope) {
var colours = angular.copy(scope.colours ||
ChartJs.getOptions(type).colours ||
Chart.defaults.global.colours
);
while (colours.length < scope.data.length) {
colours.push(scope.getColour());
}
return colours.map(convertColour);
}
function convertColour (colour) {
if (typeof colour === 'object' && colour !== null) return colour;
if (typeof colour === 'string' && colour[0] === '#') return getColour(hexToRgb(colour.substr(1)));
return getRandomColour();
}
function convertColour(colour) {
if (typeof colour === 'object' && colour !== null) return colour;
if (typeof colour === 'string' && colour[0] === '#') return getColour(hexToRgb(colour.substr(1)));
return getRandomColour();
}
function getRandomColour () {
var colour = [getRandomInt(0, 255), getRandomInt(0, 255), getRandomInt(0, 255)];
return getColour(colour);
}
function getRandomColour() {
var colour = [getRandomInt(0, 255), getRandomInt(0, 255), getRandomInt(0, 255)];
return getColour(colour);
}
function getColour (colour) {
return {
fillColor: rgba(colour, 0.2),
strokeColor: rgba(colour, 1),
pointColor: rgba(colour, 1),
pointStrokeColor: '#fff',
pointHighlightFill: '#fff',
pointHighlightStroke: rgba(colour, 0.8)
};
}
function getColour(colour) {
return {
fillColor: rgba(colour, 0.2),
strokeColor: rgba(colour, 1),
pointColor: rgba(colour, 1),
pointStrokeColor: '#fff',
pointHighlightFill: '#fff',
pointHighlightStroke: rgba(colour, 0.8)
};
}
function getRandomInt (min, max) {
return Math.floor(Math.random() * (max - min + 1)) + min;
}
function getRandomInt(min, max) {
return Math.floor(Math.random() * (max - min + 1)) + min;
}
function rgba (colour, alpha) {
if (usingExcanvas) {
// rgba not supported by IE8
return 'rgb(' + colour.join(',') + ')';
} else {
return 'rgba(' + colour.concat(alpha).join(',') + ')';
}
}
function rgba(colour, alpha) {
if (usingExcanvas) {
// rgba not supported by IE8
return 'rgb(' + colour.join(',') + ')';
} else {
return 'rgba(' + colour.concat(alpha).join(',') + ')';
}
}
// Credit: http://stackoverflow.com/a/11508164/1190235
function hexToRgb (hex) {
var bigint = parseInt(hex, 16),
r = (bigint >> 16) & 255,
g = (bigint >> 8) & 255,
b = bigint & 255;
// Credit: http://stackoverflow.com/a/11508164/1190235
function hexToRgb(hex) {
var bigint = parseInt(hex, 16),
r = (bigint >> 16) & 255,
g = (bigint >> 8) & 255,
b = bigint & 255;
return [r, g, b];
}
return [r, g, b];
}
function getDataSets (labels, data, series, colours) {
return {
labels: labels,
datasets: data.map(function (item, i) {
return angular.extend({}, colours[i], {
label: series[i],
data: item
});
})
};
}
function getDataSets(labels, data, series, colours) {
return {
labels: labels,
datasets: data.map(function(item, i) {
return angular.extend({}, colours[i], {
label: series[i],
data: item
});
})
};
}
function getData (labels, data, colours) {
return labels.map(function (label, i) {
return angular.extend({}, colours[i], {
label: label,
value: data[i],
color: colours[i].strokeColor,
highlight: colours[i].pointHighlightStroke
});
});
}
function getData(labels, data, colours) {
return labels.map(function(label, i) {
return angular.extend({}, colours[i], {
label: label,
value: data[i],
color: colours[i].strokeColor,
highlight: colours[i].pointHighlightStroke
});
});
}
function setLegend (elem, chart) {
var $parent = elem.parent(),
$oldLegend = $parent.find('chart-legend'),
legend = '<chart-legend>' + chart.generateLegend() + '</chart-legend>';
if ($oldLegend.length) $oldLegend.replaceWith(legend);
else $parent.append(legend);
}
function setLegend(elem, chart) {
var $parent = elem.parent(),
$oldLegend = $parent.find('chart-legend'),
legend = '<chart-legend>' + chart.generateLegend() + '</chart-legend>';
if ($oldLegend.length) $oldLegend.replaceWith(legend);
else $parent.append(legend);
}
function updateChart (chart, values, scope, elem) {
if (Array.isArray(scope.data[0])) {
chart.datasets.forEach(function (dataset, i) {
(dataset.points || dataset.bars).forEach(function (dataItem, j) {
dataItem.value = values[i][j];
});
});
} else {
chart.segments.forEach(function (segment, i) {
segment.value = values[i];
});
}
chart.update();
scope.$emit('update', chart);
if (scope.legend && scope.legend !== 'false') setLegend(elem, chart);
}
function updateChart(chart, values, scope, elem) {
if (Array.isArray(scope.data[0])) {
chart.datasets.forEach(function(dataset, i) {
(dataset.points || dataset.bars).forEach(function(dataItem, j) {
dataItem.value = values[i][j];
});
});
} else {
chart.segments.forEach(function(segment, i) {
segment.value = values[i];
});
}
chart.update();
scope.$emit('update', chart);
if (scope.legend && scope.legend !== 'false') setLegend(elem, chart);
}
function isEmpty (value) {
return ! value ||
(Array.isArray(value) && ! value.length) ||
(typeof value === 'object' && ! Object.keys(value).length);
}
function isEmpty(value) {
return !value ||
(Array.isArray(value) && !value.length) ||
(typeof value === 'object' && !Object.keys(value).length);
}
function isResponsive (type, scope) {
var options = angular.extend({}, Chart.defaults.global, ChartJs.getOptions(type), scope.options);
return options.responsive;
function isResponsive(type, scope) {
var options = angular.extend({}, Chart.defaults.global, ChartJs.getOptions(type), scope.options);
return options.responsive;
}
}
}
}));
}));
\ No newline at end of file
/*
* L.TileLayer is used for standard xyz-numbered tile layers.
*/
L.Google = L.Class.extend({
includes: L.Mixin.Events,
options: {
minZoom: 0,
maxZoom: 18,
tileSize: 256,
subdomains: 'abc',
errorTileUrl: '',
attribution: '',
opacity: 1,
continuousWorld: false,
noWrap: false,
},
// Possible types: SATELLITE, ROADMAP, HYBRID
initialize: function(type, options) {
L.Util.setOptions(this, options);
this._type = google.maps.MapTypeId[type || 'SATELLITE'];
},
onAdd: function(map, insertAtTheBottom) {
this._map = map;
this._insertAtTheBottom = insertAtTheBottom;
// create a container div for tiles
this._initContainer();
this._initMapObject();
// set up events
map.on('viewreset', this._resetCallback, this);
this._limitedUpdate = L.Util.limitExecByInterval(this._update, 150, this);
map.on('move', this._update, this);
//map.on('moveend', this._update, this);
this._reset();
this._update();
},
onRemove: function(map) {
this._map._container.removeChild(this._container);
//this._container = null;
this._map.off('viewreset', this._resetCallback, this);
this._map.off('move', this._update, this);
//this._map.off('moveend', this._update, this);
},
getAttribution: function() {
return this.options.attribution;
},
setOpacity: function(opacity) {
this.options.opacity = opacity;
if (opacity < 1) {
L.DomUtil.setOpacity(this._container, opacity);
}
},
_initContainer: function() {
var tilePane = this._map._container
first = tilePane.firstChild;
if (!this._container) {
this._container = L.DomUtil.create('div', 'leaflet-google-layer leaflet-top leaflet-left');
this._container.id = "_GMapContainer";
}
if (true) {
tilePane.insertBefore(this._container, first);
this.setOpacity(this.options.opacity);
var size = this._map.getSize();
this._container.style.width = size.x + 'px';
this._container.style.height = size.y + 'px';
}
},
_initMapObject: function() {
this._google_center = new google.maps.LatLng(0, 0);
var map = new google.maps.Map(this._container, {
center: this._google_center,
zoom: 0,
mapTypeId: this._type,
disableDefaultUI: true,
keyboardShortcuts: false,
draggable: false,
disableDoubleClickZoom: true,
scrollwheel: false,
streetViewControl: false
});
var _this = this;
this._reposition = google.maps.event.addListenerOnce(map, "center_changed",
function() { _this.onReposition(); });
map.backgroundColor = '#ff0000';
this._google = map;
},
_resetCallback: function(e) {
this._reset(e.hard);
},
_reset: function(clearOldContainer) {
this._initContainer();
},
_update: function() {
this._resize();
var bounds = this._map.getBounds();
var ne = bounds.getNorthEast();
var sw = bounds.getSouthWest();
var google_bounds = new google.maps.LatLngBounds(
new google.maps.LatLng(sw.lat, sw.lng),
new google.maps.LatLng(ne.lat, ne.lng)
);
var center = this._map.getCenter();
var _center = new google.maps.LatLng(center.lat, center.lng);
this._google.setCenter(_center);
this._google.setZoom(this._map.getZoom());
//this._google.fitBounds(google_bounds);
},
_resize: function() {
var size = this._map.getSize();
if (this._container.style.width == size.x &&
this._container.style.height == size.y)
return;
this._container.style.width = size.x + 'px';
this._container.style.height = size.y + 'px';
google.maps.event.trigger(this._google, "resize");
},
onReposition: function() {
//google.maps.event.trigger(this._google, "resize");
}
});
\ No newline at end of file
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