implemented admin login, added map to travel, added user received likes, added controller to navbar
55
app.js
@@ -9,6 +9,8 @@ angular.module('adminApp', [
|
|||||||
'ngRoute',
|
'ngRoute',
|
||||||
'ngMessages',
|
'ngMessages',
|
||||||
'angularBootstrapMaterial',
|
'angularBootstrapMaterial',
|
||||||
|
'app.navbar',
|
||||||
|
'app.login',
|
||||||
'app.main',
|
'app.main',
|
||||||
'app.user',
|
'app.user',
|
||||||
'app.travel'
|
'app.travel'
|
||||||
@@ -16,5 +18,56 @@ angular.module('adminApp', [
|
|||||||
config(['$locationProvider', '$routeProvider', function($locationProvider, $routeProvider) {
|
config(['$locationProvider', '$routeProvider', function($locationProvider, $routeProvider) {
|
||||||
$locationProvider.hashPrefix('!');
|
$locationProvider.hashPrefix('!');
|
||||||
|
|
||||||
|
//$routeProvider.otherwise({redirectTo: '/main'});
|
||||||
|
if((localStorage.getItem('cic_admin_token')))
|
||||||
|
{
|
||||||
|
console.log(window.location.hash);
|
||||||
|
if(window.location.hash==='#!/login')
|
||||||
|
{
|
||||||
|
window.location='#!/main';
|
||||||
|
}
|
||||||
|
|
||||||
$routeProvider.otherwise({redirectTo: '/main'});
|
$routeProvider.otherwise({redirectTo: '/main'});
|
||||||
}]);
|
}else{
|
||||||
|
if(window.location!=='#!/login')
|
||||||
|
{
|
||||||
|
console.log('app, user no logged');
|
||||||
|
|
||||||
|
localStorage.removeItem('cic_admin_token');
|
||||||
|
localStorage.removeItem('cic_admin_userdata');
|
||||||
|
window.location='#!/login';
|
||||||
|
$routeProvider.otherwise({redirectTo: '/login'});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}])
|
||||||
|
|
||||||
|
.factory('httpInterceptor', function httpInterceptor () {
|
||||||
|
return {
|
||||||
|
request: function(config) {
|
||||||
|
return config;
|
||||||
|
},
|
||||||
|
|
||||||
|
requestError: function(config) {
|
||||||
|
return config;
|
||||||
|
},
|
||||||
|
|
||||||
|
response: function(res) {
|
||||||
|
return res;
|
||||||
|
},
|
||||||
|
|
||||||
|
responseError: function(res) {
|
||||||
|
return res;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
})
|
||||||
|
.factory('api', function ($http) {
|
||||||
|
return {
|
||||||
|
init: function () {
|
||||||
|
$http.defaults.headers.common['X-Access-Token'] = localStorage.getItem('cic_admin_token');
|
||||||
|
$http.defaults.headers.post['X-Access-Token'] = localStorage.getItem('cic_admin_token');
|
||||||
|
}
|
||||||
|
};
|
||||||
|
})
|
||||||
|
.run(function (api) {
|
||||||
|
api.init();
|
||||||
|
});
|
||||||
|
|||||||
@@ -13,6 +13,8 @@
|
|||||||
"mui": "^0.9.20",
|
"mui": "^0.9.20",
|
||||||
"angular-bootstrap-material": "abm#^0.1.4",
|
"angular-bootstrap-material": "abm#^0.1.4",
|
||||||
"angular-bootstrap": "^2.5.0",
|
"angular-bootstrap": "^2.5.0",
|
||||||
"angular-messages": "^1.6.5"
|
"angular-messages": "^1.6.5",
|
||||||
|
"components-font-awesome": "^4.7.0",
|
||||||
|
"ui-leaflet": "^2.0.0"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
BIN
img/avatars/chameleon.png
Normal file
|
After Width: | Height: | Size: 15 KiB |
BIN
img/avatars/clown-fish.png
Normal file
|
After Width: | Height: | Size: 21 KiB |
BIN
img/avatars/duck.png
Normal file
|
After Width: | Height: | Size: 9.6 KiB |
BIN
img/avatars/owl.png
Normal file
|
After Width: | Height: | Size: 15 KiB |
BIN
img/avatars/penguin.png
Normal file
|
After Width: | Height: | Size: 14 KiB |
BIN
img/avatars/racoon.png
Normal file
|
After Width: | Height: | Size: 13 KiB |
BIN
img/avatars/siberian-husky.png
Normal file
|
After Width: | Height: | Size: 19 KiB |
BIN
img/avatars/sloth.png
Normal file
|
After Width: | Height: | Size: 15 KiB |
BIN
img/avatars/tiger.png
Normal file
|
After Width: | Height: | Size: 22 KiB |
BIN
img/avatars/toucan.png
Normal file
|
After Width: | Height: | Size: 11 KiB |
BIN
img/faircoinpublickey_sample.png
Normal file
|
After Width: | Height: | Size: 21 KiB |
BIN
img/userProfileBackground.png
Normal file
|
After Width: | Height: | Size: 245 KiB |
11
index.html
@@ -11,6 +11,9 @@
|
|||||||
<link rel="stylesheet" href="//fonts.googleapis.com/css?family=Roboto:300,400,500,700">
|
<link rel="stylesheet" href="//fonts.googleapis.com/css?family=Roboto:300,400,500,700">
|
||||||
<link rel="stylesheet" href="//fonts.googleapis.com/icon?family=Material+Icons">
|
<link rel="stylesheet" href="//fonts.googleapis.com/icon?family=Material+Icons">
|
||||||
|
|
||||||
|
<link rel="stylesheet" href="bower_components/components-font-awesome/css/font-awesome.min.css">
|
||||||
|
|
||||||
|
|
||||||
<link href="css/style.css" rel="stylesheet">
|
<link href="css/style.css" rel="stylesheet">
|
||||||
<link href="css/colors.css" rel="stylesheet">
|
<link href="css/colors.css" rel="stylesheet">
|
||||||
|
|
||||||
@@ -21,6 +24,8 @@
|
|||||||
</head>
|
</head>
|
||||||
|
|
||||||
<body ng-app="adminApp">
|
<body ng-app="adminApp">
|
||||||
|
<div ng-include="'views/navbar.html'"></div>
|
||||||
|
|
||||||
<div ng-view></div>
|
<div ng-view></div>
|
||||||
|
|
||||||
|
|
||||||
@@ -45,10 +50,10 @@
|
|||||||
|
|
||||||
|
|
||||||
<!-- openstreetmaps angular - leaflet -->
|
<!-- openstreetmaps angular - leaflet -->
|
||||||
<!--<script src="bower_components/leaflet/dist/leaflet.js"></script>
|
<script src="bower_components/leaflet/dist/leaflet.js"></script>
|
||||||
<script src="bower_components/angular-simple-logger/dist/angular-simple-logger.js"></script>
|
<script src="bower_components/angular-simple-logger/dist/angular-simple-logger.js"></script>
|
||||||
<script src="bower_components/ui-leaflet/dist/ui-leaflet.js"></script>
|
<script src="bower_components/ui-leaflet/dist/ui-leaflet.js"></script>
|
||||||
<link rel="stylesheet" href="bower_components/leaflet/dist/leaflet.css" />-->
|
<link rel="stylesheet" href="bower_components/leaflet/dist/leaflet.css" />
|
||||||
|
|
||||||
<script type="text/javascript" src="bower_components/vis/dist/vis.min.js"></script>
|
<script type="text/javascript" src="bower_components/vis/dist/vis.min.js"></script>
|
||||||
<link href="bower_components/vis/dist/vis.min.css" rel="stylesheet" type="text/css" />
|
<link href="bower_components/vis/dist/vis.min.css" rel="stylesheet" type="text/css" />
|
||||||
@@ -57,6 +62,8 @@
|
|||||||
|
|
||||||
<!-- your app's js -->
|
<!-- your app's js -->
|
||||||
<script src="app.js"></script>
|
<script src="app.js"></script>
|
||||||
|
<script src="views/navbar.js"></script>
|
||||||
|
<script src="views/login/login.js"></script>
|
||||||
<script src="views/main/main.js"></script>
|
<script src="views/main/main.js"></script>
|
||||||
<script src="views/user/user.js"></script>
|
<script src="views/user/user.js"></script>
|
||||||
<script src="views/travel/travel.js"></script>
|
<script src="views/travel/travel.js"></script>
|
||||||
|
|||||||
29
views/login/login.html
Normal file
@@ -0,0 +1,29 @@
|
|||||||
|
<div class="container">
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-sm-4">
|
||||||
|
|
||||||
|
</div>
|
||||||
|
<div class="col-sm-4">
|
||||||
|
<div class="panel">
|
||||||
|
<div class="panel-heading c_deepPurple300">
|
||||||
|
<h3 class="panel-title">Login</h3>
|
||||||
|
</div>
|
||||||
|
<div class="panel-body">
|
||||||
|
<div class="form-group label-floating">
|
||||||
|
<input ng-model="user.username" abmFormControl class="form-control" id="inputUsername" placeholder="Username" type="text">
|
||||||
|
</div>
|
||||||
|
<div class="form-group">
|
||||||
|
<input ng-model="user.password" abmFormControl class="form-control" id="inputPassword" placeholder="Password" type="password">
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div ng-click="doLogin()" class="btn btn-raised c_deepPurple300 pull-right">Login</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
<div class="col-sm-4">
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
42
views/login/login.js
Normal file
@@ -0,0 +1,42 @@
|
|||||||
|
'use strict';
|
||||||
|
|
||||||
|
angular.module('app.login', ['ngRoute'])
|
||||||
|
|
||||||
|
.config(['$routeProvider', function($routeProvider) {
|
||||||
|
$routeProvider.when('/login', {
|
||||||
|
templateUrl: 'views/login/login.html',
|
||||||
|
controller: 'LoginCtrl'
|
||||||
|
});
|
||||||
|
}])
|
||||||
|
|
||||||
|
.controller('LoginCtrl', function($scope, $http, $routeParams) {
|
||||||
|
$scope.user = {};
|
||||||
|
$scope.doLogin = function() {
|
||||||
|
console.log('Doing login', $scope.user);
|
||||||
|
|
||||||
|
$http({
|
||||||
|
url: urlapi + 'admin/login',
|
||||||
|
method: "POST",
|
||||||
|
data: $scope.user
|
||||||
|
})
|
||||||
|
.then(function(response) {
|
||||||
|
console.log("response: ");
|
||||||
|
console.log(response.data);
|
||||||
|
if (response.data.success == true)
|
||||||
|
{
|
||||||
|
localStorage.setItem("cic_admin_token", response.data.token);
|
||||||
|
localStorage.setItem("cic_admin_userdata", JSON.stringify(response.data.user));
|
||||||
|
window.location.reload();
|
||||||
|
}else{
|
||||||
|
console.log("login failed");
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
},
|
||||||
|
function(response) { // optional
|
||||||
|
// failed
|
||||||
|
console.log(response);
|
||||||
|
});
|
||||||
|
|
||||||
|
};
|
||||||
|
});
|
||||||
@@ -1,6 +1,3 @@
|
|||||||
<div ng-include="'views/navbar.html'"></div>
|
|
||||||
|
|
||||||
|
|
||||||
<div class="container">
|
<div class="container">
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-sm-4">
|
<div class="col-sm-4">
|
||||||
@@ -18,6 +15,8 @@
|
|||||||
<h4 class="list-group-item-heading">{{user.username}}</h4>
|
<h4 class="list-group-item-heading">{{user.username}}</h4>
|
||||||
|
|
||||||
<p class="list-group-item-text">{{user.description}}</p>
|
<p class="list-group-item-text">{{user.description}}</p>
|
||||||
|
<p class="list-group-item-text">{{user.travels.length}} published travels</p>
|
||||||
|
<p class="list-group-item-text">{{user.likes.length}} likes</p>
|
||||||
</div>
|
</div>
|
||||||
<div class="list-group-separator"></div>
|
<div class="list-group-separator"></div>
|
||||||
</a>
|
</a>
|
||||||
@@ -46,7 +45,11 @@
|
|||||||
</thead>
|
</thead>
|
||||||
<tbody>
|
<tbody>
|
||||||
<tr ng-repeat="travel in travels">
|
<tr ng-repeat="travel in travels">
|
||||||
<td>{{travel.type}}</td>
|
<td>
|
||||||
|
<i ng-show="travel.type=='offering'" class="fa fa-car fa-2x"></i>
|
||||||
|
<i ng-show="travel.type=='asking'" class="fa fa-question fa-2x"></i>
|
||||||
|
<i ng-show="travel.type=='package'" class="fa fa-archive fa-2x"></i>
|
||||||
|
</td>
|
||||||
<td>{{travel.title}}</td>
|
<td>{{travel.title}}</td>
|
||||||
<td>{{travel.date | date}}</td>
|
<td>{{travel.date | date}}</td>
|
||||||
<td>
|
<td>
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
|
<div ng-controller="NavbarCtrl">
|
||||||
<div class="navbar c_grey700">
|
<div class="navbar c_grey700">
|
||||||
<div class="container-fluid">
|
<div class="container-fluid">
|
||||||
<div class="navbar-header">
|
<div class="navbar-header">
|
||||||
@@ -36,3 +36,7 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
<!--
|
||||||
|
<div ng-click="goBack()" class="btn"><span class="glyphicon glyphicon-arrow-left"></span> Back</div>
|
||||||
|
-->
|
||||||
|
</div>
|
||||||
|
|||||||
19
views/navbar.js
Normal file
@@ -0,0 +1,19 @@
|
|||||||
|
'use strict';
|
||||||
|
|
||||||
|
angular.module('app.navbar', ['ngRoute'])
|
||||||
|
|
||||||
|
.config(['$routeProvider', function($routeProvider) {
|
||||||
|
$routeProvider.when('/navbar', {
|
||||||
|
templateUrl: 'views/navbar/navbar.html',
|
||||||
|
controller: 'NavbarCtrl'
|
||||||
|
});
|
||||||
|
}])
|
||||||
|
|
||||||
|
.controller('NavbarCtrl', function($scope, $http, $routeParams, $location) {
|
||||||
|
$scope.locationHash = $location.path();
|
||||||
|
console.log($scope.locationHash);
|
||||||
|
$scope.goBack = function() {
|
||||||
|
console.log("goBack");
|
||||||
|
window.history.back();
|
||||||
|
};
|
||||||
|
});
|
||||||
@@ -1,6 +1,3 @@
|
|||||||
<div ng-include="'views/navbar.html'"></div>
|
|
||||||
|
|
||||||
|
|
||||||
<div class="container">
|
<div class="container">
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-sm-4">
|
<div class="col-sm-4">
|
||||||
@@ -9,11 +6,25 @@
|
|||||||
<h3 class="panel-title">{{travel.title}}</h3>
|
<h3 class="panel-title">{{travel.title}}</h3>
|
||||||
</div>
|
</div>
|
||||||
<div class="panel-body">
|
<div class="panel-body">
|
||||||
|
<div class="list-group">
|
||||||
|
<a ng-href="#!/user/{{user._id}}" class="list-group-item">
|
||||||
|
<div class="row-picture">
|
||||||
|
<img class="circle" ng-src="{{travel.user.avatar}}" alt="icon">
|
||||||
|
</div>
|
||||||
|
<div class="row-content">
|
||||||
|
<h4 class="list-group-item-heading">{{travel.user.username}}</h4>
|
||||||
|
|
||||||
|
<p class="list-group-item-text">@{{travel.user.telegram}}</p>
|
||||||
|
<p class="list-group-item-text">{{travel.user.phone}}</p>
|
||||||
|
</div>
|
||||||
|
<div class="list-group-separator"></div>
|
||||||
|
</a>
|
||||||
|
</div>
|
||||||
<p>
|
<p>
|
||||||
From: {{travel.from.name}}
|
From: <b>{{travel.from.name}}</b>
|
||||||
</p>
|
</p>
|
||||||
<p>
|
<p>
|
||||||
To: {{travel.from.name}}
|
To: <b>{{travel.from.name}}</b>
|
||||||
</p>
|
</p>
|
||||||
<p ng-show="travel.package">
|
<p ng-show="travel.package">
|
||||||
Can transport package
|
Can transport package
|
||||||
@@ -25,11 +36,12 @@
|
|||||||
<h3 class="panel-title">Map</h3>
|
<h3 class="panel-title">Map</h3>
|
||||||
</div>
|
</div>
|
||||||
<div class="panel-body">
|
<div class="panel-body">
|
||||||
here the map
|
<leaflet width="100%" height="300px" markers="markers" center="center"
|
||||||
|
tiles="tiles" id="map-simple-map"></leaflet>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="col-sm-4">
|
<div class="col-sm-3">
|
||||||
<div class="panel">
|
<div class="panel">
|
||||||
<div class="panel-heading c_deepPurple300">
|
<div class="panel-heading c_deepPurple300">
|
||||||
<h3 class="panel-title">{{travel.joinPetitions.length}} Pendent joins</h3>
|
<h3 class="panel-title">{{travel.joinPetitions.length}} Pendent joins</h3>
|
||||||
@@ -52,7 +64,7 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="col-sm-4">
|
<div class="col-sm-3">
|
||||||
<div class="panel">
|
<div class="panel">
|
||||||
<div class="panel-heading c_deepPurple300">
|
<div class="panel-heading c_deepPurple300">
|
||||||
<h3 class="panel-title">Accepted users {{travel.joins.length}}/{{travel.seats}}</h3>
|
<h3 class="panel-title">Accepted users {{travel.joins.length}}/{{travel.seats}}</h3>
|
||||||
@@ -74,4 +86,16 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<div class="col-sm-2">
|
||||||
|
<div class="panel">
|
||||||
|
<div class="panel-heading c_deepPurple500">
|
||||||
|
<h3 class="panel-title">Admin actions</h3>
|
||||||
|
</div>
|
||||||
|
<div class="panel-body">
|
||||||
|
<div class="btn btn-block btn-sm c_orange300">Ban travel</div>
|
||||||
|
<div class="btn btn-block btn-sm c_red300">Delete travel</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -1,23 +1,60 @@
|
|||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
angular.module('app.travel', ['ngRoute'])
|
angular.module('app.travel', ['ngRoute', 'ui-leaflet'])
|
||||||
|
|
||||||
.config(['$routeProvider', function($routeProvider) {
|
.config(['$routeProvider', function($routeProvider) {
|
||||||
$routeProvider.when('/travel/:travelid', {
|
$routeProvider.when('/travel/:travelid', {
|
||||||
templateUrl: 'views/travel/travel.html',
|
templateUrl: 'views/travel/travel.html',
|
||||||
controller: 'TravelCtrl'
|
controller: 'TravelCtrl'
|
||||||
});
|
});
|
||||||
}])
|
}])
|
||||||
|
|
||||||
.controller('TravelCtrl', function($scope, $http, $routeParams) {
|
.controller('TravelCtrl', function($scope, $http, $routeParams,
|
||||||
|
leafletData, leafletBoundsHelpers) {
|
||||||
$scope.travel = {};
|
$scope.travel = {};
|
||||||
|
|
||||||
|
|
||||||
|
//map
|
||||||
|
$scope.center = {
|
||||||
|
/*lat: 0,
|
||||||
|
lng: 0,
|
||||||
|
zoom: 1*/
|
||||||
|
};
|
||||||
|
$scope.bounds = {};
|
||||||
|
$scope.markers = [];
|
||||||
|
$scope.tiles = {
|
||||||
|
url: "http://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png",
|
||||||
|
options: {
|
||||||
|
attribution: '<a href="http://www.openstreetmap.org/copyright">OpenStreetMap</a> contributors'
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
$http.get(urlapi + 'travels/id/' + $routeParams.travelid)
|
$http.get(urlapi + 'travels/id/' + $routeParams.travelid)
|
||||||
.then(function(data, status, headers, config) {
|
.then(function(data, status, headers, config) {
|
||||||
console.log('data success');
|
console.log('data success');
|
||||||
console.log(data);
|
console.log(data);
|
||||||
|
|
||||||
$scope.travel = data.data;
|
$scope.travel = data.data;
|
||||||
|
|
||||||
|
//map
|
||||||
|
$scope.markers = [];
|
||||||
|
$scope.markers.push({
|
||||||
|
lat: Number($scope.travel.from.lat),
|
||||||
|
lng: Number($scope.travel.from.long),
|
||||||
|
message: $scope.travel.from.name
|
||||||
|
});
|
||||||
|
$scope.markers.push({
|
||||||
|
lat: Number($scope.travel.to.lat),
|
||||||
|
lng: Number($scope.travel.to.long),
|
||||||
|
message: $scope.travel.to.name
|
||||||
|
});
|
||||||
|
$scope.center = {
|
||||||
|
lat: (Number($scope.travel.from.lat) + Number($scope.travel.to.lat)) / 2,
|
||||||
|
lng: (Number($scope.travel.from.long) + Number($scope.travel.to.long)) / 2,
|
||||||
|
zoom: 4
|
||||||
|
};
|
||||||
}, function(data, status, headers, config) {
|
}, function(data, status, headers, config) {
|
||||||
console.log('data error');
|
console.log('data error');
|
||||||
});
|
});
|
||||||
});
|
|
||||||
|
});
|
||||||
|
|||||||
@@ -1,6 +1,3 @@
|
|||||||
<div ng-include="'views/navbar.html'"></div>
|
|
||||||
|
|
||||||
|
|
||||||
<div class="container">
|
<div class="container">
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-sm-4">
|
<div class="col-sm-4">
|
||||||
@@ -10,7 +7,7 @@
|
|||||||
</div>
|
</div>
|
||||||
<div class="panel-body">
|
<div class="panel-body">
|
||||||
<div class="list-group">
|
<div class="list-group">
|
||||||
<a ng-href="#!/user" class="list-group-item">
|
<a class="list-group-item">
|
||||||
<div class="row-picture">
|
<div class="row-picture">
|
||||||
<img class="circle" ng-src="{{user.avatar}}" alt="icon">
|
<img class="circle" ng-src="{{user.avatar}}" alt="icon">
|
||||||
</div>
|
</div>
|
||||||
@@ -34,14 +31,26 @@
|
|||||||
</div>
|
</div>
|
||||||
<div class="panel">
|
<div class="panel">
|
||||||
<div class="panel-heading c_deepPurple300">
|
<div class="panel-heading c_deepPurple300">
|
||||||
<h3 class="panel-title">User likes</h3>
|
<h3 class="panel-title">User received likes ({{user.likes.length}})</h3>
|
||||||
</div>
|
</div>
|
||||||
<div class="panel-body">
|
<div class="panel-body">
|
||||||
Panel content
|
<div class="list-group">
|
||||||
|
<a ng-repeat="user in likes" ng-href="#!/user/{{user._id}}" class="list-group-item">
|
||||||
|
<div class="row-picture">
|
||||||
|
<img class="circle" ng-src="{{user.avatar}}" alt="icon">
|
||||||
|
</div>
|
||||||
|
<div class="row-content">
|
||||||
|
<h4 class="list-group-item-heading">{{user.username}}</h4>
|
||||||
|
|
||||||
|
<p class="list-group-item-text">{{user.description}}</p>
|
||||||
|
</div>
|
||||||
|
<div class="list-group-separator"></div>
|
||||||
|
</a>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="col-sm-8">
|
</div>
|
||||||
|
<div class="col-sm-6">
|
||||||
<div class="panel">
|
<div class="panel">
|
||||||
<div class="panel-heading c_deepPurple300">
|
<div class="panel-heading c_deepPurple300">
|
||||||
<h3 class="panel-title">User travels</h3>
|
<h3 class="panel-title">User travels</h3>
|
||||||
@@ -60,7 +69,11 @@
|
|||||||
</thead>
|
</thead>
|
||||||
<tbody>
|
<tbody>
|
||||||
<tr ng-repeat="travel in user.travels">
|
<tr ng-repeat="travel in user.travels">
|
||||||
<td>{{travel.type}}</td>
|
<td>
|
||||||
|
<i ng-show="travel.type=='offering'" class="fa fa-car fa-2x"></i>
|
||||||
|
<i ng-show="travel.type=='asking'" class="fa fa-question fa-2x"></i>
|
||||||
|
<i ng-show="travel.type=='package'" class="fa fa-archive fa-2x"></i>
|
||||||
|
</td>
|
||||||
<td>{{travel.title}}</td>
|
<td>{{travel.title}}</td>
|
||||||
<td>{{travel.date | date}}</td>
|
<td>{{travel.date | date}}</td>
|
||||||
<td>
|
<td>
|
||||||
@@ -76,5 +89,18 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
<div class="col-sm-2">
|
||||||
|
<div class="panel">
|
||||||
|
<div class="panel-heading c_deepPurple500">
|
||||||
|
<h3 class="panel-title">Admin actions</h3>
|
||||||
|
</div>
|
||||||
|
<div class="panel-body">
|
||||||
|
<div class="btn btn-block btn-sm c_orange300">Ban user</div>
|
||||||
|
<div class="btn btn-block btn-sm c_red300">Delete user</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -2,15 +2,16 @@
|
|||||||
|
|
||||||
angular.module('app.user', ['ngRoute'])
|
angular.module('app.user', ['ngRoute'])
|
||||||
|
|
||||||
.config(['$routeProvider', function($routeProvider) {
|
.config(['$routeProvider', function($routeProvider) {
|
||||||
$routeProvider.when('/user/:userid', {
|
$routeProvider.when('/user/:userid', {
|
||||||
templateUrl: 'views/user/user.html',
|
templateUrl: 'views/user/user.html',
|
||||||
controller: 'UserCtrl'
|
controller: 'UserCtrl'
|
||||||
});
|
});
|
||||||
}])
|
}])
|
||||||
|
|
||||||
.controller('UserCtrl', function($scope, $http, $routeParams) {
|
.controller('UserCtrl', function($scope, $http, $routeParams) {
|
||||||
$scope.user = {};
|
$scope.user = {};
|
||||||
|
$scope.likes = {};
|
||||||
$http.get(urlapi + 'users/id/' + $routeParams.userid)
|
$http.get(urlapi + 'users/id/' + $routeParams.userid)
|
||||||
.then(function(data, status, headers, config) {
|
.then(function(data, status, headers, config) {
|
||||||
console.log('data success');
|
console.log('data success');
|
||||||
@@ -20,4 +21,14 @@ angular.module('app.user', ['ngRoute'])
|
|||||||
}, function(data, status, headers, config) {
|
}, function(data, status, headers, config) {
|
||||||
console.log('data error');
|
console.log('data error');
|
||||||
});
|
});
|
||||||
});
|
$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
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|||||||