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
<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
This diff is collapsed.
<!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
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
/*
* 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>
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
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';
......
This diff is collapsed.
This diff is collapsed.
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