Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
B
Blazer-App
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Bon Lemuel Dela Cruz
Blazer-App
Commits
a0fcfc32
Commit
a0fcfc32
authored
Jan 29, 2017
by
Bon Lemuel Dela Cruz
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Working Version Dec 2016
parent
66930d2e
Changes
12
Hide whitespace changes
Inline
Side-by-side
Showing
12 changed files
with
4395 additions
and
589 deletions
+4395
-589
keyboard.d.ts
.vscode/typings/cordova-ionic/plugins/keyboard.d.ts
+41
-0
cordova.d.ts
.vscode/typings/cordova/cordova.d.ts
+80
-0
Device.d.ts
.vscode/typings/cordova/plugins/Device.d.ts
+34
-0
Dialogs.d.ts
.vscode/typings/cordova/plugins/Dialogs.d.ts
+69
-0
InAppBrowser.d.ts
.vscode/typings/cordova/plugins/InAppBrowser.d.ts
+223
-0
NetworkInformation.d.ts
.vscode/typings/cordova/plugins/NetworkInformation.d.ts
+60
-0
Splashscreen.d.ts
.vscode/typings/cordova/plugins/Splashscreen.d.ts
+17
-0
StatusBar.d.ts
.vscode/typings/cordova/plugins/StatusBar.d.ts
+77
-0
jquery.d.ts
.vscode/typings/jquery/jquery.d.ts
+3208
-0
jsconfig.json
jsconfig.json
+1
-0
map.js
www/app/map/js/map.js
+554
-566
menu.html
www/app/menu/menu.html
+31
-23
No files found.
.vscode/typings/cordova-ionic/plugins/keyboard.d.ts
0 → 100644
View file @
a0fcfc32
// Type definitions for Cordova Keyboard plugin
// Project: https://github.com/driftyco/ionic-plugins-keyboard
// Definitions by: Hendrik Maus <https://github.com/hendrikmaus>
// Definitions: https://github.com/borisyankov/DefinitelyTyped
declare
module
Ionic
{
interface
Keyboard
{
/**
* Hide the keyboard accessory bar with the next, previous and done buttons.
*
* @param hide
*/
hideKeyboardAccessoryBar
(
hide
:
boolean
):
void
;
/**
* Close the keyboard if it is open.
*/
close
():
void
;
/**
* Force keyboard to be shown on Android.
* This typically helps if autofocus on a text element does not pop up the keyboard automatically
*
* Supported Platforms: Android, Blackberry 10
*/
show
():
void
;
/**
* Disable native scrolling, useful if you are using JavaScript to scroll
*
* @param disbale
*/
disableScroll
(
disbale
:
boolean
):
void
;
/**
* Whether or not the keyboard is currently visible.
*/
isVisible
:
boolean
;
}
}
.vscode/typings/cordova/cordova.d.ts
0 → 100644
View file @
a0fcfc32
// Type definitions for Apache Cordova
// Project: http://cordova.apache.org
// Definitions by: Microsoft Open Technologies Inc. <http://msopentech.com>
// Definitions: https://github.com/borisyankov/DefinitelyTyped
//
// Copyright (c) Microsoft Open Technologies, Inc.
// Licensed under the MIT license.
interface
Cordova
{
/** Invokes native functionality by specifying corresponding service name, action and optional parameters.
* @param success A success callback function.
* @param fail An error callback function.
* @param service The service name to call on the native side (corresponds to a native class).
* @param action The action name to call on the native side (generally corresponds to the native class method).
* @param args An array of arguments to pass into the native environment.
*/
exec
(
success
:
()
=>
any
,
fail
:
()
=>
any
,
service
:
string
,
action
:
string
,
args
?:
string
[]):
void
;
/** Gets the operating system name. */
platformId
:
string
;
/** Gets Cordova framework version */
version
:
string
;
/** Defines custom logic as a Cordova module. Other modules can later access it using module name provided. */
define
(
moduleName
:
string
,
factory
:
(
require
:
any
,
exports
:
any
,
module
:
any
)
=>
any
):
void
;
/** Access a Cordova module by name. */
require
(
moduleName
:
string
):
any
;
/** Namespace for Cordova plugin functionality */
plugins
:
CordovaPlugins
;
}
interface
CordovaPlugins
{}
interface
Document
{
addEventListener
(
type
:
"deviceready"
,
listener
:
(
ev
:
Event
)
=>
any
,
useCapture
?:
boolean
):
void
;
addEventListener
(
type
:
"pause"
,
listener
:
(
ev
:
Event
)
=>
any
,
useCapture
?:
boolean
):
void
;
addEventListener
(
type
:
"resume"
,
listener
:
(
ev
:
Event
)
=>
any
,
useCapture
?:
boolean
):
void
;
addEventListener
(
type
:
"backbutton"
,
listener
:
(
ev
:
Event
)
=>
any
,
useCapture
?:
boolean
):
void
;
addEventListener
(
type
:
"menubutton"
,
listener
:
(
ev
:
Event
)
=>
any
,
useCapture
?:
boolean
):
void
;
addEventListener
(
type
:
"searchbutton"
,
listener
:
(
ev
:
Event
)
=>
any
,
useCapture
?:
boolean
):
void
;
addEventListener
(
type
:
"startcallbutton"
,
listener
:
(
ev
:
Event
)
=>
any
,
useCapture
?:
boolean
):
void
;
addEventListener
(
type
:
"endcallbutton"
,
listener
:
(
ev
:
Event
)
=>
any
,
useCapture
?:
boolean
):
void
;
addEventListener
(
type
:
"volumedownbutton"
,
listener
:
(
ev
:
Event
)
=>
any
,
useCapture
?:
boolean
):
void
;
addEventListener
(
type
:
"volumeupbutton"
,
listener
:
(
ev
:
Event
)
=>
any
,
useCapture
?:
boolean
):
void
;
removeEventListener
(
type
:
"deviceready"
,
listener
:
(
ev
:
Event
)
=>
any
,
useCapture
?:
boolean
):
void
;
removeEventListener
(
type
:
"pause"
,
listener
:
(
ev
:
Event
)
=>
any
,
useCapture
?:
boolean
):
void
;
removeEventListener
(
type
:
"resume"
,
listener
:
(
ev
:
Event
)
=>
any
,
useCapture
?:
boolean
):
void
;
removeEventListener
(
type
:
"backbutton"
,
listener
:
(
ev
:
Event
)
=>
any
,
useCapture
?:
boolean
):
void
;
removeEventListener
(
type
:
"menubutton"
,
listener
:
(
ev
:
Event
)
=>
any
,
useCapture
?:
boolean
):
void
;
removeEventListener
(
type
:
"searchbutton"
,
listener
:
(
ev
:
Event
)
=>
any
,
useCapture
?:
boolean
):
void
;
removeEventListener
(
type
:
"startcallbutton"
,
listener
:
(
ev
:
Event
)
=>
any
,
useCapture
?:
boolean
):
void
;
removeEventListener
(
type
:
"endcallbutton"
,
listener
:
(
ev
:
Event
)
=>
any
,
useCapture
?:
boolean
):
void
;
removeEventListener
(
type
:
"volumedownbutton"
,
listener
:
(
ev
:
Event
)
=>
any
,
useCapture
?:
boolean
):
void
;
removeEventListener
(
type
:
"volumeupbutton"
,
listener
:
(
ev
:
Event
)
=>
any
,
useCapture
?:
boolean
):
void
;
addEventListener
(
type
:
string
,
listener
:
(
ev
:
Event
)
=>
any
,
useCapture
?:
boolean
):
void
;
removeEventListener
(
type
:
string
,
listener
:
(
ev
:
Event
)
=>
any
,
useCapture
?:
boolean
):
void
;
}
interface
Window
{
cordova
:
Cordova
;
}
// cordova/argscheck module
interface
ArgsCheck
{
checkArgs
(
argsSpec
:
string
,
functionName
:
string
,
args
:
any
[],
callee
?:
any
):
void
;
getValue
(
value
?:
any
,
defaultValue
?:
any
):
any
;
enableChecks
:
boolean
;
}
// cordova/urlutil module
interface
UrlUtil
{
makeAbsolute
(
url
:
string
):
string
}
/** Apache Cordova instance */
declare
var
cordova
:
Cordova
;
declare
module
'cordova'
{
export
=
cordova
;
}
.vscode/typings/cordova/plugins/Device.d.ts
0 → 100644
View file @
a0fcfc32
// Type definitions for Apache Cordova Device plugin.
// Project: https://github.com/apache/cordova-plugin-device
// Definitions by: Microsoft Open Technologies, Inc. <http://msopentech.com>
// Definitions: https://github.com/borisyankov/DefinitelyTyped
//
// Copyright (c) Microsoft Open Technologies, Inc.
// Licensed under the MIT license.
/**
* This plugin defines a global device object, which describes the device's hardware and software.
* Although the object is in the global scope, it is not available until after the deviceready event.
*/
interface
Device
{
/** Get the version of Cordova running on the device. */
cordova
:
string
;
/**
* The device.model returns the name of the device's model or product. The value is set
* by the device manufacturer and may be different across versions of the same product.
*/
model
:
string
;
/** Get the device's operating system name. */
platform
:
string
;
/** Get the device's Universally Unique Identifier (UUID). */
uuid
:
string
;
/** Get the operating system version. */
version
:
string
;
/** Get the device's manufacturer. */
manufacturer
:
string
;
/** Whether the device is running on a simulator. */
isVirtual
:
boolean
;
/** Get the device hardware serial number. */
serial
:
string
;}
declare
var
device
:
Device
;
\ No newline at end of file
.vscode/typings/cordova/plugins/Dialogs.d.ts
0 → 100644
View file @
a0fcfc32
// Type definitions for Apache Cordova Dialogs plugin.
// Project: https://github.com/apache/cordova-plugin-dialogs
// Definitions by: Microsoft Open Technologies, Inc. <http://msopentech.com>
// Definitions: https://github.com/borisyankov/DefinitelyTyped
//
// Copyright (c) Microsoft Open Technologies, Inc.
// Licensed under the MIT license.
interface
Navigator
{
/** This plugin provides access to some native dialog UI elements. */
notification
:
Notification
}
/** This plugin provides access to some native dialog UI elements. */
interface
Notification
{
/**
* Shows a custom alert or dialog box. Most Cordova implementations use a native dialog box for this feature,
* but some platforms use the browser's alert function, which is typically less customizable.
* @param message Dialog message.
* @param alertCallback Callback to invoke when alert dialog is dismissed.
* @param title Dialog title, defaults to 'Alert'.
* @param buttonName Button name, defaults to OK.
*/
alert
(
message
:
string
,
alertCallback
:
()
=>
void
,
title
?:
string
,
buttonName
?:
string
):
void
;
/**
* The device plays a beep sound.
* @param times The number of times to repeat the beep.
*/
beep
(
times
:
number
):
void
;
/**
* Displays a customizable confirmation dialog box.
* @param message Dialog message.
* @param confirmCallback Callback to invoke with index of button pressed (1, 2, or 3)
* or when the dialog is dismissed without a button press (0).
* @param title Dialog title, defaults to Confirm.
* @param buttonLabels Array of strings specifying button labels, defaults to [OK,Cancel].
*/
confirm
(
message
:
string
,
confirmCallback
:
(
choice
:
number
)
=>
void
,
title
?:
string
,
buttonLabels
?:
string
[]):
void
;
/**
* Displays a native dialog box that is more customizable than the browser's prompt function.
* @param message Dialog message.
* @param promptCallback Callback to invoke when a button is pressed.
* @param title Dialog title, defaults to "Prompt".
* @param buttonLabels Array of strings specifying button labels, defaults to ["OK","Cancel"].
* @param defaultText Default textbox input value, default: "".
*/
prompt
(
message
:
string
,
promptCallback
:
(
result
:
NotificationPromptResult
)
=>
void
,
title
?:
string
,
buttonLabels
?:
string
[],
defaultText
?:
string
):
void
;
}
/** Object, passed to promptCallback */
interface
NotificationPromptResult
{
/**
* The index of the pressed button. Note that the index uses one-based indexing, so the value is 1, 2, 3, etc.
* 0 is the result when the dialog is dismissed without a button press.
*/
buttonIndex
:
number
;
/** The text entered in the prompt dialog box. */
input1
:
string
;
}
\ No newline at end of file
.vscode/typings/cordova/plugins/InAppBrowser.d.ts
0 → 100644
View file @
a0fcfc32
// Type definitions for Apache Cordova InAppBrowser plugin 1.4.0
// Project: https://github.com/apache/cordova-plugin-inappbrowser
// Definitions by: Microsoft Open Technologies, Inc. <http://msopentech.com>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
//
// Copyright (c) Microsoft Open Technologies, Inc.
// Licensed under the MIT license.
interface
Window
{
/**
* Opens a URL in a new InAppBrowser instance, the current browser instance, or the system browser.
* @param url The URL to load.
* @param target The target in which to load the URL, an optional parameter that defaults to _self.
* @param options Options for the InAppBrowser. Optional, defaulting to: location=yes.
* The options string must not contain any blank space, and each feature's
* name/value pairs must be separated by a comma. Feature names are case insensitive.
*/
open
(
url
:
string
,
target
?:
"_self"
,
options
?:
string
):
InAppBrowser
;
/**
* Opens a URL in a new InAppBrowser instance, the current browser instance, or the system browser.
* @param url The URL to load.
* @param target The target in which to load the URL, an optional parameter that defaults to _self.
* @param options Options for the InAppBrowser. Optional, defaulting to: location=yes.
* The options string must not contain any blank space, and each feature's
* name/value pairs must be separated by a comma. Feature names are case insensitive.
*/
open
(
url
:
string
,
target
?:
"_blank"
,
options
?:
string
):
InAppBrowser
;
/**
* Opens a URL in a new InAppBrowser instance, the current browser instance, or the system browser.
* @param url The URL to load.
* @param target The target in which to load the URL, an optional parameter that defaults to _self.
* @param options Options for the InAppBrowser. Optional, defaulting to: location=yes.
* The options string must not contain any blank space, and each feature's
* name/value pairs must be separated by a comma. Feature names are case insensitive.
*/
open
(
url
:
string
,
target
?:
"_system"
,
options
?:
string
):
InAppBrowser
;
/**
* Opens a URL in a new InAppBrowser instance, the current browser instance, or the system browser.
* @param url The URL to load.
* @param target The target in which to load the URL, an optional parameter that defaults to _self.
* @param options Options for the InAppBrowser. Optional, defaulting to: location=yes.
* The options string must not contain any blank space, and each feature's
* name/value pairs must be separated by a comma. Feature names are case insensitive.
*/
open
(
url
:
string
,
target
?:
string
,
options
?:
string
,
replace
?:
boolean
):
InAppBrowser
;
}
/**
* The object returned from a call to window.open.
* NOTE: The InAppBrowser window behaves like a standard web browser, and can't access Cordova APIs.
*/
interface
InAppBrowser
extends
Window
{
onloadstart
:
(
type
:
InAppBrowserEvent
)
=>
void
;
onloadstop
:
(
type
:
InAppBrowserEvent
)
=>
void
;
onloaderror
:
(
type
:
InAppBrowserEvent
)
=>
void
;
onexit
:
(
type
:
InAppBrowserEvent
)
=>
void
;
// addEventListener overloads
/**
* Adds a listener for an event from the InAppBrowser.
* @param type the event to listen for
* loadstart: event fires when the InAppBrowser starts to load a URL.
* loadstop: event fires when the InAppBrowser finishes loading a URL.
* loaderror: event fires when the InAppBrowser encounters an error when loading a URL.
* exit: event fires when the InAppBrowser window is closed.
* @param callback the function that executes when the event fires. The function is
* passed an InAppBrowserEvent object as a parameter.
*/
addEventListener
(
type
:
"loadstart"
,
callback
:
(
event
:
InAppBrowserEvent
)
=>
void
):
void
;
/**
* Adds a listener for an event from the InAppBrowser.
* @param type the event to listen for
* loadstart: event fires when the InAppBrowser starts to load a URL.
* loadstop: event fires when the InAppBrowser finishes loading a URL.
* loaderror: event fires when the InAppBrowser encounters an error when loading a URL.
* exit: event fires when the InAppBrowser window is closed.
* @param callback the function that executes when the event fires. The function is
* passed an InAppBrowserEvent object as a parameter.
*/
addEventListener
(
type
:
"loadstop"
,
callback
:
(
event
:
InAppBrowserEvent
)
=>
void
):
void
;
/**
* Adds a listener for an event from the InAppBrowser.
* @param type the event to listen for
* loadstart: event fires when the InAppBrowser starts to load a URL.
* loadstop: event fires when the InAppBrowser finishes loading a URL.
* loaderror: event fires when the InAppBrowser encounters an error when loading a URL.
* exit: event fires when the InAppBrowser window is closed.
* @param callback the function that executes when the event fires. The function is
* passed an InAppBrowserEvent object as a parameter.
*/
addEventListener
(
type
:
"loaderror"
,
callback
:
(
event
:
InAppBrowserEvent
)
=>
void
):
void
;
/**
* Adds a listener for an event from the InAppBrowser.
* @param type the event to listen for
* loadstart: event fires when the InAppBrowser starts to load a URL.
* loadstop: event fires when the InAppBrowser finishes loading a URL.
* loaderror: event fires when the InAppBrowser encounters an error when loading a URL.
* exit: event fires when the InAppBrowser window is closed.
* @param callback the function that executes when the event fires. The function is
* passed an InAppBrowserEvent object as a parameter.
*/
addEventListener
(
type
:
"exit"
,
callback
:
(
event
:
InAppBrowserEvent
)
=>
void
):
void
;
/**
* Adds a listener for an event from the InAppBrowser.
* @param type the event to listen for
* loadstart: event fires when the InAppBrowser starts to load a URL.
* loadstop: event fires when the InAppBrowser finishes loading a URL.
* loaderror: event fires when the InAppBrowser encounters an error when loading a URL.
* exit: event fires when the InAppBrowser window is closed.
* @param callback the function that executes when the event fires. The function is
* passed an Event object as a parameter.
*/
addEventListener
(
type
:
string
,
callback
:
(
event
:
Event
)
=>
void
):
void
;
// removeEventListener overloads
/**
* Removes a listener for an event from the InAppBrowser.
* @param type The event to stop listening for.
* loadstart: event fires when the InAppBrowser starts to load a URL.
* loadstop: event fires when the InAppBrowser finishes loading a URL.
* loaderror: event fires when the InAppBrowser encounters an error when loading a URL.
* exit: event fires when the InAppBrowser window is closed.
* @param callback the function that executes when the event fires. The function is
* passed an InAppBrowserEvent object as a parameter.
*/
removeEventListener
(
type
:
"loadstart"
,
callback
:
(
event
:
InAppBrowserEvent
)
=>
void
):
void
;
/**
* Removes a listener for an event from the InAppBrowser.
* @param type The event to stop listening for.
* loadstart: event fires when the InAppBrowser starts to load a URL.
* loadstop: event fires when the InAppBrowser finishes loading a URL.
* loaderror: event fires when the InAppBrowser encounters an error when loading a URL.
* exit: event fires when the InAppBrowser window is closed.
* @param callback the function that executes when the event fires. The function is
* passed an InAppBrowserEvent object as a parameter.
*/
removeEventListener
(
type
:
"loadstop"
,
callback
:
(
event
:
InAppBrowserEvent
)
=>
void
):
void
;
/**
* Removes a listener for an event from the InAppBrowser.
* @param type The event to stop listening for.
* loadstart: event fires when the InAppBrowser starts to load a URL.
* loadstop: event fires when the InAppBrowser finishes loading a URL.
* loaderror: event fires when the InAppBrowser encounters an error when loading a URL.
* exit: event fires when the InAppBrowser window is closed.
* @param callback the function that executes when the event fires. The function is
* passed an InAppBrowserEvent object as a parameter.
*/
removeEventListener
(
type
:
"loaderror"
,
callback
:
(
event
:
InAppBrowserEvent
)
=>
void
):
void
;
/**
* Removes a listener for an event from the InAppBrowser.
* @param type The event to stop listening for.
* loadstart: event fires when the InAppBrowser starts to load a URL.
* loadstop: event fires when the InAppBrowser finishes loading a URL.
* loaderror: event fires when the InAppBrowser encounters an error when loading a URL.
* exit: event fires when the InAppBrowser window is closed.
* @param callback the function that executes when the event fires. The function is
* passed an InAppBrowserEvent object as a parameter.
*/
removeEventListener
(
type
:
"exit"
,
callback
:
(
event
:
InAppBrowserEvent
)
=>
void
):
void
;
/**
* Removes a listener for an event from the InAppBrowser.
* @param type The event to stop listening for.
* loadstart: event fires when the InAppBrowser starts to load a URL.
* loadstop: event fires when the InAppBrowser finishes loading a URL.
* loaderror: event fires when the InAppBrowser encounters an error when loading a URL.
* exit: event fires when the InAppBrowser window is closed.
* @param callback the function that executes when the event fires. The function is
* passed an Event object as a parameter.
*/
removeEventListener
(
type
:
string
,
callback
:
(
event
:
Event
)
=>
void
):
void
;
/** Closes the InAppBrowser window. */
close
():
void
;
/**
* Displays an InAppBrowser window that was opened hidden. Calling this has no effect
* if the InAppBrowser was already visible.
*/
show
():
void
;
/**
* Injects JavaScript code into the InAppBrowser window.
* @param script Details of the script to run, specifying either a file or code key.
* @param callback The function that executes after the JavaScript code is injected.
* If the injected script is of type code, the callback executes with
* a single parameter, which is the return value of the script, wrapped in an Array.
* For multi-line scripts, this is the return value of the last statement,
* or the last expression evaluated.
*/
executeScript
(
script
:
{
code
:
string
},
callback
:
(
result
:
any
)
=>
void
):
void
;
/**
* Injects JavaScript code into the InAppBrowser window.
* @param script Details of the script to run, specifying either a file or code key.
* @param callback The function that executes after the JavaScript code is injected.
* If the injected script is of type code, the callback executes with
* a single parameter, which is the return value of the script, wrapped in an Array.
* For multi-line scripts, this is the return value of the last statement,
* or the last expression evaluated.
*/
executeScript
(
script
:
{
file
:
string
},
callback
:
(
result
:
any
)
=>
void
):
void
;
/**
* Injects CSS into the InAppBrowser window.
* @param css Details of the script to run, specifying either a file or code key.
* @param callback The function that executes after the CSS is injected.
*/
insertCSS
(
css
:
{
code
:
string
},
callback
:
()
=>
void
):
void
;
/**
* Injects CSS into the InAppBrowser window.
* @param css Details of the script to run, specifying either a file or code key.
* @param callback The function that executes after the CSS is injected.
*/
insertCSS
(
css
:
{
file
:
string
},
callback
:
()
=>
void
):
void
;
}
interface
InAppBrowserEvent
extends
Event
{
/** the eventname, either loadstart, loadstop, loaderror, or exit. */
type
:
string
;
/** the URL that was loaded. */
url
:
string
;
/** the error code, only in the case of loaderror. */
code
:
number
;
/** the error message, only in the case of loaderror. */
message
:
string
;
}
interface
Cordova
{
InAppBrowser
:
InAppBrowser
;
}
.vscode/typings/cordova/plugins/NetworkInformation.d.ts
0 → 100644
View file @
a0fcfc32
// Type definitions for Apache Cordova Network Information plugin.
// Project: https://github.com/apache/cordova-plugin-network-information
// Definitions by: Microsoft Open Technologies, Inc. <http://msopentech.com>
// Definitions: https://github.com/borisyankov/DefinitelyTyped
//
// Copyright (c) Microsoft Open Technologies, Inc.
// Licensed under the MIT license.
interface
Navigator
{
/**
* This plugin provides an implementation of an old version of the Network Information API.
* It provides information about the device's cellular and wifi connection, and whether the device has an internet connection.
*/
connection
:
Connection
;
// see https://github.com/apache/cordova-plugin-network-information/blob/dev/doc/index.md#api-change
// for
network
:
{
/**
* This plugin provides an implementation of an old version of the Network Information API.
* It provides information about the device's cellular and wifi connection, and whether the device has an internet connection.
*/
connection
:
Connection
}
}
interface
Document
{
addEventListener
(
type
:
"online"
,
connectionStateCallback
:
()
=>
any
,
useCapture
?:
boolean
):
void
;
addEventListener
(
type
:
"offline"
,
connectionStateCallback
:
()
=>
any
,
useCapture
?:
boolean
):
void
;
}
/**
* The connection object, exposed via navigator.connection, provides information
* about the device's cellular and wifi connection.
*/
interface
Connection
{
/**
* This property offers a fast way to determine the device's network connection state, and type of connection.
* One of:
* Connection.UNKNOWN
* Connection.ETHERNET
* Connection.WIFI
* Connection.CELL_2G
* Connection.CELL_3G
* Connection.CELL_4G
* Connection.CELL
* Connection.NONE
*/
type
:
string
}
declare
var
Connection
:
{
UNKNOWN
:
string
;
ETHERNET
:
string
;
WIFI
:
string
;
CELL_2G
:
string
;
CELL_3G
:
string
;
CELL_4G
:
string
;
CELL
:
string
;
NONE
:
string
;
}
.vscode/typings/cordova/plugins/Splashscreen.d.ts
0 → 100644
View file @
a0fcfc32
// Type definitions for Apache Cordova Splashscreen plugin.
// Project: https://github.com/apache/cordova-plugin-splashscreen
// Definitions by: Microsoft Open Technologies, Inc. <http://msopentech.com>
// Definitions: https://github.com/borisyankov/DefinitelyTyped
//
// Copyright (c) Microsoft Open Technologies, Inc.
// Licensed under the MIT license.
interface
Navigator
{
/** This plugin displays and hides a splash screen during application launch. */
splashscreen
:
{
/** Dismiss the splash screen. */
hide
():
void
;
/** Displays the splash screen. */
show
():
void
;
}
}
\ No newline at end of file
.vscode/typings/cordova/plugins/StatusBar.d.ts
0 → 100644
View file @
a0fcfc32
// Type definitions for Apache Cordova StatusBar plugin.
// Project: https://github.com/apache/cordova-plugin-statusbar
// Definitions by: Xinkai Chen <https://github.com/Xinkai>
// Definitions: https://github.com/borisyankov/DefinitelyTyped
/**
* Global object StatusBar.
*/
interface
Window
{
StatusBar
:
StatusBar
;
}
/**
* The StatusBar object provides some functions to customize the iOS and Android StatusBar.
*/
interface
StatusBar
{
/**
* On iOS 7, make the statusbar overlay or not overlay the WebView.
* @param isOverlay On iOS 7, set to false to make the statusbar appear like iOS 6.
* Set the style and background color to suit using the other functions.
*/
overlaysWebView
:
(
isOverlay
:
boolean
)
=>
void
;
/**
* Use the default statusbar (dark text, for light backgrounds).
*/
styleDefault
:
()
=>
void
;
/**
* Use the lightContent statusbar (light text, for dark backgrounds).
*/
styleLightContent
:
()
=>
void
;
/**
* Use the blackTranslucent statusbar (light text, for dark backgrounds).
*/
styleBlackTranslucent
:
()
=>
void
;
/**
* Use the blackOpaque statusbar (light text, for dark backgrounds).
*/
styleBlackOpaque
:
()
=>
void
;
/**
* On iOS 7, when you set StatusBar.statusBarOverlaysWebView to false,
* you can set the background color of the statusbar by color name.
* @param color Supported color names are:
* black, darkGray, lightGray, white, gray, red, green, blue, cyan, yellow, magenta, orange, purple, brown
*/
backgroundColorByName
:
(
color
:
string
)
=>
void
;
/**
* Sets the background color of the statusbar by a hex string.
* @param color CSS shorthand properties are also supported.
* On iOS 7, when you set StatusBar.statusBarOverlaysWebView to false, you can set the background color of the statusbar by a hex string (#RRGGBB).
* On WP7 and WP8 you can also specify values as #AARRGGBB, where AA is an alpha value
*/
backgroundColorByHexString
:
(
color
:
string
)
=>
void
;
/**
* Hide the statusbar.
*/
hide
:
()
=>
void
;
/**
* Show the statusbar.
*/
show
:
()
=>
void
;
/**
* Read this property to see if the statusbar is visible or not.
*/
isVisible
:
boolean
;
}
declare
var
StatusBar
:
StatusBar
;
.vscode/typings/jquery/jquery.d.ts
0 → 100644
View file @
a0fcfc32
This source diff could not be displayed because it is too large. You can
view the blob
instead.
jsconfig.json
0 → 100644
View file @
a0fcfc32
{}
\ No newline at end of file
www/app/map/js/map.js
View file @
a0fcfc32
...
...
@@ -2,574 +2,562 @@ angular.module('blazer.mapcontrollers', [])
.
controller
(
'MapCtrl'
,
function
(
$scope
,
$cordovaGeolocation
,
$cordovaDialogs
,
$stateParams
,
$ionicModal
,
$ionicPopup
,
$ionicLoading
,
$interval
,
$filter
,
$ionicPopover
,
getBlazer
,
postBlazer
,
$ionicSideMenuDelegate
,
$ionicHistory
,
$cordovaNetwork
)
{
// CLEAR HISTORY
$ionicHistory
.
clearHistory
();
/* SIDE MENU TRIGGER */
$ionicSideMenuDelegate
.
canDragContent
(
false
);
// SET SIDE MENU DRAG FALSE
$scope
.
openMenu
=
function
(){
$ionicSideMenuDelegate
.
toggleLeft
();
}
/* MAP DEFAULTS */
var
map
=
L
.
map
(
'mapid'
);
map
.
setView
(
new
L
.
LatLng
(
14.5818
,
120.9771
),
12
);
//MAP BOX
L
.
tileLayer
(
maplayer
,
{
maxZoom
:
18
,
minZoom
:
9
,
attribution
:
'© OpenStreetMap contributors'
}).
addTo
(
map
);
/* MAP COMPONENTS */
var
markers
,
circles
,
line
;
$scope
.
drawMarkers
=
function
(
lat
,
lon
,
message
){
markers
=
new
L
.
marker
([
lat
,
lon
]).
addTo
(
map
);
markers
.
bindPopup
(
message
).
openPopup
();
}
/* Draw Trip Marker */
$scope
.
drawTripMarkers
=
function
(
lat
,
lon
){
markers
=
new
L
.
marker
([
lat
,
lon
]).
addTo
(
map
);
markers
.
bindPopup
(
'On Trip'
).
openPopup
();
}
/* Draw Radius */
$scope
.
drawCircle
=
function
(
lat
,
lon
){
circle
=
L
.
circle
([
lat
,
lon
],
500
,
{
color
:
''
,
fillColor
:
'#165c5b'
,
fillOpacity
:
0.3
}).
addTo
(
map
);
}
var
coordinates
=
[];
// FOR DRAWN LINES
var
logCoordinates
=
[];
// FOR LOGGING TRIP
var
setLatLng
;
var
coords
;
$scope
.
drawLineTrack
=
function
(
lat
,
lon
){
var
polylineOptions
=
{
color
:
'#185c82'
,
weight
:
6
,
opacity
:
0.9
};
setLatLng
=
new
L
.
LatLng
(
lat
,
lon
);
// USING LEAFLET LATLNG
coords
=
{
lat
,
lon
};
// USING SELF LATLNG
coordinates
.
push
(
coords
);
console
.
log
(
coordinates
);
line
=
new
L
.
polyline
(
coordinates
,
polylineOptions
);
// line.addTo(map);
map
.
addLayer
(
line
);
// map.fitBounds(line.getBounds()); // zoom the map to the polyline
// REMOVE MARKERS
map
.
removeLayer
(
markers
);
$scope
.
drawMarkers
(
lat
,
lon
,
'On Trip'
);
// DRAW TRIP MARKER ]
}
/* EVENT LISTENERS */
$scope
.
mapButton
=
true
;
function
onMapDrag
(
e
)
{
$scope
.
mapButton
=
false
;
console
.
log
(
"Map Drag "
,
$scope
.
mapButton
);
}
function
onMapDragEnd
(
e
)
{
$scope
.
mapButton
=
true
;
console
.
log
(
"Map Drag "
,
$scope
.
mapButton
);
}
map
.
on
(
'move'
,
onMapDrag
);
// FIRE MAPDRAG
map
.
on
(
'moveend'
,
onMapDragEnd
);
// FIRE MAPDRAG END
$scope
.
clearPolylines
=
function
(){
console
.
debug
(
"********** Clear Polylines **********"
);
for
(
var
i
=
0
;
i
<
coordinates
.
length
;
i
++
){
map
.
removeLayer
(
line
.
_latlngs
[
i
]);
console
.
error
(
"[ CHECK LOOP ]"
,
i
+
" "
+
coordinates
.
length
);
console
.
log
(
"[ DELETE LINES ]"
,
line
.
_latlngs
[
i
]);
// coordinates.splice(i, 1); // REMOVE AN ITEM ON AN ARRAY
}
}
/* LOAD USER ON MAP WITH RADIUS */
var
userLocated
=
false
;
$scope
.
initializedLocateUser
=
function
(){
console
.
debug
(
"********** Initialized Location **********"
);
var
posOptions
=
{
enableHighAccuracy
:
true
};
$cordovaGeolocation
.
getCurrentPosition
(
posOptions
).
then
(
function
(
position
)
{
map
.
setView
(
new
L
.
LatLng
(
position
.
coords
.
latitude
,
position
.
coords
.
longitude
),
15
);
// SET MAP VIEW
if
(
userLocated
==
false
){
$scope
.
drawMarkers
(
position
.
coords
.
latitude
,
position
.
coords
.
longitude
,
'Your current location'
);
// DRAW MARKERS
$scope
.
drawCircle
(
position
.
coords
.
latitude
,
position
.
coords
.
longitude
);
// DRAW CIRCLE RADIUS
userLocated
=
true
;
}
else
{
console
.
log
(
"USER ALREADY LOCATED"
);
userLocated
=
true
;
}
},
function
(
error
)
{
console
.
log
(
"LOCATING ERROR "
,
error
);
});
}
/* Calculate Distance between points */
$scope
.
getDistanceFromLatLonInKm
=
function
(
lat1
,
lon1
,
lat2
,
lon2
)
{
var
R
=
6371
;
// Radius of the earth in km
var
dLat
=
deg2rad
(
lat2
-
lat1
);
// deg2rad function
var
dLon
=
deg2rad
(
lon2
-
lon1
);
var
a
=
Math
.
sin
(
dLat
/
2
)
*
Math
.
sin
(
dLat
/
2
)
+
Math
.
cos
(
deg2rad
(
lat1
))
*
Math
.
cos
(
deg2rad
(
lat2
))
*
Math
.
sin
(
dLon
/
2
)
*
Math
.
sin
(
dLon
/
2
);
var
c
=
2
*
Math
.
atan2
(
Math
.
sqrt
(
a
),
Math
.
sqrt
(
1
-
a
));
var
d
=
R
*
c
;
// Distance in km
console
.
log
(
"[ DISTANCE BETWEEN COORDINDATES ]"
,
d
);
return
d
;
}
function
deg2rad
(
deg
)
{
return
deg
*
(
Math
.
PI
/
180
)
}
/* MAIN ALGORITHM */
var
tripStatusRef
=
false
;
$scope
.
getUserLocation
=
function
(){
console
.
debug
(
"********** Trip Location **********"
);
var
posOptions
=
{
enableHighAccuracy
:
true
};
$cordovaGeolocation
.
getCurrentPosition
(
posOptions
).
then
(
function
(
position
)
{
console
.
log
(
"[ CURRENT LOCATION ]"
,
position
.
coords
);
if
(
!
tripStatusRef
){
$scope
.
drawLineTrack
(
position
.
coords
.
latitude
,
position
.
coords
.
longitude
);
// INITIAL LINE ON TRIP
tripStatusRef
=
true
;
}
// Filter Coordinates Distance Method
var
locationData
=
{
lat
:
position
.
coords
.
latitude
,
lng
:
position
.
coords
.
longitude
}
if
(
logCoordinates
.
length
>
0
)
// CHECK IF ARAY IS EMPTY
{
if
(
$scope
.
getDistanceFromLatLonInKm
(
locationData
.
lat
,
locationData
.
lng
,
logCoordinates
[
0
].
lat
,
logCoordinates
[
0
].
lng
)
>
0.03
)
{
logCoordinates
.
splice
(
0
,
0
,
locationData
);
console
.
log
(
"[ LOCATION ARRAY ]"
,
logCoordinates
);
$scope
.
drawLineTrack
(
position
.
coords
.
latitude
,
position
.
coords
.
longitude
);
// DRAW LINE ON TRIP
}
else
{
console
.
error
(
"[ You need to be 500 meters away from your current position ]"
,
logCoordinates
);
}
}
else
{
logCoordinates
.
splice
(
0
,
0
,
locationData
);
console
.
log
(
"[ INITIAL LOCATION ARRAY ]"
,
logCoordinates
);
}
},
function
(
error
)
{
console
.
error
(
"GENERAL LOCATION ERROR "
,
error
);
});
}
$scope
.
refreshMap
=
function
(){
console
.
debug
(
"********** Refresh Map **********"
);
if
(
userLocated
==
true
){
map
.
removeLayer
(
markers
);
map
.
removeLayer
(
circle
);
map
.
removeLayer
(
geojsonLayer
);
// map.removeLayer(line);
console
.
log
(
"Map refreshed. Layers Removed"
);
userLocated
=
false
;
}
$scope
.
initializedLocateUser
();
$scope
.
clearPolylines
();
}
/* CONFIRM TRIP DESTINATION */
$scope
.
confirmTripDestination
=
function
(){
var
tripPopup
=
$ionicPopup
.
show
({
title
:
'Trip Destination'
,
subTitle
:
'Select your destination'
,
scope
:
$scope
,
buttons
:
[
{
text
:
'School'
,
type
:
'button-dark button-outline'
,
onTap
:
function
()
{
localStorage
.
setItem
(
"currentTrip"
,
'trip2'
);
$scope
.
tripStart
();
console
.
log
(
'Destination to School'
);
}
},
{
text
:
'Home'
,
type
:
'button-dark button-outline'
,
onTap
:
function
()
{
localStorage
.
setItem
(
"currentTrip"
,
'trip1'
);
$scope
.
tripStart
();
console
.
log
(
'Destination to Home'
);
}
}
]
});
}
/* SET SEARCH BARANGAY */
$scope
.
BarangayList
=
{};
$scope
.
getAllBarangay
=
function
(){
console
.
debug
(
"******* GET ALL BARANGAY ******"
);
getBlazer
.
getAllBarangay
().
then
(
function
(
data
){
$scope
.
BarangayList
=
data
;
console
.
log
(
"[ Barangay Data ]"
,
JSON
.
stringify
(
$scope
.
BarangayList
));
});
}
$scope
.
selectedBarangayData
=
''
;
$scope
.
currentBarangay
=
''
;
$scope
.
currentBarangayTime
=
''
;
$scope
.
onLoadSelection
=
function
(){
$scope
.
data
=
{};
// An elaborate, custom popup
var
myPopup
=
$ionicPopup
.
show
({
template
:
'<label class="input-label">Barangay</label><label class="item item-input item-select"><div class="input-label"></div><select ng-model="data.selectedBarangay"><option ng-repeat = "barangay in BarangayList" value="{{barangay.name}}">{{barangay.name}}</option></select></label><label class="input-label">Time</label><label class="item item-input item-select"><div class="input-label"></div><select ng-model="data.selectedBarangayTime"><option value="AM">AM Trips</option><option value="PM">PM Trips</option></select></label>'
,
title
:
'Select your Barangay'
,
subTitle
:
'To view the most COMMON MODE of transportation in your barangay.'
,
scope
:
$scope
,
buttons
:
[
{
text
:
'Select'
,
type
:
'button-dark button-outline'
,
onTap
:
function
(
e
)
{
console
.
log
(
"[ SELECT DATA ]"
,
$scope
.
data
.
selectedBarangay
+
" "
+
$scope
.
data
.
selectedBarangayTime
);
// LOAD MAP FUNCTIONS
$scope
.
selectedBarangayData
=
$scope
.
data
.
selectedBarangay
+
" "
+
$scope
.
data
.
selectedBarangayTime
;
$scope
.
currentBarangay
=
$scope
.
data
.
selectedBarangay
;
$scope
.
currentBarangayTime
=
$scope
.
data
.
selectedBarangayTime
;
$scope
.
data
=
{};
}
},
{
text
:
'Cancel'
,
type
:
'button-dark button-outline'
,
onTap
:
function
(
e
)
{
console
.
log
(
"[ LOAD BARANGAY CANCELLED ]"
)
}
}
]
});
}
/* CHART JS DATA */
$scope
.
BarangayData
=
{};
$scope
.
loadBarangayData
=
function
(){
console
.
debug
(
"********** Get Barangay Data **********"
);
var
barangayinfo
=
{
"barangay"
:
$scope
.
currentBarangay
,
"time"
:
$scope
.
currentBarangayTime
};
postBlazer
.
BarangayInformation
(
barangayinfo
)
.
success
(
function
(
response
)
{
console
.
log
(
" BARANGAY SUCCESS"
,
response
);
$scope
.
BarangayData
=
response
;
console
.
log
(
'[ BARANGAY DETAILS ]'
,
JSON
.
stringify
(
$scope
.
BarangayData
));
$scope
.
openChart
(
$scope
.
BarangayData
);
// LOAD CHART MODAL
$scope
.
drawMarkers
(
$scope
.
BarangayData
.
lat
,
$scope
.
BarangayData
.
lng
,
$scope
.
currentBarangay
);
// RESET VALUES
$scope
.
selectedBarangayData
=
''
;
$scope
.
currentBarangay
=
''
;
$scope
.
currentBarangayTime
=
''
;
})
.
error
(
function
(
response
)
{
console
.
error
(
"BARANGAY ERROR"
,
response
);
});
}
$scope
.
labels
=
[
"Car"
,
"Tricycle"
,
"Pedicab"
,
"Jeep"
,
"Bus"
,
"Van"
,
"Walk"
,
"Carpool"
,
"Bicycle"
,
"Train"
,
"Taxi"
];
// CLEAR HISTORY
$ionicHistory
.
clearHistory
();
/* SIDE MENU TRIGGER */
$ionicSideMenuDelegate
.
canDragContent
(
false
);
// SET SIDE MENU DRAG FALSE
$scope
.
openMenu
=
function
()
{
$ionicSideMenuDelegate
.
toggleLeft
();
}
/* MAP DEFAULTS */
var
map
=
L
.
map
(
'mapid'
);
map
.
setView
(
new
L
.
LatLng
(
14.5818
,
120.9771
),
12
);
//MAP BOX
L
.
tileLayer
(
maplayer
,
{
maxZoom
:
18
,
minZoom
:
9
,
attribution
:
'© OpenStreetMap contributors'
}).
addTo
(
map
);
/* MAP COMPONENTS */
var
markers
,
circles
,
line
;
$scope
.
drawMarkers
=
function
(
lat
,
lon
,
message
)
{
markers
=
new
L
.
marker
([
lat
,
lon
]).
addTo
(
map
);
markers
.
bindPopup
(
message
).
openPopup
();
}
/* Draw Trip Marker */
$scope
.
drawTripMarkers
=
function
(
lat
,
lon
)
{
markers
=
new
L
.
marker
([
lat
,
lon
]).
addTo
(
map
);
markers
.
bindPopup
(
'On Trip'
).
openPopup
();
}
/* Draw Radius */
$scope
.
drawCircle
=
function
(
lat
,
lon
)
{
circle
=
L
.
circle
([
lat
,
lon
],
500
,
{
color
:
''
,
fillColor
:
'#165c5b'
,
fillOpacity
:
0.3
}).
addTo
(
map
);
}
var
coordinates
=
[];
// FOR DRAWN LINES
var
logCoordinates
=
[];
// FOR LOGGING TRIP
var
setLatLng
;
var
coords
;
$scope
.
drawLineTrack
=
function
(
lat
,
lon
)
{
var
polylineOptions
=
{
color
:
'#185c82'
,
weight
:
6
,
opacity
:
0.9
};
setLatLng
=
new
L
.
LatLng
(
lat
,
lon
);
// USING LEAFLET LATLNG
coords
=
{
lat
,
lon
};
// USING SELF LATLNG
coordinates
.
push
(
coords
);
console
.
log
(
coordinates
);
line
=
new
L
.
polyline
(
coordinates
,
polylineOptions
);
// line.addTo(map);
map
.
addLayer
(
line
);
// map.fitBounds(line.getBounds()); // zoom the map to the polyline
// REMOVE MARKERS
map
.
removeLayer
(
markers
);
$scope
.
drawMarkers
(
lat
,
lon
,
'On Trip'
);
// DRAW TRIP MARKER ]
}
/* EVENT LISTENERS */
$scope
.
mapButton
=
true
;
function
onMapDrag
(
e
)
{
$scope
.
mapButton
=
false
;
console
.
log
(
"Map Drag "
,
$scope
.
mapButton
);
}
function
onMapDragEnd
(
e
)
{
$scope
.
mapButton
=
true
;
console
.
log
(
"Map Drag "
,
$scope
.
mapButton
);
}
map
.
on
(
'move'
,
onMapDrag
);
// FIRE MAPDRAG
map
.
on
(
'moveend'
,
onMapDragEnd
);
// FIRE MAPDRAG END
$scope
.
clearPolylines
=
function
()
{
console
.
debug
(
"********** Clear Polylines **********"
);
for
(
var
i
=
0
;
i
<
coordinates
.
length
;
i
++
)
{
map
.
removeLayer
(
line
.
_latlngs
[
i
]);
console
.
error
(
"[ CHECK LOOP ]"
,
i
+
" "
+
coordinates
.
length
);
console
.
log
(
"[ DELETE LINES ]"
,
line
.
_latlngs
[
i
]);
// coordinates.splice(i, 1); // REMOVE AN ITEM ON AN ARRAY
}
}
/* LOAD USER ON MAP WITH RADIUS */
var
userLocated
=
false
;
$scope
.
initializedLocateUser
=
function
()
{
console
.
debug
(
"********** Initialized Location **********"
);
var
posOptions
=
{
enableHighAccuracy
:
true
};
$cordovaGeolocation
.
getCurrentPosition
(
posOptions
).
then
(
function
(
position
)
{
map
.
setView
(
new
L
.
LatLng
(
position
.
coords
.
latitude
,
position
.
coords
.
longitude
),
15
);
// SET MAP VIEW
if
(
userLocated
==
false
)
{
$scope
.
drawMarkers
(
position
.
coords
.
latitude
,
position
.
coords
.
longitude
,
'Your current location'
);
// DRAW MARKERS
$scope
.
drawCircle
(
position
.
coords
.
latitude
,
position
.
coords
.
longitude
);
// DRAW CIRCLE RADIUS
userLocated
=
true
;
}
else
{
console
.
log
(
"USER ALREADY LOCATED"
);
userLocated
=
true
;
}
},
function
(
error
)
{
console
.
log
(
"LOCATING ERROR "
,
error
);
});
}
/* Calculate Distance between points */
$scope
.
getDistanceFromLatLonInKm
=
function
(
lat1
,
lon1
,
lat2
,
lon2
)
{
var
R
=
6371
;
// Radius of the earth in km
var
dLat
=
deg2rad
(
lat2
-
lat1
);
// deg2rad function
var
dLon
=
deg2rad
(
lon2
-
lon1
);
var
a
=
Math
.
sin
(
dLat
/
2
)
*
Math
.
sin
(
dLat
/
2
)
+
Math
.
cos
(
deg2rad
(
lat1
))
*
Math
.
cos
(
deg2rad
(
lat2
))
*
Math
.
sin
(
dLon
/
2
)
*
Math
.
sin
(
dLon
/
2
);
var
c
=
2
*
Math
.
atan2
(
Math
.
sqrt
(
a
),
Math
.
sqrt
(
1
-
a
));
var
d
=
R
*
c
;
// Distance in km
console
.
log
(
"[ DISTANCE BETWEEN COORDINDATES ]"
,
d
);
return
d
;
}
function
deg2rad
(
deg
)
{
return
deg
*
(
Math
.
PI
/
180
)
}
/* MAIN ALGORITHM */
var
tripStatusRef
=
false
;
$scope
.
getUserLocation
=
function
()
{
console
.
debug
(
"********** Trip Location **********"
);
var
posOptions
=
{
enableHighAccuracy
:
true
};
$cordovaGeolocation
.
getCurrentPosition
(
posOptions
).
then
(
function
(
position
)
{
console
.
log
(
"[ CURRENT LOCATION ]"
,
position
.
coords
);
if
(
!
tripStatusRef
)
{
$scope
.
drawLineTrack
(
position
.
coords
.
latitude
,
position
.
coords
.
longitude
);
// INITIAL LINE ON TRIP
tripStatusRef
=
true
;
}
// Filter Coordinates Distance Method
var
locationData
=
{
lat
:
position
.
coords
.
latitude
,
lng
:
position
.
coords
.
longitude
}
if
(
logCoordinates
.
length
>
0
)
// CHECK IF ARAY IS EMPTY
{
if
(
$scope
.
getDistanceFromLatLonInKm
(
locationData
.
lat
,
locationData
.
lng
,
logCoordinates
[
0
].
lat
,
logCoordinates
[
0
].
lng
)
>
0.03
)
{
logCoordinates
.
splice
(
0
,
0
,
locationData
);
console
.
log
(
"[ LOCATION ARRAY ]"
,
logCoordinates
);
$scope
.
drawLineTrack
(
position
.
coords
.
latitude
,
position
.
coords
.
longitude
);
// DRAW LINE ON TRIP
}
else
{
console
.
error
(
"[ You need to be 500 meters away from your current position ]"
,
logCoordinates
);
}
}
else
{
logCoordinates
.
splice
(
0
,
0
,
locationData
);
console
.
log
(
"[ INITIAL LOCATION ARRAY ]"
,
logCoordinates
);
}
},
function
(
error
)
{
console
.
error
(
"GENERAL LOCATION ERROR "
,
error
);
});
}
$scope
.
refreshMap
=
function
()
{
console
.
debug
(
"********** Refresh Map **********"
);
if
(
userLocated
==
true
)
{
map
.
removeLayer
(
markers
);
map
.
removeLayer
(
circle
);
map
.
removeLayer
(
geojsonLayer
);
// map.removeLayer(line);
console
.
log
(
"Map refreshed. Layers Removed"
);
userLocated
=
false
;
}
$scope
.
initializedLocateUser
();
$scope
.
clearPolylines
();
}
/* CONFIRM TRIP DESTINATION */
$scope
.
confirmTripDestination
=
function
()
{
var
tripPopup
=
$ionicPopup
.
show
({
title
:
'Trip Destination'
,
subTitle
:
'Select your destination'
,
scope
:
$scope
,
buttons
:
[{
text
:
'School'
,
type
:
'button-dark button-outline'
,
onTap
:
function
()
{
localStorage
.
setItem
(
"currentTrip"
,
'trip2'
);
$scope
.
tripStart
();
console
.
log
(
'Destination to School'
);
}
},
{
text
:
'Home'
,
type
:
'button-dark button-outline'
,
onTap
:
function
()
{
localStorage
.
setItem
(
"currentTrip"
,
'trip1'
);
$scope
.
tripStart
();
console
.
log
(
'Destination to Home'
);
}
}
]
});
}
/* SET SEARCH BARANGAY */
$scope
.
BarangayList
=
{};
$scope
.
getAllBarangay
=
function
()
{
console
.
debug
(
"******* GET ALL BARANGAY ******"
);
getBlazer
.
getAllBarangay
().
then
(
function
(
data
)
{
$scope
.
BarangayList
=
data
;
console
.
log
(
"[ Barangay Data ]"
,
JSON
.
stringify
(
$scope
.
BarangayList
));
});
}
$scope
.
selectedBarangayData
=
''
;
$scope
.
currentBarangay
=
''
;
$scope
.
currentBarangayTime
=
''
;
$scope
.
onLoadSelection
=
function
()
{
$scope
.
data
=
{};
// An elaborate, custom popup
var
myPopup
=
$ionicPopup
.
show
({
template
:
'<label class="input-label">Barangay</label><label class="item item-input item-select"><div class="input-label"></div><select ng-model="data.selectedBarangay"><option ng-repeat = "barangay in BarangayList" value="{{barangay.name}}">{{barangay.name}}</option></select></label><label class="input-label">Time</label><label class="item item-input item-select"><div class="input-label"></div><select ng-model="data.selectedBarangayTime"><option value="AM">AM Trips</option><option value="PM">PM Trips</option></select></label>'
,
title
:
'Select your Barangay'
,
subTitle
:
'To view the most COMMON MODE of transportation in your barangay.'
,
scope
:
$scope
,
buttons
:
[{
text
:
'Select'
,
type
:
'button-dark button-outline'
,
onTap
:
function
(
e
)
{
console
.
log
(
"[ SELECT DATA ]"
,
$scope
.
data
.
selectedBarangay
+
" "
+
$scope
.
data
.
selectedBarangayTime
);
// LOAD MAP FUNCTIONS
$scope
.
selectedBarangayData
=
$scope
.
data
.
selectedBarangay
+
" "
+
$scope
.
data
.
selectedBarangayTime
;
$scope
.
currentBarangay
=
$scope
.
data
.
selectedBarangay
;
$scope
.
currentBarangayTime
=
$scope
.
data
.
selectedBarangayTime
;
$scope
.
data
=
{};
}
},
{
text
:
'Cancel'
,
type
:
'button-dark button-outline'
,
onTap
:
function
(
e
)
{
console
.
log
(
"[ LOAD BARANGAY CANCELLED ]"
)
}
}
]
});
}
/* CHART JS DATA */
$scope
.
BarangayData
=
{};
$scope
.
loadBarangayData
=
function
()
{
console
.
debug
(
"********** Get Barangay Data **********"
);
var
barangayinfo
=
{
"barangay"
:
$scope
.
currentBarangay
,
"time"
:
$scope
.
currentBarangayTime
};
postBlazer
.
BarangayInformation
(
barangayinfo
)
.
success
(
function
(
response
)
{
console
.
log
(
" BARANGAY SUCCESS"
,
response
);
$scope
.
BarangayData
=
response
;
console
.
log
(
'[ BARANGAY DETAILS ]'
,
JSON
.
stringify
(
$scope
.
BarangayData
));
$scope
.
openChart
(
$scope
.
BarangayData
);
// LOAD CHART MODAL
$scope
.
drawMarkers
(
$scope
.
BarangayData
.
lat
,
$scope
.
BarangayData
.
lng
,
$scope
.
currentBarangay
);
// RESET VALUES
$scope
.
selectedBarangayData
=
''
;
$scope
.
currentBarangay
=
''
;
$scope
.
currentBarangayTime
=
''
;
})
.
error
(
function
(
response
)
{
console
.
error
(
"BARANGAY ERROR"
,
response
);
});
}
$scope
.
labels
=
[
"Car"
,
"Tricycle"
,
"Pedicab"
,
"Jeep"
,
"Bus"
,
"Van"
,
"Walk"
,
"Carpool"
,
"Bicycle"
,
"Train"
,
"Taxi"
];
$scope
.
data
=
[
[
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
]
];
$scope
.
value
=
''
;
$scope
.
loadValue
=
function
(
val
){
$scope
.
value
=
val
;
}
$ionicModal
.
fromTemplateUrl
(
'app/map/modal/graph.html'
,
{
scope
:
$scope
,
animation
:
'slide-in-up'
}).
then
(
function
(
modal
)
{
$scope
.
modalChart
=
modal
;
});
/* MODAL LISTENER */
$scope
.
$on
(
'modal.hidden'
,
function
()
{
console
.
log
(
"Modal is Hidden"
);
$scope
.
labels
=
[
"Car"
,
"Tricycle"
,
"Pedicab"
,
"Jeep"
,
"Bus"
,
"Van"
,
"Walk"
,
"Carpool"
,
"Bicycle"
,
"Train"
,
"Taxi"
];
$scope
.
data
=
[
[
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
]
];
});
$scope
.
openChart
=
function
(
data
)
{
$scope
.
modalChart
.
show
();
console
.
log
(
"[ CHART DATA ]"
,
data
);
$scope
.
labels
=
[
"Car"
,
"Tricycle"
,
"Pedicab"
,
"Jeep"
,
"Bus"
,
"Van"
,
"Walk"
,
"Carpool"
,
"Bicycle"
,
"Train"
,
"Taxi"
];
$scope
.
data
=
[
[
data
.
car
,
data
.
tricycle
,
data
.
pedicab
,
data
.
jeep
,
data
.
bus
,
data
.
van
,
data
.
walk
,
data
.
carpool
,
data
.
bicycle
,
data
.
train
,
data
.
taxi
]
];
};
$scope
.
closeChart
=
function
()
{
$scope
.
modalChart
.
hide
();
};
/* START TRIP */
$scope
.
tripStatus
=
false
;
var
startTime
,
endTime
;
var
intervalTrigger
;
userLocated
=
false
;
$scope
.
tripStart
=
function
(){
map
.
removeLayer
(
markers
);
map
.
removeLayer
(
circle
);
map
.
removeLayer
(
geojsonLayer
);
$scope
.
tripStatus
=
true
;
var
newDate
=
new
Date
();
startTime
=
newDate
.
getTime
();
localStorage
.
setItem
(
"starttime"
,
startTime
);
console
.
log
(
"START TRIP TIME"
,
startTime
);
$scope
.
getUserLocation
();
intervalTrigger
=
$interval
(
$scope
.
getUserLocation
,
1000
);
// START FUNCTION CALL 'LOOP''
}
/* END TRIP */
$scope
.
tripEnd
=
function
(){
/* CHECK IF MOBILE IS ONLINE */
console
.
log
(
"[ NETWORK STATUS ]"
,
$cordovaNetwork
.
getNetwork
());
if
(
$cordovaNetwork
.
getNetwork
()
==
Connection
.
WIFI
||
$cordovaNetwork
.
getNetwork
()
==
Connection
.
CELL_2G
||
$cordovaNetwork
.
getNetwork
()
==
Connection
.
CELL_3G
||
$cordovaNetwork
.
getNetwork
()
==
Connection
.
CELL_4G
){
$scope
.
tripStatus
=
false
;
tripStatusRef
=
false
;
var
newDate
=
new
Date
();
var
endTime
=
newDate
.
getTime
();
localStorage
.
setItem
(
"endtime"
,
endTime
);
console
.
log
(
"END TRIP TIME"
,
endTime
);
// TRIGGER CLEAR FUNCTION OF REMOVE LINE -- NEEDS TO DEBUG
$scope
.
clearPolylines
();
map
.
removeLayer
(
line
);
// REMOVE LINE TRACK
parsedData
=
[];
// CLEAR BLAZER MARKER ARRAY
$interval
.
cancel
(
intervalTrigger
);
// CANCEL FUNCTION CALL
$scope
.
sendTrackingLocation
();
// SEND LOCATION DATA
$scope
.
openEndTripSurvey
();
// OPEN END TRIP SURVEY
}
else
{
$cordovaDialogs
.
alert
(
'You need to be ONLINE before ending this trip. Thank you.'
,
'Ooops'
,
"OKAY"
);
}
}
/* SEND LOCATION DATA */
$scope
.
sendTrackingLocation
=
function
(){
var
username
=
localStorage
.
getItem
(
"username"
);
console
.
debug
(
"********** Send Tracking Location **********"
);
postBlazer
.
LogTrip
(
logCoordinates
,
username
)
.
success
(
function
(
response
)
{
console
.
log
(
"LOG TRIP SUCCESS"
,
response
);
coordinates
=
[];
logCoordinates
=
[];
})
.
error
(
function
(
response
)
{
console
.
error
(
"LOG TRIP ERROR"
,
response
);
});
}
/* LOAD HEATMAP */
$scope
.
loadHeatMap
=
function
(){
console
.
debug
(
"********** Load Heat Map **********"
);
}
/* Show Blazers Data */
$scope
.
blazersData
=
{};
$scope
.
getBlazersData
=
function
(){
getBlazer
.
getBlazerDataInfo
().
then
(
function
(
data
){
$scope
.
blazersData
=
data
;
console
.
log
(
"[ Blazer Data ]"
,
JSON
.
stringify
(
$scope
.
blazersData
));
$scope
.
plotBlazers
();
});
}
/* Plot Blazers Data on Map */
var
parsedData
=
[];
var
geojsonLayer
=
[];
$scope
.
plotBlazers
=
function
(){
console
.
debug
(
"********** Plot Blazers on Map **********"
);
parsedData
=
[];
angular
.
forEach
(
$scope
.
blazersData
,
function
(
value
,
key
)
{
console
.
log
(
"[ VALUE SCOPE ]"
,
JSON
.
stringify
(
value
));
var
formatData
=
{
"type"
:
"Feature"
,
"properties"
:
{
"username"
:
"Anonymous Blazer"
,
},
"geometry"
:
{
"type"
:
"Point"
,
"coordinates"
:
[
value
.
longitude
,
value
.
latitude
]
}
}
parsedData
.
push
(
formatData
);
});
// Map Icon Options
// ICON
// var iconOptions = L.icon({
// iconUrl: 'img/mapicon.png',
// iconSize: [35, 37],
// iconAnchor: [18, 2]
// });
// POINTS
var
iconOptions
=
{
radius
:
8
,
fillColor
:
"green"
,
color
:
"green"
,
weight
:
1
,
opacity
:
1
,
fillOpacity
:
0.8
};
// PLOT DATA
function
onEachFeature
(
feature
,
layer
)
{
if
(
feature
.
properties
&&
feature
.
properties
.
username
)
{
layer
.
bindPopup
(
'<div class="pop-up-containter">Blazer</h4><div style="font-size: 15px">'
+
feature
.
properties
.
username
+
'</div></div>'
);
}
}
geojsonLayer
=
L
.
geoJson
(
parsedData
,
{
onEachFeature
:
onEachFeature
,
pointToLayer
:
function
(
feature
,
latlng
)
{
return
L
.
circleMarker
(
latlng
,
iconOptions
);
}
}).
addTo
(
map
);
map
.
fitBounds
(
geojsonLayer
.
getBounds
());
}
/* Weekly Survey Call */
$scope
.
loadWeeklySurvey
=
function
(){
console
.
debug
(
"********** Open Weekly Survey **********"
);
var
newDate
=
new
Date
();
var
currentDate
=
$filter
(
'date'
)(
newDate
,
'yyyyMMww'
);
var
dayToday
=
$filter
(
'date'
)(
newDate
,
'EEEE'
);
console
.
log
(
"[ Date Today ]"
,
currentDate
);
if
(
dayToday
==
'Friday'
||
dayToday
==
'Saturday'
){
if
(
localStorage
.
getItem
(
currentDate
)
===
null
){
var
tripPopup
=
$ionicPopup
.
show
({
title
:
'Hey it
\'
s '
+
dayToday
+
'!'
,
subTitle
:
'Take the weekly survey. You are awesome!'
,
scope
:
$scope
,
buttons
:
[
{
text
:
'Let
\
s go!'
,
type
:
'button-dark button-outline'
,
onTap
:
function
(
e
)
{
console
.
log
(
"[ TAKE WEEKLY SURVEY ]"
);
$scope
.
openWeeklySurvey
();
}
},
{
text
:
'Later'
,
type
:
'button-dark button-outline'
,
onTap
:
function
(
e
)
{
console
.
log
(
"[ NO WEEKLY SURVEY ]"
)
}
}
]
});
}
}
}
$scope
.
triggerWeeklySurvey
=
function
(){
console
.
debug
(
"********** Trigger Weekly Survey **********"
);
var
newDate
=
new
Date
();
var
currentDate
=
$filter
(
'date'
)(
newDate
,
'yyyyMMww'
);
var
dayToday
=
$filter
(
'date'
)(
newDate
,
'EEEE'
);
console
.
log
(
"[ Date Today ]"
,
currentDate
);
if
(
localStorage
.
getItem
(
currentDate
)
===
null
){
var
tripPopup
=
$ionicPopup
.
show
({
title
:
'Hey it
\'
s '
+
dayToday
+
'!'
,
subTitle
:
'Take the weekly survey. You are awesome!'
,
scope
:
$scope
,
buttons
:
[
{
text
:
'Let
\
s go!'
,
type
:
'button-dark button-outline'
,
onTap
:
function
(
e
)
{
console
.
log
(
"[ TAKE WEEKLY SURVEY ]"
);
$scope
.
openWeeklySurvey
();
}
},
{
text
:
'Later'
,
type
:
'button-dark button-outline'
,
onTap
:
function
(
e
)
{
console
.
log
(
"[ NO WEEKLY SURVEY ]"
)
}
}
]
});
}
else
{
$cordovaDialogs
.
alert
(
'You
\'
ve already taken this weeks
\'
weekly survey. Thank you.'
,
'Weekly Survey'
,
"OKAY"
);
}
}
/* Popover Methods */
$ionicPopover
.
fromTemplateUrl
(
'app/map/popover/map-popover.html'
,
{
scope
:
$scope
}).
then
(
function
(
popover
)
{
$scope
.
popover
=
popover
;
});
$scope
.
openPopover
=
function
(
$event
)
{
$scope
.
popover
.
show
(
$event
);
console
.
log
(
"OPEN POPOVER"
);
};
$scope
.
closePopover
=
function
()
{
$scope
.
popover
.
hide
();
};
$scope
.
$on
(
'$destroy'
,
function
()
{
$scope
.
popover
.
remove
();
});
// EndTrip Modal
$ionicModal
.
fromTemplateUrl
(
'app/survey/endtrip.html'
,
{
scope
:
$scope
,
animation
:
'slide-in-up'
}).
then
(
function
(
modal
)
{
$scope
.
modalEndTrip
=
modal
;
});
$scope
.
openEndTripSurvey
=
function
()
{
$scope
.
modalEndTrip
.
show
();
};
// Weekly Survey Modal
$ionicModal
.
fromTemplateUrl
(
'app/survey/weekly.html'
,
{
scope
:
$scope
,
animation
:
'slide-in-up'
}).
then
(
function
(
modal
)
{
$scope
.
modalWeeklyTrip
=
modal
;
});
$scope
.
openWeeklySurvey
=
function
()
{
$scope
.
modalWeeklyTrip
.
show
();
};
$scope
.
value
=
''
;
$scope
.
loadValue
=
function
(
val
)
{
$scope
.
value
=
val
;
}
$ionicModal
.
fromTemplateUrl
(
'app/map/modal/graph.html'
,
{
scope
:
$scope
,
animation
:
'slide-in-up'
}).
then
(
function
(
modal
)
{
$scope
.
modalChart
=
modal
;
});
/* MODAL LISTENER */
$scope
.
$on
(
'modal.hidden'
,
function
()
{
console
.
log
(
"Modal is Hidden"
);
$scope
.
labels
=
[
"Car"
,
"Tricycle"
,
"Pedicab"
,
"Jeep"
,
"Bus"
,
"Van"
,
"Walk"
,
"Carpool"
,
"Bicycle"
,
"Train"
,
"Taxi"
];
$scope
.
data
=
[
[
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
]
];
});
$scope
.
openChart
=
function
(
data
)
{
$scope
.
modalChart
.
show
();
console
.
log
(
"[ CHART DATA ]"
,
data
);
$scope
.
labels
=
[
"Car"
,
"Tricycle"
,
"Pedicab"
,
"Jeep"
,
"Bus"
,
"Van"
,
"Walk"
,
"Carpool"
,
"Bicycle"
,
"Train"
,
"Taxi"
];
$scope
.
data
=
[
[
data
.
car
,
data
.
tricycle
,
data
.
pedicab
,
data
.
jeep
,
data
.
bus
,
data
.
van
,
data
.
walk
,
data
.
carpool
,
data
.
bicycle
,
data
.
train
,
data
.
taxi
]
];
};
$scope
.
closeChart
=
function
()
{
$scope
.
modalChart
.
hide
();
};
/* START TRIP */
$scope
.
tripStatus
=
false
;
var
startTime
,
endTime
;
var
intervalTrigger
;
userLocated
=
false
;
$scope
.
tripStart
=
function
()
{
map
.
removeLayer
(
markers
);
map
.
removeLayer
(
circle
);
map
.
removeLayer
(
geojsonLayer
);
$scope
.
tripStatus
=
true
;
var
newDate
=
new
Date
();
startTime
=
newDate
.
getTime
();
localStorage
.
setItem
(
"starttime"
,
startTime
);
console
.
log
(
"START TRIP TIME"
,
startTime
);
$scope
.
getUserLocation
();
intervalTrigger
=
$interval
(
$scope
.
getUserLocation
,
1000
);
// START FUNCTION CALL 'LOOP''
}
/* END TRIP */
$scope
.
tripEnd
=
function
()
{
/* CHECK IF MOBILE IS ONLINE */
console
.
log
(
"[ NETWORK STATUS ]"
,
$cordovaNetwork
.
getNetwork
());
if
(
$cordovaNetwork
.
getNetwork
()
==
Connection
.
WIFI
||
$cordovaNetwork
.
getNetwork
()
==
Connection
.
CELL_2G
||
$cordovaNetwork
.
getNetwork
()
==
Connection
.
CELL_3G
||
$cordovaNetwork
.
getNetwork
()
==
Connection
.
CELL_4G
)
{
$scope
.
tripStatus
=
false
;
tripStatusRef
=
false
;
var
newDate
=
new
Date
();
var
endTime
=
newDate
.
getTime
();
localStorage
.
setItem
(
"endtime"
,
endTime
);
console
.
log
(
"END TRIP TIME"
,
endTime
);
// TRIGGER CLEAR FUNCTION OF REMOVE LINE -- NEEDS TO DEBUG
$scope
.
clearPolylines
();
map
.
removeLayer
(
line
);
// REMOVE LINE TRACK
parsedData
=
[];
// CLEAR BLAZER MARKER ARRAY
$interval
.
cancel
(
intervalTrigger
);
// CANCEL FUNCTION CALL
$scope
.
sendTrackingLocation
();
// SEND LOCATION DATA
$scope
.
openEndTripSurvey
();
// OPEN END TRIP SURVEY
}
else
{
$cordovaDialogs
.
alert
(
'You need to be ONLINE before ending this trip. Thank you.'
,
'Ooops'
,
"OKAY"
);
}
}
/* SEND LOCATION DATA */
$scope
.
sendTrackingLocation
=
function
()
{
var
username
=
localStorage
.
getItem
(
"username"
);
console
.
debug
(
"********** Send Tracking Location **********"
);
postBlazer
.
LogTrip
(
logCoordinates
,
username
)
.
success
(
function
(
response
)
{
console
.
log
(
"LOG TRIP SUCCESS"
,
response
);
coordinates
=
[];
logCoordinates
=
[];
})
.
error
(
function
(
response
)
{
console
.
error
(
"LOG TRIP ERROR"
,
response
);
});
}
/* LOAD HEATMAP */
$scope
.
loadHeatMap
=
function
()
{
console
.
debug
(
"********** Load Heat Map **********"
);
}
/* Show Blazers Data */
$scope
.
blazersData
=
{};
$scope
.
getBlazersData
=
function
()
{
getBlazer
.
getBlazerDataInfo
().
then
(
function
(
data
)
{
$scope
.
blazersData
=
data
;
console
.
log
(
"[ Blazer Data ]"
,
JSON
.
stringify
(
$scope
.
blazersData
));
$scope
.
plotBlazers
();
});
}
/* Plot Blazers Data on Map */
var
parsedData
=
[];
var
geojsonLayer
=
[];
$scope
.
plotBlazers
=
function
()
{
console
.
debug
(
"********** Plot Blazers on Map **********"
);
parsedData
=
[];
angular
.
forEach
(
$scope
.
blazersData
,
function
(
value
,
key
)
{
console
.
log
(
"[ VALUE SCOPE ]"
,
JSON
.
stringify
(
value
));
var
formatData
=
{
"type"
:
"Feature"
,
"properties"
:
{
"username"
:
"Anonymous Blazer"
,
},
"geometry"
:
{
"type"
:
"Point"
,
"coordinates"
:
[
value
.
longitude
,
value
.
latitude
]
}
}
parsedData
.
push
(
formatData
);
});
// Map Icon Options
// ICON
// var iconOptions = L.icon({
// iconUrl: 'img/mapicon.png',
// iconSize: [35, 37],
// iconAnchor: [18, 2]
// });
// POINTS
var
iconOptions
=
{
radius
:
8
,
fillColor
:
"green"
,
color
:
"green"
,
weight
:
1
,
opacity
:
1
,
fillOpacity
:
0.8
};
// PLOT DATA
function
onEachFeature
(
feature
,
layer
)
{
if
(
feature
.
properties
&&
feature
.
properties
.
username
)
{
layer
.
bindPopup
(
'<div class="pop-up-containter">Blazer</h4><div style="font-size: 15px">'
+
feature
.
properties
.
username
+
'</div></div>'
);
}
}
geojsonLayer
=
L
.
geoJson
(
parsedData
,
{
onEachFeature
:
onEachFeature
,
pointToLayer
:
function
(
feature
,
latlng
)
{
return
L
.
circleMarker
(
latlng
,
iconOptions
);
}
}).
addTo
(
map
);
map
.
fitBounds
(
geojsonLayer
.
getBounds
());
}
/* Weekly Survey Call */
$scope
.
loadWeeklySurvey
=
function
()
{
console
.
debug
(
"********** Open Weekly Survey **********"
);
var
newDate
=
new
Date
();
var
currentDate
=
$filter
(
'date'
)(
newDate
,
'yyyyMMww'
);
var
dayToday
=
$filter
(
'date'
)(
newDate
,
'EEEE'
);
console
.
log
(
"[ Date Today ]"
,
currentDate
);
if
(
dayToday
==
'Friday'
||
dayToday
==
'Saturday'
)
{
if
(
localStorage
.
getItem
(
currentDate
)
===
null
)
{
var
tripPopup
=
$ionicPopup
.
show
({
title
:
'Hey it
\'
s '
+
dayToday
+
'!'
,
subTitle
:
'Take the weekly survey. You are awesome!'
,
scope
:
$scope
,
buttons
:
[{
text
:
'Let
\
s go!'
,
type
:
'button-dark button-outline'
,
onTap
:
function
(
e
)
{
console
.
log
(
"[ TAKE WEEKLY SURVEY ]"
);
$scope
.
openWeeklySurvey
();
}
},
{
text
:
'Later'
,
type
:
'button-dark button-outline'
,
onTap
:
function
(
e
)
{
console
.
log
(
"[ NO WEEKLY SURVEY ]"
)
}
}
]
});
}
}
}
$scope
.
triggerWeeklySurvey
=
function
()
{
console
.
debug
(
"********** Trigger Weekly Survey **********"
);
var
newDate
=
new
Date
();
var
currentDate
=
$filter
(
'date'
)(
newDate
,
'yyyyMMww'
);
var
dayToday
=
$filter
(
'date'
)(
newDate
,
'EEEE'
);
console
.
log
(
"[ Date Today ]"
,
currentDate
);
if
(
localStorage
.
getItem
(
currentDate
)
===
null
)
{
var
tripPopup
=
$ionicPopup
.
show
({
title
:
'Hey it
\'
s '
+
dayToday
+
'!'
,
subTitle
:
'Take the weekly survey. You are awesome!'
,
scope
:
$scope
,
buttons
:
[{
text
:
'Let
\
s go!'
,
type
:
'button-dark button-outline'
,
onTap
:
function
(
e
)
{
console
.
log
(
"[ TAKE WEEKLY SURVEY ]"
);
$scope
.
openWeeklySurvey
();
}
},
{
text
:
'Later'
,
type
:
'button-dark button-outline'
,
onTap
:
function
(
e
)
{
console
.
log
(
"[ NO WEEKLY SURVEY ]"
)
}
}
]
});
}
else
{
$cordovaDialogs
.
alert
(
'You
\'
ve already taken this weeks
\'
weekly survey. Thank you.'
,
'Weekly Survey'
,
"OKAY"
);
}
}
/* Popover Methods */
$ionicPopover
.
fromTemplateUrl
(
'app/map/popover/map-popover.html'
,
{
scope
:
$scope
}).
then
(
function
(
popover
)
{
$scope
.
popover
=
popover
;
});
$scope
.
openPopover
=
function
(
$event
)
{
$scope
.
popover
.
show
(
$event
);
console
.
log
(
"OPEN POPOVER"
);
};
$scope
.
closePopover
=
function
()
{
$scope
.
popover
.
hide
();
};
$scope
.
$on
(
'$destroy'
,
function
()
{
$scope
.
popover
.
remove
();
});
// EndTrip Modal
$ionicModal
.
fromTemplateUrl
(
'app/survey/endtrip.html'
,
{
scope
:
$scope
,
animation
:
'slide-in-up'
}).
then
(
function
(
modal
)
{
$scope
.
modalEndTrip
=
modal
;
});
$scope
.
openEndTripSurvey
=
function
()
{
$scope
.
modalEndTrip
.
show
();
};
// Weekly Survey Modal
$ionicModal
.
fromTemplateUrl
(
'app/survey/weekly.html'
,
{
scope
:
$scope
,
animation
:
'slide-in-up'
}).
then
(
function
(
modal
)
{
$scope
.
modalWeeklyTrip
=
modal
;
});
$scope
.
openWeeklySurvey
=
function
()
{
$scope
.
modalWeeklyTrip
.
show
();
};
});
\ No newline at end of file
www/app/menu/menu.html
View file @
a0fcfc32
<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/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/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
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment