diff --git a/app.js b/app.js
new file mode 100644
index 0000000..a8a3593
--- /dev/null
+++ b/app.js
@@ -0,0 +1,149 @@
+var app = angular.module(
+ "FoodLoop",
+ [
+ 'ngRoute',
+ 'ui.router'
+ ]
+);
+
+// calling order
+// 1-> app.config()
+// 2-> app.run()
+// 3-> directive's compile functions (if they are found in the dom)
+// 4-> app.controller()
+// 5-> directive's link functions (again, if found)
+
+
+app.config(function($stateProvider, $urlRouterProvider) {
+ // use $urlRouterProvider to catch all the illeage cases
+ // $urlRouterProvider.otherwise("/login");
+
+ $stateProvider
+ // if loggin as user
+ .state('user',{
+ url:"/user",
+ views:{
+ '': {templateUrl:'pages/home/home.html',controller:'userCtrl'},
+ 'header@user': {templateUrl:'pages/user/header.user.html'}, // nested view
+ 'sidebar@user': {templateUrl:'pages/user/sidebar.user.html'},
+ 'main@user': {templateUrl:'pages/user/main.user.html'},
+ },data:{
+ requireLogin: false
+ }
+ })
+ .state('user.receipt',{
+ url:"",
+ views:{
+ 'main@user': {templateUrl:'pages/receipt/receipt.html',controller:"receiptCtrl"},
+ }
+ })
+ .state('user.leaderboard',{
+ url:"",
+ views:{
+ 'main@user': {templateUrl:'pages/user/main.leaderboard.html'},
+ }
+ })
+ .state('user.settings',{
+ url:"",
+ views:{
+ 'main@user': {templateUrl:'pages/user/main.settings.html'},
+ }
+ })
+ .state('user.help',{
+ url:"",
+ views:{
+ 'main@user': {templateUrl:'pages/user/main.settings.html'},
+ }
+ })
+ .state('admin.view_receipt',{
+ url:"",
+ params: {
+ receipt: null,
+ },
+ views:{
+ 'main@admin': {
+ templateUrl:'pages/admin/main.receipt.html',
+ controller: function($scope,$stateParams){
+ $scope.receipt = $stateParams.receipt;
+ console.log($scope.receipt);
+ }},
+ },data:{
+ requireLogin: false
+ }
+ }
+ )
+ .state('admin',{
+ url:"/admin",
+ controller: 'adminCtrl',
+ views:{
+ '': { templateUrl: 'pages/home/home.html',controller:'adminCtrl'}, // default view}
+ 'header@admin': {templateUrl:'pages/admin/header.admin.html'}, // nested view
+ 'sidebar@admin': {templateUrl:'pages/admin/sidebar.admin.html'},
+ 'main@admin': {templateUrl:'pages/admin/main.admin.html'},
+ },data:{
+ requireLogin: false
+ }
+ })
+ .state('trader',{
+ url:"/trader",
+ views:{
+ '': { templateUrl: 'pages/home/home.html',controller:'traderCtrl'}, // default view}
+ 'header@trader': {templateUrl:'pages/trader/header.trader.html'}, // nested view
+ 'sidebar@trader': {templateUrl:'pages/trader/sidebar.trader.html'},
+ 'main@trader': {templateUrl:'pages/trader/main.trader.html'},
+ },data:{
+ requireLogin: false
+ }
+ })
+
+ .state('map',{
+ url: '/map',
+ templateUrl: 'pages/map/map.html',
+ controller: 'mapCtrl',
+ data: {
+ requireLogin : false
+ }
+ })
+ .state('login',{
+ url: '',
+ templateUrl: 'pages/login/login.html',
+ controller: 'loginCtrl',
+ data: {
+ requireLogin : false
+ }
+ });
+
+});
+
+
+/* redirects to different page based on whether the user is login or not and */
+/* if log on, check user type and redirect/construct a custom dashboard page */
+/* to extend, users may have a custome dashboard with different layout, this */
+/* needs to be handled using HTML page which is specifically constucted by */
+/* page'controller and obtain variable setting from server */
+// /* if not, redirect to login in page */
+app.run(function ($rootScope,$state,authService) { // kickstart the application
+ // listening to the when a state change start
+ console.log("State changes");
+ $rootScope.$on('$stateChangeStart', function (event, toState, toParams) {
+ console.log(toState);
+ // var requireLogin = toState.data.requireLogin;
+ // redirect to login page if satisfy the following conditions
+ // 1. seesion expired and user tries to access a page
+ // if ((requireLogin && typeof $rootScope.currentUser === 'undefined')) {
+ // event.preventDefault();
+ // $state.transitionTo('login');
+ // }
+ });
+ // Testing, configuration to firebase
+ var config = {
+ apiKey: "AIzaSyDypwjmMD818GQTTfyhTpx76ChJpDsZGek",
+ authDomain: "foodloop-666db.firebaseapp.com",
+ databaseURL: "https://foodloop-666db.firebaseio.com",
+ storageBucket: "foodloop-666db.appspot.com",
+ messagingSenderId: "832579459759"
+ };
+ firebase.initializeApp(config);
+
+})
+
diff --git a/debug.log b/debug.log
new file mode 100644
index 0000000..eebd912
--- /dev/null
+++ b/debug.log
@@ -0,0 +1,2 @@
+[0212/144844:ERROR:tcp_listen_socket.cc(76)] Could not bind socket to 127.0.0.1:6004
+[0212/144844:ERROR:node_debugger.cc(86)] Cannot start debugger server
diff --git a/index.html b/index.html
new file mode 100644
index 0000000..a40bae9
--- /dev/null
+++ b/index.html
@@ -0,0 +1,75 @@
+
+
+
+
+
+
+
+
+ FoodLoop Login
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/pages/admin/admin.html b/pages/admin/admin.html
new file mode 100644
index 0000000..b3514c6
--- /dev/null
+++ b/pages/admin/admin.html
@@ -0,0 +1,3 @@
+
+
+
diff --git a/pages/admin/adminCtrl.js b/pages/admin/adminCtrl.js
new file mode 100644
index 0000000..1fcfdf9
--- /dev/null
+++ b/pages/admin/adminCtrl.js
@@ -0,0 +1,67 @@
+/* this controller specifies the logic layer of the admin page */
+/* including the content to be display, sidebar, header */
+/* functionailities involve for an admin */
+app.controller('adminCtrl', function($scope,$state) {
+ $scope.users;
+ $scope.controllby = "admin";
+ // Initialize Firebase
+ $scope.pending_receipt_sum = 2;
+ $scope.pending_receipt = [
+ {
+ receipt_ref: "r1",
+ submitted_by : "John Lemon",
+ submitted_time: "31",
+ submitted_amount: "8.66",
+ details: "sjadsjoiadsj iasdn aisdn alsdi jadi jasdi ajsdoi ndi snd"
+ }
+ ,
+ {
+ submitted_by : "User007",
+ submitted_time: "21",
+ submitted_amount: "22.22"
+ }
+ ];
+
+
+ /* section for receipt management start * /
+ /* review a pending receipt */
+ /* fetch a list of pending receipt from server */
+ /* fetch a list of approve receipt from server */
+ $scope.reviewReceipt = function(myReceipt){
+ // testing
+ console.log("[DEBUG]: reviewReceipt called");
+ // show page for review this receipt
+ $state.go('admin.view_receipt', {receipt: myReceipt})
+ //
+
+ }
+
+ $scope.approve_receipt = function(receipt_ref){
+ // call api to approve a pending receipt
+ // notify user
+ }
+
+
+ $scope.fetch_pending_receipt = function(){
+
+ }
+
+ $scope.fetch_submitted_receipt = function(){
+
+ }
+ /* section for receipt management end */
+
+
+ // Get a reference to the database service
+ var database = firebase.database();
+ firebase.database().ref('/users/').once('value').then(function(snapshot) {
+ $scope.users = snapshot.val();
+ });
+
+ $scope.test = function(){
+
+ console.log("CLiced ");
+ console.log($scope.users);
+ }
+});
+
diff --git a/pages/admin/header.admin.html b/pages/admin/header.admin.html
new file mode 100644
index 0000000..1ba87f4
--- /dev/null
+++ b/pages/admin/header.admin.html
@@ -0,0 +1,27 @@
+
+
+
+
+ FoodLoop
+
+
+
\ No newline at end of file
diff --git a/pages/admin/main.admin.html b/pages/admin/main.admin.html
new file mode 100644
index 0000000..2a36196
--- /dev/null
+++ b/pages/admin/main.admin.html
@@ -0,0 +1,50 @@
+
+
+
+
+
+
+
+
+
+
+
+ Action
+ #
+ From
+ When
+ Amount
+
+
+
+
+
+ review
+ review
+
+ {{$index + 1}}
+ {{receipt.submitted_by}}
+ {{receipt.submitted_time}} minutes ago
+ £{{receipt.submitted_amount}}
+
+
+
+
+ {{receipt.details}}
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/pages/admin/main.receipt.html b/pages/admin/main.receipt.html
new file mode 100644
index 0000000..cdfa6c0
--- /dev/null
+++ b/pages/admin/main.receipt.html
@@ -0,0 +1,43 @@
+
+
+
+
+
+
+
+
+
+
+
+ #
+ From
+ When
+ Amount
+
+
+
+
+ {{$index + 1}}
+ {{receipt.submitted_by}}
+ {{receipt.submitted_time}} minutes ago
+ £{{receipt.submitted_amount}}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/pages/admin/sidebar.admin.html b/pages/admin/sidebar.admin.html
new file mode 100644
index 0000000..e8a423a
--- /dev/null
+++ b/pages/admin/sidebar.admin.html
@@ -0,0 +1,46 @@
+
+
diff --git a/pages/home/home.css b/pages/home/home.css
new file mode 100644
index 0000000..6780648
--- /dev/null
+++ b/pages/home/home.css
@@ -0,0 +1,353 @@
+/*
+ * Base structure
+ */
+
+/* Move down content because we have a fixed navbar that is 50px tall */
+body {
+ padding-top: 50px;
+ background-color: whitesmoke;
+}
+
+/*
+ * Typography
+ */
+
+h1 {
+ margin-bottom: 20px;
+ padding-bottom: 9px;
+ border-bottom: 1px solid #eee;
+}
+
+main{
+ background-color: whitesmoke;
+}
+/*
+ * Sidebar
+ */
+
+.sidebar {
+ position: fixed;
+ top: 51px;
+ bottom: 0;
+ left: 0;
+ z-index: 1000;
+ padding: 20px;
+ overflow-x: hidden;
+ overflow-y: auto; /* Scrollable contents if viewport is shorter than content. */
+ border-right: 1px solid #eee;
+ box-shadow: 0 4px 8px 0 rgba(0,0,0,0.2);
+
+}
+
+/* Sidebar navigation */
+.sidebar {
+ margin-top: -16px;
+ padding-left: 0;
+ padding-right: 0;
+}
+
+.sidebar .nav {
+ margin-bottom: 20px;
+}
+
+.sidebar .nav-item {
+ width: 100%;
+}
+
+.sidebar .nav-item + .nav-item {
+ margin-left: 0;
+}
+
+.sidebar .nav-link {
+ border-radius: 0;
+}
+
+.profile-pic {
+ border-radius: 80%;
+ background-color: transparent;
+ width: 100%;
+ height: 100%;
+ background-color: dodgerblue;
+
+}
+
+
+
+.profilePic{
+ padding: 16px;
+ background-color: transparent;
+ max-width: 100%;
+ height: 130px;
+ background-color: dodgerblue;
+}
+
+.profileInfo{
+ color:white;
+ padding: 16px;
+ padding-top: 30px;
+ height: 130px;
+ background-color: dodgerblue;
+}
+
+.profileTitle{
+ font-size: 0.8em;
+}
+
+/*
+ * Dashboard
+ */
+
+ /* Placeholders */
+.placeholders {
+ padding-bottom: 3rem;
+}
+
+.placeholder img {
+ padding-top: 1.5rem;
+ padding-bottom: 1.5rem;
+}
+.title{
+ color: black;
+}
+.flCard{
+ color:black;
+ box-shadow: 0 4px 8px 0 rgba(0,0,0,0.2);
+ transition: 0.3s;
+ border-radius: 3px;
+ font-size: 1em;
+ /*width: 100%;*/
+ height: 110px;;
+ margin-top: 16px;
+ background-color: white;
+ border: green;
+ padding:16px;
+
+}
+
+
+
+
+
+.rankCard{
+ color:black;
+ box-shadow: 0 4px 8px 0 rgba(0,0,0,0.2);
+ transition: 0.3s;
+ border-radius: 3px;
+ font-size: 1em;
+ height: 300px;;
+ margin-top: 16px;
+ background-color: white;
+ border: green;
+
+}
+
+.rankCardHeader{
+ border-radius: 3px 3px 0 0;
+ padding: 3px;
+ color:white;
+ height:30px;
+ background-color: dodgerblue;
+}
+
+.chartCardHeader{
+ border-radius: 3px 3px 0 0;
+ padding: 3px;
+ color:white;
+ height:30px;
+ background-color: orangered;
+}
+
+.rankCardContent{
+ padding: 3px;
+ /*color:white;*/
+ /*background-color: dodgerblue;*/
+}
+
+.flCardHeader{
+ height: 25px;
+}
+.flCardMain{
+ margin: -16px;
+ font-size: 3.0em;
+ color: dimgray;
+ text-align: center;
+}
+
+.chartCard{
+ color:black;
+ box-shadow: 0 4px 8px 0 rgba(0,0,0,0.2);
+ transition: 0.3s;
+ border-radius: 3px;
+ font-size: 1em;
+ height: 300px;;
+ margin-top: 16px;
+ background-color: white;
+
+}
+.flCardNote{
+ font-size: 0.8em;
+ color: dodgerblue;
+ text-align: right;
+}
+#receiptTable{
+ padding: 16px;
+}
+
+
+/* CSS FOR RECEIPT */
+
+.receiptItem{
+ color:black;
+ box-shadow: 0 2px 4px 0 rgba(0,0,0,0.2);
+ transition: 0.3s;
+ border-radius: 3px;
+ font-size: 1em;
+ padding: 16px;
+ background-color: white;
+}
+
+.receiptCard{
+ color:black;
+ box-shadow: 0 4px 8px 0 rgba(0,0,0,0.2);
+ transition: 0.3s;
+ border-radius: 3px;
+ font-size: 1em;
+ margin-top: 16px;
+ padding:16px;
+ background-color: white;
+}
+
+.receiptCardHeader{
+ border-radius: 3px 3px 0 0;
+ padding: 3px;
+ color:white;
+ padding: 16px;
+ background-color: dodgerblue;
+}
+
+
+.receiptDetailCard{
+ color:black;
+ box-shadow: 0 2px 4px 0 rgba(0,0,0,0.2);
+ transition: 0.3s;
+ border-radius: 3px;
+ font-size: 1em;
+ height: 300px;
+ margin-top: 16px;
+ background-color: lightcyan;
+}
+
+.addButton{
+ background-color: transparent;
+ font-size: 1.0em;
+ margin-left: 50%;
+
+}
+
+.dragImageBox:hover{
+ background-color: whitesmoke;
+}
+.dragImageBox{
+ border: 2px dashed dodgerblue;
+ border-radius: 4px;
+ background-color:white;
+ height: 150px;
+ transition: 0.3s;
+}
+
+
+.thumb{
+ color:black;
+ box-shadow: 0 2px 4px 0 rgba(0,0,0,0.2);
+ transition: 0.3s;
+ border-radius: 3px;
+ font-size: 1em;
+ background-color: white;
+ width: 50px;
+ height: 130px;
+}
+
+/* TEMPALTE CSS FOR DISPLAY A CUSTOM CARD */
+
+.pearCard{
+ color:black;
+ box-shadow: 0 2px 4px 0 rgba(0,0,0,0.2);
+ transition: 0.3s;
+ border-radius: 3px;
+ font-size: 1em;
+ background-color: white;
+}
+
+/* On mouse-over, add a deeper shadow */
+.pearCard:hover {
+ box-shadow: 0 4px 8px 0 rgba(0,0,0,0.2);
+}
+
+.pearCardFooter{
+ width: 100%;
+ margin-bottom: -16px;
+ background-color: lightcyan;
+}
+.pearAutoHeight{
+ height: auto;
+}
+.pearCardHeader{
+ border-radius: 3px 3px 0 0;
+ padding: 9px;
+ color:white;
+ background-color: dodgerblue;
+}
+
+.pearOrange{
+ background-color: orangered;
+}
+.pearBlue{
+ background-color: dodgerblue;
+}
+.pearGreen{
+ background-color: lawngreen;
+}
+.pearYellow{
+ background-color: yellow;
+}
+.pearPurple{
+ background-color: purple;
+}
+
+.padding16{
+ padding: 16px;
+}
+
+.margin16{
+ margin-top:16px;
+}
+
+
+
+/* LOGIN CSS */
+.mainSection{
+ margin-top: 20%;
+ padding:16px;
+ color:black;
+ box-shadow: 0 2px 4px 0 rgba(0,0,0,0.2);
+ transition: 0.3s;
+ border-radius: 3px;
+ font-size: 1em;
+ /*height: 150px;*/
+ background-color: white;
+}
+
+.mainItem{
+
+ padding: 16px;
+}
+
+.mainItem input[type=text] {
+ /*border: 2px solid ;*/
+ border-radius: 4px;
+}
+
+.mainItem input[type=password] {
+ /*border: 2px solid ;*/
+ border-radius: 4px;
+}
\ No newline at end of file
diff --git a/pages/home/home.html b/pages/home/home.html
new file mode 100644
index 0000000..37db6f8
--- /dev/null
+++ b/pages/home/home.html
@@ -0,0 +1,13 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/pages/home/homeCtrl.js b/pages/home/homeCtrl.js
new file mode 100644
index 0000000..24fa916
--- /dev/null
+++ b/pages/home/homeCtrl.js
@@ -0,0 +1,18 @@
+app.controller('homeCtrl', function($scope) {
+
+ // $stateProvider.state('contacts', {
+ // template: 'My Contacts '
+ // }) $scope.username = "user";
+ $scope.controllby = "home";
+
+ // $rootScope.userType = "admin";
+ // $scope.getViewByUserType = function(){
+ // return {
+ // '': {templateUrl: 'pages/home/home.html',controller:'adminCtrl'}, // default view
+ // 'header@home-admin': {templateUrl:'pages/admin/header.admin.html'}, // nested view
+ // 'sidebar@home-admin': {templateUrl:'pages/admin/sidebar.admin.html'},
+ // 'main@home-admin': {templateUrl:'pages/admin/main.admin.html'},
+ // }
+ // }
+ // $scope.header = "i m not a header";
+});
diff --git a/pages/login/login.html b/pages/login/login.html
new file mode 100644
index 0000000..903df87
--- /dev/null
+++ b/pages/login/login.html
@@ -0,0 +1,69 @@
+
+
+
+
+
+ Navbar
+
+
+
+
+
+
+
+
+
+
+ Username/Email
+
+
+
+
+
+
+
+
+
+
+ S2ign I1n
+
+ Create an account
+
+
+
+
+
+
+
+
+
diff --git a/pages/login/loginCtrl.js b/pages/login/loginCtrl.js
new file mode 100644
index 0000000..29e929c
--- /dev/null
+++ b/pages/login/loginCtrl.js
@@ -0,0 +1,49 @@
+app.controller('loginCtrl', function($scope,$state,$http,$rootScope,authService) {
+ /* login variables */
+ $scope.username = "user";
+ $scope.password = "Doe";
+ $scope.fullName = function() {
+ return $scope.firstName + " " + $scope.lastName;
+ };
+
+
+
+
+ // 1. send request to server to authenticate login information
+ // 2. on succeed, redirect to page
+ // 2.1 on failed, display error message
+ $scope.signin = function(){
+ var foodloop_token_url_login = "http://192.168.2.172:3000/login";
+ var loginData = JSON.stringify({
+ email : this.username,
+ password: this.password
+ });
+ console.log("Attempting to login in");
+
+ $http.post(foodloop_token_url_login,loginData).success(function(repsonse){
+ console.log("Resolving response from server");
+ console.log(repsonse.data);
+ },function(repsonse){
+ console.log("Ooops, Something went wrong");
+ });
+ authService.setUsername($scope.username);
+ // $state.go("user");
+ // if($scope.username === "admin"){
+ // $state.go('admin');
+ // }
+ // else if($scope.username === "user"){
+ // $state.go('user');
+ // }
+ // else{
+ // $state.go('home');
+ // }
+ }
+
+
+
+ $scope.createAccount = function(){
+
+ console.log("Create account button clicked");
+ }
+
+});
diff --git a/pages/map/circles.json b/pages/map/circles.json
new file mode 100644
index 0000000..8f55900
--- /dev/null
+++ b/pages/map/circles.json
@@ -0,0 +1,7 @@
+{"objects":[
+{"circle":{"coordinates":[54.0472, -2.8018]}},
+{"circle":{"coordinates":[-41.29,174.76]}},
+{"circle":{"coordinates":[-41.30,174.79]}},
+{"circle":{"coordinates":[-41.27,174.80]}},
+{"circle":{"coordinates":[-41.29,174.78]}}
+]}
\ No newline at end of file
diff --git a/pages/map/map.css b/pages/map/map.css
new file mode 100644
index 0000000..ecd882d
--- /dev/null
+++ b/pages/map/map.css
@@ -0,0 +1,3 @@
+#mapid { height: 180px; }
+
+#map { width:600px; height: 600px }
\ No newline at end of file
diff --git a/pages/map/map.html b/pages/map/map.html
new file mode 100644
index 0000000..0d15c99
--- /dev/null
+++ b/pages/map/map.html
@@ -0,0 +1,15 @@
+
+
+
\ No newline at end of file
diff --git a/pages/map/mapCtrl.js b/pages/map/mapCtrl.js
new file mode 100644
index 0000000..bd0f2cc
--- /dev/null
+++ b/pages/map/mapCtrl.js
@@ -0,0 +1,61 @@
+app.controller('mapCtrl',function($scope,$http,uploadReceiptService) {
+
+
+ // data
+ var traderGeoData = [
+ { Latitude:54.04,Longitude:2.80,trader:"sample_1" },
+ { Latitude:54.04,Longitude:2.80,trader:"sample_2" },
+ { Latitude:54.01,Longitude:2.78,trader:"sample_3" },
+ ];
+
+ var map = L.map('map').setView([54.0472, -2.8018], 13);
+ mapLink =
+ 'OpenStreetMap ';
+ L.tileLayer(
+ 'http://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', {
+ attribution: '© ' + mapLink + ' Contributors',
+ maxZoom: 18,
+ }).addTo(map);
+
+var svgLayer = L.svg();
+svgLayer.addTo(map);
+
+var svg = d3.select("#map").select("svg");
+var g = d3.select("#map").select("svg").select('g');
+g.attr("class", "leaflet-zoom-hide");
+
+
+ /* We simply pick up the SVG from the map object */
+ var svg = d3.select("#map").select("svg"),
+ g = svg.append("g");
+
+ d3.json("../pages/map/circles.json", function(collection) {
+ /* Add a LatLng object to each item in the dataset */
+ collection.objects.forEach(function(d) {
+ d.LatLng = new L.LatLng(d.circle.coordinates[0],
+ d.circle.coordinates[1])
+ })
+
+ var feature = g.selectAll("circle")
+ .data(collection.objects)
+ .enter().append("circle")
+ .style("stroke", "black")
+ .style("opacity", .6)
+ .style("fill", "red")
+ .attr("r", 20);
+
+ map.on("viewreset", update);
+ update();
+
+ function update() {
+ console.log("update!");
+ feature.attr("transform",
+ function(d) {
+ return "translate("+
+ map.latLngToLayerPoint(d.LatLng).x +","+
+ map.latLngToLayerPoint(d.LatLng).y +")";
+ }
+ )
+ }
+ })
+})
\ No newline at end of file
diff --git a/pages/receipt/receipt.html b/pages/receipt/receipt.html
new file mode 100644
index 0000000..2ffa42a
--- /dev/null
+++ b/pages/receipt/receipt.html
@@ -0,0 +1,108 @@
+
+
diff --git a/pages/receipt/receiptCtrl.js b/pages/receipt/receiptCtrl.js
new file mode 100644
index 0000000..62d41de
--- /dev/null
+++ b/pages/receipt/receiptCtrl.js
@@ -0,0 +1,62 @@
+app.controller('receiptCtrl',function($scope,$http,uploadReceiptService) {
+
+ // display the list of all exsiting store, validated and not validated
+ $scope.storelist;
+
+ // require param for upload api
+ $scope.microCurrencyValue;
+ $scope.transactionAdditionType;
+ $scope.addValidatedId;
+
+ $scope.storename;
+
+ // photo and path to the photo
+ $scope.receiptPhoto;
+ $scope.receiptPhotoSrc;
+
+ // list of pending reciepts await for approval from admin
+ $scope.pending_list = [
+ {submitted_time: 30 },{submitted_time:20},{submitted_time:10},{submitted_time:5},{submitted_time:1}
+ ];
+
+
+ var foodloop_token_url_search = "http://192.168.2.172:3000/search";
+
+
+ // get the latest store list
+ $scope.getStoreList = function(){
+ var data = {
+ "searchName": "",
+ "searchLocation": ""
+ };
+ $http.post(foodloop_token_url_search,data).then(function(response){
+ console.log(response);
+ });
+
+ // API call to /search to fetch a list of store
+ }
+
+ $scope.storelist = $scope.getStoreList();
+
+ // select the image
+ $scope.getImage = function(element) {
+ var reader = new FileReader();
+ reader.onload = function(event) {
+ $scope.$apply(function($scope) {
+ $scope.receiptPhoto = element.files[0];
+ $scope.receiptPhotoSrc = event.target.result
+ });
+ }
+ reader.readAsDataURL(element.files[0]);
+ }
+
+ // upload the receipt to the server
+ $scope.uploadReceipt = function(){
+ uploadReceiptService.uploadReceipt();
+ }
+
+
+ // test
+ // firebase api to upload an image
+
+});
diff --git a/pages/trader/header.trader.html b/pages/trader/header.trader.html
new file mode 100644
index 0000000..1ba87f4
--- /dev/null
+++ b/pages/trader/header.trader.html
@@ -0,0 +1,27 @@
+
+
+
+
+ FoodLoop
+
+
+
\ No newline at end of file
diff --git a/pages/trader/main.trader.html b/pages/trader/main.trader.html
new file mode 100644
index 0000000..bc6c7e2
--- /dev/null
+++ b/pages/trader/main.trader.html
@@ -0,0 +1,6 @@
+
+
+ i m the main content in trader page
+
+
+
\ No newline at end of file
diff --git a/pages/trader/sidebar.trader.html b/pages/trader/sidebar.trader.html
new file mode 100644
index 0000000..b0eaa4c
--- /dev/null
+++ b/pages/trader/sidebar.trader.html
@@ -0,0 +1,44 @@
+
+
diff --git a/pages/trader/trader.html b/pages/trader/trader.html
new file mode 100644
index 0000000..e69de29
diff --git a/pages/trader/traderCtrl.js b/pages/trader/traderCtrl.js
new file mode 100644
index 0000000..5c09157
--- /dev/null
+++ b/pages/trader/traderCtrl.js
@@ -0,0 +1,15 @@
+app.controller('traderCtrl', function($scope,$location) {
+
+ $scope.content = "I am not a header";
+ $scope.headerContent = "FoodLoop Admin Portal";
+
+
+ /* This block of code handles recepit management */
+ $scope.receiptNumber = 0;
+
+
+ /* This block of code handles user management */
+ /* Including the management of registered user, trader */
+ $scope.registeredUsers = 1;
+
+});
diff --git a/pages/user/header.user.html b/pages/user/header.user.html
new file mode 100644
index 0000000..54f09c2
--- /dev/null
+++ b/pages/user/header.user.html
@@ -0,0 +1,24 @@
+
+
+
+
+ FoodLoop
+
+
+
\ No newline at end of file
diff --git a/pages/user/icon1.png b/pages/user/icon1.png
new file mode 100644
index 0000000..1d6c182
Binary files /dev/null and b/pages/user/icon1.png differ
diff --git a/pages/user/main.leaderboard.html b/pages/user/main.leaderboard.html
new file mode 100644
index 0000000..563f83b
--- /dev/null
+++ b/pages/user/main.leaderboard.html
@@ -0,0 +1,28 @@
+
+
+
+
+
+
+ Position
+ Name
+ Pear points
+ Retailers spent with
+ Receipt submitted
+
+
+
+
+ {{$index + 1}}
+ {{user.name}}
+ {{user.pear_points}}
+ {{user.retailer_spent}}
+ {{user.receipt_submitted}}
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/pages/user/main.settings.html b/pages/user/main.settings.html
new file mode 100644
index 0000000..d16c56f
--- /dev/null
+++ b/pages/user/main.settings.html
@@ -0,0 +1,21 @@
+
+
+
+
\ No newline at end of file
diff --git a/pages/user/main.user.html b/pages/user/main.user.html
new file mode 100644
index 0000000..493713c
--- /dev/null
+++ b/pages/user/main.user.html
@@ -0,0 +1,90 @@
+
+
+
+
+
+
+
+
+
+
+
+
+ Pending receipt 5
+
+
+ Submit a receipt
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ #
+ Username
+ Points
+ Receipts submitted
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/pages/user/sidebar.user.html b/pages/user/sidebar.user.html
new file mode 100644
index 0000000..8f13d7b
--- /dev/null
+++ b/pages/user/sidebar.user.html
@@ -0,0 +1,30 @@
+
+
diff --git a/pages/user/user.html b/pages/user/user.html
new file mode 100644
index 0000000..b18dbfb
--- /dev/null
+++ b/pages/user/user.html
@@ -0,0 +1,3 @@
+
+
+
\ No newline at end of file
diff --git a/pages/user/userCtrl.js b/pages/user/userCtrl.js
new file mode 100644
index 0000000..4bfa4cc
--- /dev/null
+++ b/pages/user/userCtrl.js
@@ -0,0 +1,65 @@
+app.controller('userCtrl', function($scope,$location) {
+ $scope.user_rank = 1;
+ $scope.controllby = "user";
+ $scope.username = "John Smith";
+ $scope.email = "test007@test.com";
+ $scope.createChart = function(){
+ var ctx = document.getElementById("myChart");
+ var myChart = new Chart(ctx, {
+ type: 'line',
+ data: {
+ labels: ["Red", "Blue", "Yellow", "Green", "Purple", "Orange"],
+ datasets: [{
+ label: '# of Votes',
+ data: [12, 19, 3, 5, 2, 3],
+ backgroundColor: [
+ 'rgba(255, 99, 132, 0.2)',
+ 'rgba(54, 162, 235, 0.2)',
+ 'rgba(255, 206, 86, 0.2)',
+ 'rgba(75, 192, 192, 0.2)',
+ 'rgba(153, 102, 255, 0.2)',
+ 'rgba(255, 159, 64, 0.2)'
+ ],
+ borderColor: [
+ 'rgba(255,99,132,1)',
+ 'rgba(54, 162, 235, 1)',
+ 'rgba(255, 206, 86, 1)',
+ 'rgba(75, 192, 192, 1)',
+ 'rgba(153, 102, 255, 1)',
+ 'rgba(255, 159, 64, 1)'
+ ],
+ borderWidth: 1
+ }]
+ },
+ options: {
+ responsive: true,
+ scales: {
+ yAxes: [{
+ ticks: {
+ beginAtZero:true
+ }
+ }]
+ }
+ }
+ });
+ }
+
+
+ $scope.displayChart = function(){
+ // chart sample
+ var flData = [{x: 100, y: 100}, {x: 200, y: 200}, {x: 300, y: 300}];
+ var svg = d3.select("flChart").append("svg")
+ .attr("width","300px").attr("height","300px");
+ svg
+ .selectAll("circle").data(flData)
+ .enter().append("circle")
+ .attr("cx", function(d) { return d.x; })
+ .attr("cy", function(d) { return d.y; })
+ .attr("r", 2.5);
+
+ console.log(svg);
+ }
+
+
+
+});
diff --git a/services/authService.js b/services/authService.js
new file mode 100644
index 0000000..e322f0e
--- /dev/null
+++ b/services/authService.js
@@ -0,0 +1,14 @@
+/* this service handles all the authentication between client and server */
+app.service('authService', function ($http) {
+ // send a login information to server
+ // upon success, set sessionToken and store data in dataService
+ // upon failed, return error
+ this.username = "";
+ this.getUsername = function(){
+ return this.username;
+ }
+
+ this.setUsername = function(setTo){
+ this.username = setTo;
+ }
+});
\ No newline at end of file
diff --git a/services/chartService.js b/services/chartService.js
new file mode 100644
index 0000000..ec9d410
--- /dev/null
+++ b/services/chartService.js
@@ -0,0 +1,56 @@
+/* this service handles all the authentication between client and server */
+app.service('chartService', function () {
+ // send a login information to server
+ // upon success, set sessionToken and store data in dataService
+ // upon failed, return error
+ this.username = "";
+ this.getUsername = function(){
+ return this.username;
+ }
+
+ this.setUsername = function(setTo){
+ this.username = setTo;
+ }
+
+
+ this.createChart = function(){
+ var ctx = document.getElementById("myChart");
+ var myChart = new Chart(ctx, {
+ type: 'line',
+ data: {
+ labels: ["Red", "Blue", "Yellow", "Green", "Purple", "Orange"],
+ datasets: [{
+ label: '# of Votes',
+ data: [12, 19, 3, 5, 2, 3],
+ backgroundColor: [
+ 'rgba(255, 99, 132, 0.2)',
+ 'rgba(54, 162, 235, 0.2)',
+ 'rgba(255, 206, 86, 0.2)',
+ 'rgba(75, 192, 192, 0.2)',
+ 'rgba(153, 102, 255, 0.2)',
+ 'rgba(255, 159, 64, 0.2)'
+ ],
+ borderColor: [
+ 'rgba(255,99,132,1)',
+ 'rgba(54, 162, 235, 1)',
+ 'rgba(255, 206, 86, 1)',
+ 'rgba(75, 192, 192, 1)',
+ 'rgba(153, 102, 255, 1)',
+ 'rgba(255, 159, 64, 1)'
+ ],
+ borderWidth: 1
+ }]
+ },
+ options: {
+ responsive: true,
+ scales: {
+ yAxes: [{
+ ticks: {
+ beginAtZero:true
+ }
+ }]
+ }
+ }
+ });
+ }
+});
\ No newline at end of file
diff --git a/services/uploadReceiptService.js b/services/uploadReceiptService.js
new file mode 100644
index 0000000..e5948ea
--- /dev/null
+++ b/services/uploadReceiptService.js
@@ -0,0 +1,6 @@
+/* this service handles receipt upload process */
+app.service('uploadReceiptService', function () {
+ this.uploadReceipt = function(){
+ console.log("Upload successful");
+ }
+});
\ No newline at end of file