diff --git a/app.js b/app.js index 5730a36..5cc3d63 100755 --- a/app.js +++ b/app.js @@ -18,6 +18,7 @@ angular.module('webapp', [ 'app.travels', 'app.users', 'app.user', + 'app.userLikes', 'app.travel', 'app.newTravel', 'app.notifications' diff --git a/css/colors.css b/css/colors.css index f82929e..669d8aa 100755 --- a/css/colors.css +++ b/css/colors.css @@ -133,7 +133,9 @@ background: #311B92!important; color: #ffffff!important; } - +.ct_deepPurple300{ + color: #9575CD!important; +} .c_deepPurpleG000to200{ background: -moz-linear-gradient(0deg, #ffffff 0%, #D1C4E9 100%)!important; /* ff3.6+ */ background: -webkit-gradient(linear, left top, right top, color-stop(0%, #ffffff), color-stop(100%, #D1C4E9))!important; /* safari4+,chrome */ @@ -252,6 +254,9 @@ color: #ffffff!important; } +.ct_blue300{ + color: #64B5F6; +} /* cyan */ .c_cyan50{ diff --git a/index.html b/index.html index 9631f05..8c16c80 100755 --- a/index.html +++ b/index.html @@ -25,7 +25,7 @@
- +



@@ -69,6 +69,7 @@ + diff --git a/package.json b/package.json index 03c6eb5..39c99d5 100755 --- a/package.json +++ b/package.json @@ -10,7 +10,7 @@ "http-server": "^0.9.0" }, "scripts": { - "postinstall": "bower install", + "postinstall": "bower install --allow-root", "prestart": "npm install", "start": "http-server -p 8080 -c-1 ./" }, diff --git a/views/navbar.html b/views/navbar.html index dfd8c91..3438566 100755 --- a/views/navbar.html +++ b/views/navbar.html @@ -1,5 +1,5 @@
- + diff --git a/views/navbar.js b/views/navbar.js index 4cb59e8..c59f046 100755 --- a/views/navbar.js +++ b/views/navbar.js @@ -25,18 +25,20 @@ angular.module('app.navbar', ['ngRoute']) if (localStorage.getItem("cr_webapp_userdata")) { $scope.storageuser = JSON.parse(localStorage.getItem("cr_webapp_userdata")); console.log($scope.storageuser); + + //get the num of pendent notifications each time + $http.get(urlapi + 'numnotifications') + .then(function(data) { + $scope.storageuser.notifications = data.data; + console.log(data.data); + localStorage.setItem("cr_webapp_storageuser", JSON.stringify($scope.storageuser)); + }, function(data) { + console.log('data error'); + + }); } - //get the num of pendent notifications each time - $http.get(urlapi + 'numnotifications') - .then(function(data) { - $scope.storageuser.notifications = data.data; - console.log(data.data); - localStorage.setItem("cr_webapp_storageuser", JSON.stringify($scope.storageuser)); - }, function(data) { - console.log('data error'); - - }); + $scope.logout = function() { diff --git a/views/notifications/notifications.html b/views/notifications/notifications.html index 62a76ec..3730049 100644 --- a/views/notifications/notifications.html +++ b/views/notifications/notifications.html @@ -24,8 +24,8 @@
-
{{notification.date | date:"dd/MM"}}
-
{{notification.date | date:"HH:mm:ss"}}
+
{{notification.date | date:"dd/MM"}}
+
{{notification.date | date:"HH:mm:ss"}}

{{notification.message}}

diff --git a/views/notifications/notifications.js b/views/notifications/notifications.js index 57aac09..a050562 100644 --- a/views/notifications/notifications.js +++ b/views/notifications/notifications.js @@ -23,6 +23,7 @@ angular.module('app.notifications', ['ngRoute']) } //store the notifications localStorage.setItem("cr_webapp_notifications", JSON.stringify($scope.notifications)); + console.log($scope.notifications); }, function(data) { console.log('data error'); diff --git a/views/signup/signup.html b/views/signup/signup.html index 6650e14..3245144 100755 --- a/views/signup/signup.html +++ b/views/signup/signup.html @@ -28,7 +28,7 @@
Back -
Login
+
Signup
diff --git a/views/signup/signup.js b/views/signup/signup.js index 4b33903..dbcfa2c 100755 --- a/views/signup/signup.js +++ b/views/signup/signup.js @@ -11,7 +11,7 @@ angular.module('app.signup', ['ngRoute']) .controller('SignupCtrl', function($scope, $http, $routeParams) { $scope.user = {}; - $scope.doLogin = function() { + $scope.doSignup = function() { console.log('Doing login', $scope.user); $http({ diff --git a/views/travelCardTemplate.html b/views/travelCardTemplate.html index ab5b3d7..10fb888 100644 --- a/views/travelCardTemplate.html +++ b/views/travelCardTemplate.html @@ -11,7 +11,7 @@
- + {{travel.user.username}} diff --git a/views/user/user.html b/views/user/user.html index 8a45a22..720f671 100755 --- a/views/user/user.html +++ b/views/user/user.html @@ -13,8 +13,7 @@

- {{user.username}} - Validated + {{user.username}}

{{user.description}}

@@ -25,36 +24,54 @@ {{user.email}}

- {{user.telegram}} + + @{{user.telegram}} +

-

- {{user.phone}} +

+ {{user.phone}}

-
-
-
-

User received likes ({{user.likes.length}})

+
+ + {{user.likes.length}} likes + +
+ Like +
+
+ Unlike +
+
+
+
+ -
-
-
+ -
Validate User
-
Validated by: {{user.validatedBy.username}}
-
Unvalidate User
-
Delete user
-
-
+
--> diff --git a/views/user/user.js b/views/user/user.js index ee6ef19..e3faf6f 100755 --- a/views/user/user.js +++ b/views/user/user.js @@ -9,7 +9,9 @@ angular.module('app.user', ['ngRoute']) }); }]) - .controller('UserCtrl', function($scope, $http, $routeParams) { + .controller('UserCtrl', function($scope, $http, $routeParams, toastr) { + $scope.storageuser = JSON.parse(localStorage.getItem("cr_webapp_userdata")); + $scope.user = {}; $scope.likes = {}; $http.get(urlapi + 'users/id/' + $routeParams.userid) @@ -32,46 +34,55 @@ angular.module('app.user', ['ngRoute']) $scope.$broadcast('scroll.refreshComplete'); //refresher stop }); - //delete user - $scope.deleteUser = function() { - console.log("delete user: " + $routeParams.userid); - $http({ - url: urlapi + 'admin/users/id/' + $routeParams.userid, - method: "DELETE" - }) - .then(function(data) { - window.location = "#!/main/"; - }, - function(data) { // optional - // failed - }); - }; - $scope.validateUser = function() { - $http({ - url: urlapi + 'admin/users/validate/id/' + $routeParams.userid, - method: "POST", - data: {} + $scope.likeUser = function() { + $http({ + //url: urlapi + 'users/'+ $stateParams.username+'/fav', + url: urlapi + 'users/id/like/' + $scope.user._id, + method: "POST", + data: {} }) .then(function(data) { - /*window.location = "#!/main/";*/ - $scope.user = data.data; - }, - function(data) { // optional - // failed - }); - }; - $scope.unvalidateUser = function() { - $http({ - url: urlapi + 'admin/users/unvalidate/id/' + $routeParams.userid, - method: "POST", - data: {} + // success + if (data.data.success == false) { + console.log("failed"); + toastr.error("Error on like"); + } else { + $scope.user = data.data; // for UI + } + }, + function(response) { // optional + // failed + }); + }; + $scope.unlikeUser = function() { + $http({ + //url: urlapi + 'users/'+ $stateParams.username+'/fav', + url: urlapi + 'users/id/unlike/' + $scope.user._id, + method: "POST", + data: {} }) .then(function(data) { - /*window.location = "#!/main/";*/ - $scope.user = data.data; - }, - function(data) { // optional - // failed - }); - }; + // success + if (data.data.success == false) { + console.log("failed"); + toastr.error("Error on unlike"); + } else { + $scope.user = data.data; // for UI + } + }, + function(response) { // optional + // failed + }); + }; + + $scope.arrayObjectIndexOf = function(myArray, searchTerm) { + if (myArray) { + for (var i = 0, len = myArray.length; i < len; i++) { + if (myArray[i] === searchTerm) { + return i; + } + } + } + return -1; + }; }); diff --git a/views/userLikes/userLikes.html b/views/userLikes/userLikes.html new file mode 100644 index 0000000..ca8e362 --- /dev/null +++ b/views/userLikes/userLikes.html @@ -0,0 +1,27 @@ +
+
+
+
+
+
+

User received likes ({{likes.length}})

+
+ +
+
+
+
diff --git a/views/userLikes/userLikes.js b/views/userLikes/userLikes.js new file mode 100644 index 0000000..c9ed0eb --- /dev/null +++ b/views/userLikes/userLikes.js @@ -0,0 +1,26 @@ +'use strict'; + +angular.module('app.userLikes', ['ngRoute']) + + .config(['$routeProvider', function($routeProvider) { + $routeProvider.when('/userLikes/:userid', { + templateUrl: 'views/userLikes/userLikes.html', + controller: 'UserLikesCtrl' + }); + }]) + + .controller('UserLikesCtrl', function($scope, $http, $routeParams) { + $scope.likes = {}; + $http.get(urlapi + 'users/id/likes/' + $routeParams.userid) + .then(function(data, status, headers, config) { + console.log('data success'); + console.log(data); + $scope.likes = data.data; + $scope.$broadcast('scroll.refreshComplete'); //refresher stop + }, function(data, status, headers, config) { + console.log('data error'); + $scope.$broadcast('scroll.refreshComplete'); //refresher stop + }); + + + }); diff --git a/views/users/users.html b/views/users/users.html index 37abf3b..0be0792 100644 --- a/views/users/users.html +++ b/views/users/users.html @@ -1,5 +1,6 @@
+
@@ -17,7 +18,7 @@

{{user.username}} - Validated +

{{user.description}}

@@ -32,16 +33,7 @@
-
-
-

Actions

-
-
-
Create user
-
Create travel
- View network -
-
+