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-view view-title="BLAZE" ng-init="initializedLocateUser();loadWeeklySurvey();getAllBarangay();">
<ion-nav-buttons side="left"> <ion-nav-buttons side="left">
<button ng-click="openMenu()" class="button button-icon ion-android-menu" ng-disabled="tripStatus"></button> <button ng-click="openMenu()" class="button button-icon ion-android-menu" ng-disabled="tripStatus"></button>
</ion-nav-buttons> </ion-nav-buttons>
<ion-nav-buttons side="right"> <ion-nav-buttons side="right">
<button ng-click="openPopover($event);" class="button button-icon ion-android-apps" ng-disabled="tripStatus"></button> <button ng-click="openPopover($event);" class="button button-icon ion-android-apps" ng-disabled="tripStatus"></button>
</ion-nav-buttons> </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 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>
<div class="bar bar-subheader bar-clear darkblue item-input-inset"> <div class="bar bar-subheader bar-clear darkblue item-input-inset">
<a class="item-input-wrapper" ng-click="onLoadSelection();"> <a class="item-input-wrapper" ng-click="onLoadSelection();">
<i class="icon ion-ios-search placeholder-icon"></i> <i class="icon ion-ios-search placeholder-icon"></i>
<input type="text" placeholder="Search Barangay" ng-model="selectedBarangayData" disabled> <input type="text" placeholder="Search Barangay" ng-model="selectedBarangayData" disabled>
</a> </a>
<button class="button button-stable" style="color: #000000;" ng-click="loadBarangayData();" ng-disabled="!selectedBarangayData"> <button class="button button-stable" style="color: #000000;" ng-click="loadBarangayData();" ng-disabled="!selectedBarangayData">
Show Show
</button> </button>
</div> </div>
<ion-content class="has-subheader" data-tap-disabled="true"> <ion-content class="has-subheader" data-tap-disabled="true">
<div id="mapid"></div> <div id="mapid"></div>
</ion-content> </ion-content>
<ion-footer-bar align-title="center" class="bar bar-clear darkblue"> <ion-footer-bar align-title="center" class="bar bar-clear darkblue">
<div class="button-bar"> <div class="button-bar">
<div class="button-bar" ng-if="!tripStatus"> <div class="button-bar" ng-if="!tripStatus">
<button ng-click="confirmTripDestination();" class="button button-icon ion-android-arrow-dropright-circle light"> Start Trip</button> <button ng-click="confirmTripDestination();" class="button button-icon ion-android-arrow-dropright-circle light"> Start Trip</button>
</div> </div>
<div class="button-bar" ng-if="tripStatus"> <div class="button-bar" ng-if="tripStatus">
<button ng-click="tripEnd();" class="button button-icon ion-android-cancel stable"> Stop Trip</button> <button ng-click="tripEnd();" class="button button-icon ion-android-cancel stable"> Stop Trip</button>
</div> </div>
</div> </div>
</ion-footer-bar> </ion-footer-bar>
</ion-view> </ion-view>
\ No newline at end of file
<ion-popover-view class="fit"> <ion-popover-view class="fit">
<ion-content scroll="false"> <ion-content scroll="false">
<div class="list"> <div class="list">
<a ng-click="getBlazersData();closePopover($event);" class="item item-icon-left"> <a ng-click="getBlazersDataV2();closePopover($event);" class="item item-icon-left">
<i class="icon ion-android-pin"></i> <i class="icon ion-android-pin"></i> Show Blazers
Show Blazers </a>
</a> <a ng-click="triggerWeeklySurvey();closePopover($event);" class="item item-icon-left">
<!--<a ng-click="loadHeatMap();" class="item item-icon-left"> <i class="icon ion-android-clipboard"></i> Weekly Survey
<i class="icon ion-android-pin"></i> </a>
Load Heatmap </div>
</a>--> </ion-content>
<a ng-click="triggerWeeklySurvey();closePopover($event);" class="item item-icon-left"> </ion-popover-view>
<i class="icon ion-android-clipboard"></i> \ No newline at end of file
Weekly Survey
</a>
</div>
</ion-content>
</ion-popover-view>
<ion-side-menus enable-menu-with-back-views="false"> <ion-side-menus enable-menu-with-back-views="false">
<ion-side-menu-content> <ion-side-menu-content>
<ion-nav-bar class="bar bar-clear darkblue"> <ion-nav-bar class="bar bar-clear darkblue">
<ion-nav-back-button> <ion-nav-back-button>
</ion-nav-back-button> </ion-nav-back-button>
<ion-nav-buttons side="left"> <ion-nav-buttons side="left">
<button class="button button-clear button-icon button-clear ion-android-menu" menu-toggle="left"></button> <button class="button button-clear button-icon button-clear ion-android-menu" menu-toggle="left"></button>
</ion-nav-buttons> </ion-nav-buttons>
</ion-nav-bar> </ion-nav-bar>
<ion-nav-view name="menuContent"></ion-nav-view> <ion-nav-view name="menuContent"></ion-nav-view>
</ion-side-menu-content> </ion-side-menu-content>
<ion-side-menu side="left" width="220"> <ion-side-menu side="left" width="220">
<ion-content class="darkSide"> <ion-content class="darkSide">
<h3 class="text-light"><center>BLAZE</center></h3> <h3 class="text-light">
<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> <center>BLAZE</center>
<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> </h3>
<!-- <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/profile" class="item-avatar">
<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> <ionic-letter-avatar data="{{ user.username }}" shape="round" charcount="2"></ionic-letter-avatar>
<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> <h4 class="text-light">{{ user.username }}</h4>
<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> <h5 class="text-light">Blazer User</h5>
<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-item>
</ion-content> <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-side-menu> <!-- <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-side-menus> <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-view view-title="Offer a Ride" ng-init="getUserLocation();">
<ion-nav-buttons side="right"> <ion-nav-buttons side="right">
<!--<button class="button button-clear button-light" ng-click="resetOfferRide();" ng-disabled="setPosition == true">Referesh</button>--> <!--<button class="button button-clear button-light" ng-click="resetOfferRide();" ng-disabled="setPosition == true">Referesh</button>-->
</ion-nav-buttons> </ion-nav-buttons>
<ion-content data-tap-disabled="false"> <ion-content data-tap-disabled="false">
<form name="offerride"> <form name="offerride">
<div class="item item-divider"> Offer Ride </div> <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> <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> <div class="item item-divider item-light"> Destination </div>
<!--<label class="item item-input"> <!--<label class="item item-input">
<input type="text" placeholder="Destination Address" location-suggestion location="location" ng-model="location.formatted_address"> <input type="text" placeholder="Destination Address" location-suggestion location="location" ng-model="location.formatted_address">
</label>--> </label>-->
<div id="mapdestination"></div> <div id="mapdestination"></div>
<p class="text-dark note-style"><b>Note: </b> Drag the marker to a specific Pick-up Location.</p> <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 class="item item-divider item-light"> Pick-up Location (specify) </div>
<div id="mappickup"></div> <div id="mappickup"></div>
<div class="item item-stacked-label" ion-datetime-picker am-pm ng-model="offer.assembly" required> <div class="item item-stacked-label" ion-datetime-picker am-pm ng-model="offer.assembly" required>
<span class="input-label">Date and Time</span> <span class="input-label">Date and Time</span>
<p>{{offer.assembly| date: "MMMM dd, yyyy 'at' H:mm:ss a"}}</p> <p>{{offer.assembly| date: "MMMM dd, yyyy 'at' H:mm:ss a"}}</p>
</div> </div>
<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"> Car Brand</span> <span class="input-label"> Car Brand</span>
</label> </label>
<label class="item item-input item-select border-top"> <label class="item item-input item-select border-top">
<div class="input-label"> <div class="input-label">
&nbsp; &nbsp;
</div> </div>
...@@ -70,14 +70,14 @@ ...@@ -70,14 +70,14 @@
<option value="Volvo">Volvo</option> <option value="Volvo">Volvo</option>
</select> </select>
</label> </label>
<label class="item item-input item-stacked-label"> <label class="item item-input item-stacked-label">
<span class="input-label">Plate Number</span> <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/> <input type="text" ng-model="offer.platenumber" placeholder="ABC123 or ABCD123" max-length="8" ng-maxlength="7" required/>
</label> </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> <span class="input-label"> Capacity</span>
</label> </label>
<label class="item item-input item-select border-top"> <label class="item item-input item-select border-top">
<div class="input-label"> <div class="input-label">
&nbsp; &nbsp;
</div> </div>
...@@ -98,19 +98,19 @@ ...@@ -98,19 +98,19 @@
<option value="15">15 Seater</option> <option value="15">15 Seater</option>
</select> </select>
</label> </label>
<label class="item item-input item-stacked-label"> <label class="item item-input item-stacked-label">
<span class="input-label">Mobile Number</span> <span class="input-label">Mobile Number</span>
<input type="number" ng-model="offer.mobile" placeholder="(09)** *** ****" maxlength="11" ng-maxlength="11" required/> <input type="number" ng-model="offer.mobile" placeholder="(09)** *** ****" maxlength="11" ng-maxlength="11" required/>
</label> </label>
<label class="item item-input item-stacked-label"> <label class="item item-input item-stacked-label">
<span class="input-label"> Other Details</span> <span class="input-label"> Other Details</span>
<textarea type="text" placeholder="Fuel contribution" ng-model="offer.notes" style="height: 100px;"></textarea> <textarea type="text" placeholder="Fuel contribution" ng-model="offer.notes" style="height: 100px;"></textarea>
</label> </label>
<div class="padding"> <div class="padding">
<button class="button button-block button-dark button-outline" ng-disabled="offerride.$invalid" ng-click="offerRide(location);"> <button class="button button-block button-dark button-outline" ng-disabled="offerride.$invalid" ng-click="offerRide(location);">
Offer Ride Offer Ride
</button> </button>
</div> </div>
</form> </form>
</ion-content> </ion-content>
</ion-view> </ion-view>
\ No newline at end of file
<ion-view view-title="My Travel Stats" ng-init="getTravelStats();"> <ion-view view-title="My Travel Stats" ng-init="getTravelStats();">
<ion-nav-buttons side="right"> <ion-nav-buttons side="right">
</ion-nav-buttons> </ion-nav-buttons>
<ion-content> <ion-content>
<ion-refresher pulling-text="Pull to refresh" on-refresh="getTravelStats();"></ion-refresher> <ion-refresher pulling-text="Pull to refresh" on-refresh="getTravelStats();"></ion-refresher>
<div class="list"> <div class="list card">
<div class="item item-divider"> Mode of Use </div> <div class="item item-divider"> Mode of Use </div>
<div class="item"> <div class="item">
<i class="button button-block button-clear bgbluegreen text-light">Latest</i> <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-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-bulb"><b>{{ blazersStats.emo_latest }}</b></i>
<!--<i class="button button-block icon-left ion-android-time"><b>{{blazersStats.time_latest}}</b></i>--> <!--<i class="button button-block icon-left ion-android-time"><b>{{blazersStats.time_latest}}</b></i>-->
</div> </div>
<div class="item"> <div class="item">
<i class="button button-block button-clear bgbluegreen text-light">Frequently Used</i> <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-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-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> <div class="item">
<div class="item"> <i class="button button-block button-clear bgbluegreen text-light">Low-Carbon</i>
<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-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-bulb"><b>{{ blazersStats.emo_frequent_positive }}</b></i> </div>
<!--<i class="button button-block icon-left ion-android-time"><b>{{blazersStats.time_best}}</b></i>--> </div>
</div> <div class="list card">
<!--<div class="item item-thumbnail-left item-borderless"> <div class="item item-divider"> Time </div>
<img ng-src="img/info.png"> <div class="item">
<i> Latest </i> <i class="button button-block button-clear bgbluegreen text-light">Latest</i>
<p>Transportation: <i ng-if="!blazersStats.mode_latest">NULL</i>{{ blazersStats.mode_latest }}</p> <i class="button button-block icon-left ion-android-time"><b>{{ blazersStats.time_latest }}</b></i>
<p>Mood: <i ng-if="!blazersStats.emo_latest">NULL</i>{{ blazersStats.emo_latest }}</p> </div>
</div> <div class="item">
<div class="item item-thumbnail-left item-borderless"> <i class="button button-block button-clear bgbluegreen text-light">Average</i>
<img ng-src="img/info.png"> <i class="button button-block icon-left ion-android-time"><b>{{ blazersStats.time_average }}</b></i>
<i>Frequently Used</i> </div>
<p>Transportation: <i ng-if="!blazersStats.mode_frequent">NULL</i>{{ blazersStats.mode_frequent }}</p> <div class="item">
<p>Mood: <i ng-if="!blazersStats.emo_frequent">NULL</i>{{ blazersStats.emo_frequent }}</p> <i class="button button-block button-clear bgbluegreen text-light">Best</i>
</div> <i class="button button-block icon-left ion-android-time"><b>{{ blazersStats.time_best }}</b></i>
<div class="item item-thumbnail-left item-borderless"> </div>
<img ng-src="img/info.png"> </div>
<i>Low-Carbon</i> </ion-content>
<p>Transportation: <i ng-if="!blazersStats.mode_best">NULL</i>{{ blazersStats.mode_best }}</p> </ion-view>
<p>Mood: <i ng-if="!blazersStats.emo_frequent_positive">NULL</i>{{ blazersStats.emo_frequent_positive }}</p> \ No newline at end of file
</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>
This diff is collapsed.
<!DOCTYPE html> <!DOCTYPE html>
<html> <html>
<head>
<head>
<meta charset="utf-8"> <meta charset="utf-8">
<meta name="viewport" content="initial-scale=1, maximum-scale=1, user-scalable=no, width=device-width"> <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" />--> <!--<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no" />-->
...@@ -11,7 +12,7 @@ ...@@ -11,7 +12,7 @@
<link href="css/style.css" rel="stylesheet"> <link href="css/style.css" rel="stylesheet">
<link rel="stylesheet" href="css/leaflet.css"> <link rel="stylesheet" href="css/leaflet.css">
<link rel="stylesheet" href="css/leaflet-routing-machine.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/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/leaflet-markercluster/dist/MarkerCluster.css" rel="stylesheet" type="text/css"/>-->
<link href="lib/ion-datetime-picker/release/ion-datetime-picker.min.css" rel="stylesheet"> <link href="lib/ion-datetime-picker/release/ion-datetime-picker.min.css" rel="stylesheet">
...@@ -27,8 +28,9 @@ ...@@ -27,8 +28,9 @@
<!-- cordova script (this will be a 404 during development) --> <!-- cordova script (this will be a 404 during development) -->
<script src="lib/ngCordova/ng-cordova.min.js"></script> <script src="lib/ngCordova/ng-cordova.min.js"></script>
<script src="cordova.js"></script> <script src="cordova.js"></script>
<script type="text/javascript" src="https://maps.googleapis.com/maps/api/js?libraries=places&sensor=false"></script> <script 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> <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script>
<!-- your app's js --> <!-- your app's js -->
...@@ -45,6 +47,7 @@ ...@@ -45,6 +47,7 @@
<script src="app/misc/js/misc.js"></script> <script src="app/misc/js/misc.js"></script>
<script src="app/ride/js/ride.js"></script> <script src="app/ride/js/ride.js"></script>
<script src="app/message/js/message.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/config.js"></script>
<script src="js/blazerAPI.js"></script> <script src="js/blazerAPI.js"></script>
...@@ -53,12 +56,15 @@ ...@@ -53,12 +56,15 @@
<script src="lib/ion-floating-menu/dist/ion-floating-menu.js" type="text/javascript"></script> <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/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="lib/ion-datetime-picker/release/ion-datetime-picker.min.js"></script>
<script src="js/directives/radioButtons.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> <ion-nav-view></ion-nav-view>
</body> </body>
</html>
</html>
\ No newline at end of file
angular.module('blazer', [ angular.module('blazer', [
'ionic', 'ionic',
'blazer.landingcontrollers', 'blazer.landingcontrollers',
'blazer.menucontrollers', 'blazer.menucontrollers',
'blazer.authenticationcontrollers', 'blazer.authenticationcontrollers',
'blazer.mapcontrollers', 'blazer.mapcontrollers',
'blazer.offerridecontrollers', 'blazer.offerridecontrollers',
'blazer.sharedridecontrollers', 'blazer.sharedridecontrollers',
'blazer.statuscontrollers', 'blazer.statuscontrollers',
'blazer.tripcontrollers', 'blazer.tripcontrollers',
'blazer.misccontrollers', 'blazer.misccontrollers',
'blazer.surveycontrollers', 'blazer.surveycontrollers',
'blazer.apiservices', 'blazer.diarycontrollers',
'blazer.rideinformation', 'blazer.apiservices',
'blazer.composemessage', 'blazer.rideinformation',
'ionic-letter-avatar', 'blazer.composemessage',
'ngCordova', 'ionic-letter-avatar',
'radioButtons', 'ngCordova',
'ion-floating-menu', 'radioButtons',
'ion-datetime-picker', 'ion-floating-menu',
'chart.js' 'ion-datetime-picker',
'chart.js'
]) ])
.run(function($ionicPlatform, $ionicPickerI18n) { .run(function($ionicPlatform, $ionicPickerI18n) {
$ionicPlatform.ready(function() { $ionicPlatform.ready(function() {
if (window.cordova && window.cordova.plugins.Keyboard) { if (window.cordova && window.cordova.plugins.Keyboard) {
cordova.plugins.Keyboard.hideKeyboardAccessoryBar(true); cordova.plugins.Keyboard.hideKeyboardAccessoryBar(true);
cordova.plugins.Keyboard.disableScroll(true); cordova.plugins.Keyboard.disableScroll(true);
} }
if (window.StatusBar) { if (window.StatusBar) {
// org.apache.cordova.statusbar required // org.apache.cordova.statusbar required
StatusBar.styleDefault(); StatusBar.styleDefault();
} }
$ionicPickerI18n.ok = "Set"; $ionicPickerI18n.ok = "Set";
$ionicPickerI18n.okClass = "button-dark button-outline"; $ionicPickerI18n.okClass = "button-dark button-outline";
$ionicPickerI18n.cancelClass = "button-dark button-outline"; $ionicPickerI18n.cancelClass = "button-dark button-outline";
}); });
$ionicPlatform.registerBackButtonAction(function (event) { $ionicPlatform.registerBackButtonAction(function(event) {
event.preventDefault(); event.preventDefault();
}, 100); }, 100);
}) })
.config(function($stateProvider, $urlRouterProvider, $ionicConfigProvider) { .config(function($stateProvider, $urlRouterProvider, $ionicConfigProvider) {
$ionicConfigProvider.tabs.position('bottom'); // other values: top $ionicConfigProvider.tabs.position('bottom'); // other values: top
$ionicConfigProvider.tabs.style('standard'); $ionicConfigProvider.tabs.style('standard');
$ionicConfigProvider.spinner.icon('lines'); $ionicConfigProvider.spinner.icon('lines');
$stateProvider $stateProvider
/* LANDING */ /* LANDING */
.state('landing', { .state('landing', {
url: '/landing', url: '/landing',
templateUrl: 'app/landing/landing.html', templateUrl: 'app/landing/landing.html',
controller: 'LandingCtrl' controller: 'LandingCtrl'
}) })
/* MENU */ /* MENU */
.state('app', { .state('app', {
url: '/app', url: '/app',
abstract: true, abstract: true,
templateUrl: 'app/menu/menu.html', templateUrl: 'app/menu/menu.html',
controller: 'MenuCtrl' controller: 'MenuCtrl'
}) })
/* LOGIN */ /* LOGIN */
.state('login', { .state('login', {
url: '/login', url: '/login',
templateUrl: 'app/auth/login.html', templateUrl: 'app/auth/login.html',
controller: 'AuthCtrl' controller: 'AuthCtrl'
}) })
/* HOME */ /* HOME */
.state('app.map', { .state('app.map', {
url: '/map', url: '/map',
views: { views: {
'menuContent': { 'menuContent': {
templateUrl: 'app/map/map.html', templateUrl: 'app/map/map.html',
controller: 'MapCtrl' controller: 'MapCtrl'
} }
} }
}) })
/* TRIP */ /* TRIP */
.state('app.trip', { .state('app.trip', {
url: '/trip', url: '/trip',
views: { views: {
'menuContent': { 'menuContent': {
templateUrl: 'app/trip/trip.html', templateUrl: 'app/trip/trip.html',
controller: 'TripCtrl' controller: 'TripCtrl'
} }
} }
}) })
/* SHAREDRIDE */ /* SHAREDRIDE */
.state('app.offerride', { .state('app.offerride', {
url: '/offerride', url: '/offerride',
views: { views: {
'menuContent': { 'menuContent': {
templateUrl: 'app/offerride/offerride.html', templateUrl: 'app/offerride/offerride.html',
controller: 'OfferRideCtrl' controller: 'OfferRideCtrl'
} }
} }
}) })
/* SHAREDRIDE */ /* SHAREDRIDE */
.state('app.sharedride', { .state('app.sharedride', {
url: '/sharedride', url: '/sharedride',
views: { views: {
'menuContent': { 'menuContent': {
templateUrl: 'app/sharedride/sharedride.html', templateUrl: 'app/sharedride/sharedride.html',
controller: 'SharedRideCtrl' controller: 'SharedRideCtrl'
} }
} }
}) })
/* STATUS */ /* STATUS */
.state('app.status', { .state('app.status', {
url: '/status', url: '/status',
views: { views: {
'menuContent': { 'menuContent': {
templateUrl: 'app/status/status.html', templateUrl: 'app/status/status.html',
controller: 'StatusCtrl' controller: 'StatusCtrl'
} }
} }
}) })
/* PROFILE */ /* PROFILE */
.state('app.profile', { .state('app.profile', {
url: '/profile', url: '/profile',
views: { views: {
'menuContent': { 'menuContent': {
templateUrl: 'app/misc/profile.html', templateUrl: 'app/misc/profile.html',
controller: 'MiscCtrl' controller: 'MiscCtrl'
} }
} }
}) })
/* ABOUT */ /* ABOUT */
.state('app.about', { .state('app.about', {
url: '/about', url: '/about',
views: { views: {
'menuContent': { 'menuContent': {
templateUrl: 'app/misc/about.html', templateUrl: 'app/misc/about.html',
controller: 'MiscCtrl' controller: 'MiscCtrl'
} }
} }
}) })
/* SETTINGS */ /* SETTINGS */
.state('app.settings', { .state('app.settings', {
url: '/settings', url: '/settings',
views: { views: {
'menuContent': { 'menuContent': {
templateUrl: 'app/misc/settings.html', templateUrl: 'app/misc/settings.html',
controller: 'MiscCtrl' controller: 'MiscCtrl'
} }
} }
}) })
/* RIDE INFORMATION */ /* RIDE INFORMATION */
.state('app.ride', { .state('app.ride', {
url: '/ride/:id', url: '/ride/:id',
views: { views: {
'menuContent': { 'menuContent': {
templateUrl: 'app/ride/ride.html', templateUrl: 'app/ride/ride.html',
controller: 'RideInfoCtrl' controller: 'RideInfoCtrl'
} }
} }
}) })
/* COMPOSE MESSAGE */ /* COMPOSE MESSAGE */
.state('app.message', { .state('app.message', {
url: '/message', url: '/message',
views: { views: {
'menuContent': { 'menuContent': {
templateUrl: 'app/message/message.html', templateUrl: 'app/message/message.html',
controller: 'MsgCtrl' controller: 'MsgCtrl'
} }
} }
}) })
$urlRouterProvider.otherwise('/landing');
/* 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 blazerAPI = 'http://blaze.eacomm.com/api';
var appVersion = '1.0.0'; var blazerAPI_V2 = 'http://blaze.eacomm.com/api_v2';
var buildNumber = '1.0.0'; var appVersion = '2.0.0';
var buildNumber = '0.0.1';
var maplayer = 'http://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png'; 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' // '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', []) ...@@ -12,9 +12,14 @@ angular.module('blazer.mapcontrollers', [])
} }
/* MAP DEFAULTS */ /* 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'); var map = L.map('mapid');
map.setView(new L.LatLng(14.5818, 120.9771), 12); map.setView(new L.LatLng(14.5818, 120.9771), 12);
//MAP BOX //LEAFLET
L.tileLayer(maplayer, { L.tileLayer(maplayer, {
maxZoom: 18, maxZoom: 18,
...@@ -388,6 +393,16 @@ angular.module('blazer.mapcontrollers', []) ...@@ -388,6 +393,16 @@ angular.module('blazer.mapcontrollers', [])
console.debug("********** Load Heat Map **********"); 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 */ /* Show Blazers Data */
$scope.blazersData = {}; $scope.blazersData = {};
$scope.getBlazersData = function() { $scope.getBlazersData = function() {
...@@ -402,54 +417,86 @@ angular.module('blazer.mapcontrollers', []) ...@@ -402,54 +417,86 @@ angular.module('blazer.mapcontrollers', [])
var parsedData = []; var parsedData = [];
var geojsonLayer = []; var geojsonLayer = [];
$scope.plotBlazers = function() { $scope.plotBlazers = function() {
console.debug("********** Plot Blazers on Map **********"); console.debug("********** Plot Blazers on Map **********");
parsedData = []; parsedData = [];
angular.forEach($scope.blazersData, function(value, key) { angular.forEach($scope.blazersData, function(value, key) {
console.log("[ VALUE SCOPE ]", JSON.stringify(value)); console.log("[ VALUE SCOPE ]", JSON.stringify(value));
var formatData = { var formatData = {
"type": "Feature", "type": "Feature",
"properties": { "properties": {
"username": "Anonymous Blazer", "barangay_name": value.barangay_name,
"blazer_count": value.blazer_count,
"car_percentage": value.car_percentage,
}, },
"geometry": { "geometry": {
"type": "Point", "type": "Point",
"coordinates": [value.longitude, value.latitude] "coordinates": [value.lon, value.lat]
} }
} }
parsedData.push(formatData); 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 // PLOT DATA
function onEachFeature(feature, layer) { function onEachFeature(feature, layer) {
if (feature.properties && feature.properties.username) { if (feature.properties && feature.properties.barangay_name) {
layer.bindPopup('<div class="pop-up-containter">Blazer</h4><div style="font-size: 15px">' + feature.properties.username + '</div></div>'); 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, { geojsonLayer = L.geoJson(parsedData, {
onEachFeature: onEachFeature, onEachFeature: onEachFeature,
pointToLayer: function(feature, latlng) { 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); }).addTo(map);
map.fitBounds(geojsonLayer.getBounds()); map.fitBounds(geojsonLayer.getBounds());
...@@ -463,7 +510,7 @@ angular.module('blazer.mapcontrollers', []) ...@@ -463,7 +510,7 @@ angular.module('blazer.mapcontrollers', [])
var dayToday = $filter('date')(newDate, 'EEEE'); var dayToday = $filter('date')(newDate, 'EEEE');
console.log("[ Date Today ]", currentDate); console.log("[ Date Today ]", currentDate);
if (dayToday == 'Friday' || dayToday == 'Saturday') { if (dayToday == 'Friday' || dayToday == 'Saturday' || dayToday == 'Sunday') {
if (localStorage.getItem(currentDate) === null) { if (localStorage.getItem(currentDate) === null) {
var tripPopup = $ionicPopup.show({ var tripPopup = $ionicPopup.show({
title: 'Hey it\'s ' + dayToday + '!', title: 'Hey it\'s ' + dayToday + '!',
...@@ -497,30 +544,35 @@ angular.module('blazer.mapcontrollers', []) ...@@ -497,30 +544,35 @@ angular.module('blazer.mapcontrollers', [])
var dayToday = $filter('date')(newDate, 'EEEE'); var dayToday = $filter('date')(newDate, 'EEEE');
console.log("[ Date Today ]", currentDate); console.log("[ Date Today ]", currentDate);
if (localStorage.getItem(currentDate) === null) { if (dayToday == 'Friday' || dayToday == 'Saturday' || dayToday == 'Sunday') {
var tripPopup = $ionicPopup.show({ if (localStorage.getItem(currentDate) === null) {
title: 'Hey it\'s ' + dayToday + '!', var tripPopup = $ionicPopup.show({
subTitle: 'Take the weekly survey. You are awesome!', title: 'Hey it\'s ' + dayToday + '!',
scope: $scope, subTitle: 'Take the weekly survey. You are awesome!',
buttons: [{ scope: $scope,
text: 'Let\s go!', buttons: [{
type: 'button-dark button-outline', text: 'Let\s go!',
onTap: function(e) { type: 'button-dark button-outline',
console.log("[ TAKE WEEKLY SURVEY ]"); onTap: function(e) {
$scope.openWeeklySurvey(); console.log("[ TAKE WEEKLY SURVEY ]");
} $scope.openWeeklySurvey();
}, }
{ },
text: 'Later', {
type: 'button-dark button-outline', text: 'Later',
onTap: function(e) { type: 'button-dark button-outline',
console.log("[ NO WEEKLY SURVEY ]") 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 { } 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', []) ...@@ -551,7 +603,7 @@ angular.module('blazer.mapcontrollers', [])
$scope.modalEndTrip.show(); $scope.modalEndTrip.show();
}; };
// Weekly Survey Modal // Weekly Survey Modal
$ionicModal.fromTemplateUrl('app/survey/weekly.html', { $ionicModal.fromTemplateUrl('app/survey/weekly_v2.html', {
scope: $scope, scope: $scope,
animation: 'slide-in-up' animation: 'slide-in-up'
}).then(function(modal) { }).then(function(modal) {
......
<ion-view view-title="BLAZE" ng-init="initializedLocateUser();loadWeeklySurvey();getAllBarangay();"> <ion-view view-title="BLAZE" ng-init="initializedLocateUser();loadWeeklySurvey();getAllBarangay();">
<ion-nav-buttons side="left"> <ion-nav-buttons side="left">
<button ng-click="openMenu()" class="button button-icon ion-android-menu" ng-disabled="tripStatus"></button> <button ng-click="openMenu()" class="button button-icon ion-android-menu" ng-disabled="tripStatus"></button>
</ion-nav-buttons> </ion-nav-buttons>
<ion-nav-buttons side="right"> <ion-nav-buttons side="right">
<button ng-click="openPopover($event);" class="button button-icon ion-android-apps" ng-disabled="tripStatus"></button> <button ng-click="openPopover($event);" class="button button-icon ion-android-apps" ng-disabled="tripStatus"></button>
</ion-nav-buttons> </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 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>
<div class="bar bar-subheader bar-clear darkblue item-input-inset"> <div class="bar bar-subheader bar-clear darkblue item-input-inset">
<a class="item-input-wrapper" ng-click="onLoadSelection();"> <a class="item-input-wrapper" ng-click="onLoadSelection();">
<i class="icon ion-ios-search placeholder-icon"></i> <i class="icon ion-ios-search placeholder-icon"></i>
<input type="text" placeholder="Search Barangay" ng-model="selectedBarangayData" disabled> <input type="text" placeholder="Search Barangay" ng-model="selectedBarangayData" disabled>
</a> </a>
<button class="button button-stable" style="color: #000000;" ng-click="loadBarangayData();" ng-disabled="!selectedBarangayData"> <button class="button button-stable" style="color: #000000;" ng-click="loadBarangayData();" ng-disabled="!selectedBarangayData">
Show Show
</button> </button>
</div> </div>
<ion-content class="has-subheader" data-tap-disabled="true"> <ion-content class="has-subheader" data-tap-disabled="true">
<div id="mapid"></div> <div id="mapid"></div>
</ion-content> </ion-content>
<ion-footer-bar align-title="center" class="bar bar-clear darkblue"> <ion-footer-bar align-title="center" class="bar bar-clear darkblue">
<div class="button-bar"> <div class="button-bar">
<div class="button-bar" ng-if="!tripStatus"> <div class="button-bar" ng-if="!tripStatus">
<button ng-click="confirmTripDestination();" class="button button-icon ion-android-arrow-dropright-circle light"> Start Trip</button> <button ng-click="confirmTripDestination();" class="button button-icon ion-android-arrow-dropright-circle light"> Start Trip</button>
</div> </div>
<div class="button-bar" ng-if="tripStatus"> <div class="button-bar" ng-if="tripStatus">
<button ng-click="tripEnd();" class="button button-icon ion-android-cancel stable"> Stop Trip</button> <button ng-click="tripEnd();" class="button button-icon ion-android-cancel stable"> Stop Trip</button>
</div> </div>
</div> </div>
</ion-footer-bar> </ion-footer-bar>
</ion-view> </ion-view>
\ No newline at end of file
<ion-popover-view class="fit"> <ion-popover-view class="fit">
<ion-content scroll="false"> <ion-content scroll="false">
<div class="list"> <div class="list">
<a ng-click="getBlazersData();closePopover($event);" class="item item-icon-left"> <a ng-click="getBlazersDataV2();closePopover($event);" class="item item-icon-left">
<i class="icon ion-android-pin"></i> <i class="icon ion-android-pin"></i> Show Blazers
Show Blazers </a>
</a> <a ng-click="triggerWeeklySurvey();closePopover($event);" class="item item-icon-left">
<!--<a ng-click="loadHeatMap();" class="item item-icon-left"> <i class="icon ion-android-clipboard"></i> Weekly Survey
<i class="icon ion-android-pin"></i> </a>
Load Heatmap </div>
</a>--> </ion-content>
<a ng-click="triggerWeeklySurvey();closePopover($event);" class="item item-icon-left"> </ion-popover-view>
<i class="icon ion-android-clipboard"></i> \ No newline at end of file
Weekly Survey
</a>
</div>
</ion-content>
</ion-popover-view>
...@@ -23,8 +23,8 @@ ...@@ -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/offerride" class="item-icon item-icon-left"><i class="icon ion-android-car"></i>Offer a Ride</ion-item> -->
<ion-item nav-clear menu-close href="#/app/sharedride" class="item-icon item-icon-left"><i class="icon ion-android-contacts"></i>Shared Ride</ion-item> <ion-item nav-clear menu-close href="#/app/sharedride" class="item-icon item-icon-left"><i class="icon ion-android-contacts"></i>Shared Ride</ion-item>
<ion-item nav-clear menu-close href="#/app/status" class="item-icon item-icon-left"><i class="icon ion-android-wifi"></i>My Travel Stats</ion-item> <ion-item nav-clear menu-close href="#/app/status" class="item-icon item-icon-left"><i class="icon ion-android-wifi"></i>My Travel Stats</ion-item>
<ion-item nav-clear menu-close href="#/app/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/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-android-wifi"></i>Trip Logging</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/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-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-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 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 buildNumber = '0.0.1';
var maplayer = 'http://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png'; 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