mirror of
https://github.com/arnaucube/commonroutesAdminWeb.git
synced 2026-02-07 03:06:44 +01:00
added user and travel page
This commit is contained in:
@@ -1 +1,6 @@
|
|||||||
# carsincommonAdminWeb
|
# carsincommonAdminWeb
|
||||||
|
|
||||||
|
- server code: https://github.com/arnaucode/carsincommonServer
|
||||||
|
- frontend app code: https://github.com/arnaucode/carsincommonApp
|
||||||
|
- images server: https://github.com/arnaucode/goImgServer
|
||||||
|
- admin web: https://github.com/arnaucode/carsincommonAdminWeb
|
||||||
|
|||||||
7
app.js
7
app.js
@@ -1,12 +1,17 @@
|
|||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
|
var urlapi = "http://localhost:3000/api/";
|
||||||
|
//var urlapi = "http://192.168.1.36:3000/api/";
|
||||||
|
//var urlapi = "http://51.255.193.106:3000/api/";
|
||||||
|
|
||||||
// Declare app level module which depends on views, and components
|
// Declare app level module which depends on views, and components
|
||||||
angular.module('adminApp', [
|
angular.module('adminApp', [
|
||||||
'ngRoute',
|
'ngRoute',
|
||||||
'ngMessages',
|
'ngMessages',
|
||||||
'angularBootstrapMaterial',
|
'angularBootstrapMaterial',
|
||||||
'app.main',
|
'app.main',
|
||||||
'app.user'
|
'app.user',
|
||||||
|
'app.travel'
|
||||||
]).
|
]).
|
||||||
config(['$locationProvider', '$routeProvider', function($locationProvider, $routeProvider) {
|
config(['$locationProvider', '$routeProvider', function($locationProvider, $routeProvider) {
|
||||||
$locationProvider.hashPrefix('!');
|
$locationProvider.hashPrefix('!');
|
||||||
|
|||||||
@@ -59,6 +59,7 @@
|
|||||||
<script src="app.js"></script>
|
<script src="app.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>
|
||||||
</body>
|
</body>
|
||||||
|
|
||||||
</html>
|
</html>
|
||||||
|
|||||||
@@ -10,39 +10,17 @@
|
|||||||
</div>
|
</div>
|
||||||
<div class="panel-body">
|
<div class="panel-body">
|
||||||
<div class="list-group">
|
<div class="list-group">
|
||||||
<div class="list-group-item">
|
<a ng-repeat="user in users" ng-href="#!/user/{{user._id}}" class="list-group-item">
|
||||||
<div class="row-picture">
|
<div class="row-picture">
|
||||||
<img class="circle" src="http://lorempixel.com/56/56/people/2" alt="icon">
|
<img class="circle" ng-src="{{user.avatar}}" alt="icon">
|
||||||
</div>
|
</div>
|
||||||
<div class="row-content">
|
<div class="row-content">
|
||||||
<h4 class="list-group-item-heading">User 1</h4>
|
<h4 class="list-group-item-heading">{{user.username}}</h4>
|
||||||
|
|
||||||
<p class="list-group-item-text">Donec id elit non mi porta gravida at eget metus</p>
|
<p class="list-group-item-text">{{user.description}}</p>
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="list-group-separator"></div>
|
|
||||||
<div class="list-group-item">
|
|
||||||
<div class="row-picture">
|
|
||||||
<img class="circle" src="http://lorempixel.com/56/56/people/5" alt="icon">
|
|
||||||
</div>
|
|
||||||
<div class="row-content">
|
|
||||||
<h4 class="list-group-item-heading">User 2</h4>
|
|
||||||
|
|
||||||
<p class="list-group-item-text">Maecenas sed diam eget risus varius blandit.</p>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="list-group-separator"></div>
|
|
||||||
<div class="list-group-item">
|
|
||||||
<div class="row-picture">
|
|
||||||
<img class="circle" src="http://lorempixel.com/56/56/people/11" alt="icon">
|
|
||||||
</div>
|
|
||||||
<div class="row-content">
|
|
||||||
<h4 class="list-group-item-heading">User 3</h4>
|
|
||||||
|
|
||||||
<p class="list-group-item-text">Maecenas sed diam eget risus varius blandit.</p>
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
<div class="list-group-separator"></div>
|
<div class="list-group-separator"></div>
|
||||||
|
</a>
|
||||||
</div>
|
</div>
|
||||||
<br>
|
<br>
|
||||||
<div class="btn btn-raised c_deepPurple300">See all</div>
|
<div class="btn btn-raised c_deepPurple300">See all</div>
|
||||||
@@ -58,30 +36,26 @@
|
|||||||
<table class="table table-striped table-hover ">
|
<table class="table table-striped table-hover ">
|
||||||
<thead>
|
<thead>
|
||||||
<tr>
|
<tr>
|
||||||
<th>From</th>
|
<th>Type</th>
|
||||||
<th>To</th>
|
<th>Title</th>
|
||||||
|
<th>Date</th>
|
||||||
<th>User</th>
|
<th>User</th>
|
||||||
<th>nºJoins</th>
|
<th>nºJoins</th>
|
||||||
|
<th></th>
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
<tbody>
|
<tbody>
|
||||||
<tr>
|
<tr ng-repeat="travel in travels">
|
||||||
<td>Greece</td>
|
<td>{{travel.type}}</td>
|
||||||
<td>Portugal</td>
|
<td>{{travel.title}}</td>
|
||||||
<td>User1</td>
|
<td>{{travel.date | date}}</td>
|
||||||
<td>2</td>
|
<td>
|
||||||
</tr>
|
<a ng-href="#!/user/{{travel.user._id}}">
|
||||||
<tr>
|
{{travel.user.username}}
|
||||||
<td>Paris</td>
|
</a>
|
||||||
<td>Roma</td>
|
</td>
|
||||||
<td>User2</td>
|
<td>{{travel.joins.length}}</td>
|
||||||
<td>3</td>
|
<td><a ng-href="#!/travel/{{travel._id}}">View</a></td>
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<td>Madrid</td>
|
|
||||||
<td>Dublin</td>
|
|
||||||
<td>User1</td>
|
|
||||||
<td>1</td>
|
|
||||||
</tr>
|
</tr>
|
||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
|
|||||||
@@ -9,6 +9,27 @@ angular.module('app.main', ['ngRoute'])
|
|||||||
});
|
});
|
||||||
}])
|
}])
|
||||||
|
|
||||||
.controller('MainCtrl', [function() {
|
.controller('MainCtrl', function($scope, $http) {
|
||||||
|
$scope.users = [];
|
||||||
|
$scope.loadMorePagination = true;
|
||||||
|
$scope.page = 0;
|
||||||
|
|
||||||
}]);
|
$http.get(urlapi + 'users?page=' + $scope.page)
|
||||||
|
.then(function(data) {
|
||||||
|
console.log('data success');
|
||||||
|
console.log(data);
|
||||||
|
$scope.users=data.data;
|
||||||
|
|
||||||
|
}, function(data) {
|
||||||
|
console.log('data error');
|
||||||
|
});
|
||||||
|
$http.get(urlapi + 'travels?page=' + $scope.page)
|
||||||
|
.then(function(data) {
|
||||||
|
console.log('data success');
|
||||||
|
console.log(data);
|
||||||
|
$scope.travels=data.data;
|
||||||
|
|
||||||
|
}, function(data) {
|
||||||
|
console.log('data error');
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|||||||
@@ -7,7 +7,7 @@
|
|||||||
<span class="icon-bar"></span>
|
<span class="icon-bar"></span>
|
||||||
<span class="icon-bar"></span>
|
<span class="icon-bar"></span>
|
||||||
</button>
|
</button>
|
||||||
<a class="navbar-brand" href="javascript:void(0)">Admin Dashboard</a>
|
<a class="navbar-brand" href="/">Admin Dashboard</a>
|
||||||
</div>
|
</div>
|
||||||
<div class="navbar-collapse collapse navbar-responsive-collapse">
|
<div class="navbar-collapse collapse navbar-responsive-collapse">
|
||||||
<ul class="nav navbar-nav">
|
<ul class="nav navbar-nav">
|
||||||
|
|||||||
77
views/travel/travel.html
Normal file
77
views/travel/travel.html
Normal file
@@ -0,0 +1,77 @@
|
|||||||
|
<div ng-include="'views/navbar.html'"></div>
|
||||||
|
|
||||||
|
|
||||||
|
<div class="container">
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-sm-4">
|
||||||
|
<div class="panel">
|
||||||
|
<div class="panel-heading c_deepPurple300">
|
||||||
|
<h3 class="panel-title">{{travel.title}}</h3>
|
||||||
|
</div>
|
||||||
|
<div class="panel-body">
|
||||||
|
<p>
|
||||||
|
From: {{travel.from.name}}
|
||||||
|
</p>
|
||||||
|
<p>
|
||||||
|
To: {{travel.from.name}}
|
||||||
|
</p>
|
||||||
|
<p ng-show="travel.package">
|
||||||
|
Can transport package
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="panel">
|
||||||
|
<div class="panel-heading c_deepPurple300">
|
||||||
|
<h3 class="panel-title">Map</h3>
|
||||||
|
</div>
|
||||||
|
<div class="panel-body">
|
||||||
|
here the map
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="col-sm-4">
|
||||||
|
<div class="panel">
|
||||||
|
<div class="panel-heading c_deepPurple300">
|
||||||
|
<h3 class="panel-title">{{travel.joinPetitions.length}} Pendent joins</h3>
|
||||||
|
</div>
|
||||||
|
<div class="panel-body">
|
||||||
|
<div class="list-group">
|
||||||
|
<a ng-repeat="user in travel.joinPetitions" 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 class="col-sm-4">
|
||||||
|
<div class="panel">
|
||||||
|
<div class="panel-heading c_deepPurple300">
|
||||||
|
<h3 class="panel-title">Accepted users {{travel.joins.length}}/{{travel.seats}}</h3>
|
||||||
|
</div>
|
||||||
|
<div class="panel-body">
|
||||||
|
<div class="list-group">
|
||||||
|
<a ng-repeat="user in travel.joins" 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>
|
||||||
23
views/travel/travel.js
Normal file
23
views/travel/travel.js
Normal file
@@ -0,0 +1,23 @@
|
|||||||
|
'use strict';
|
||||||
|
|
||||||
|
angular.module('app.travel', ['ngRoute'])
|
||||||
|
|
||||||
|
.config(['$routeProvider', function($routeProvider) {
|
||||||
|
$routeProvider.when('/travel/:travelid', {
|
||||||
|
templateUrl: 'views/travel/travel.html',
|
||||||
|
controller: 'TravelCtrl'
|
||||||
|
});
|
||||||
|
}])
|
||||||
|
|
||||||
|
.controller('TravelCtrl', function($scope, $http, $routeParams) {
|
||||||
|
$scope.travel = {};
|
||||||
|
$http.get(urlapi + 'travels/id/' + $routeParams.travelid)
|
||||||
|
.then(function(data, status, headers, config) {
|
||||||
|
console.log('data success');
|
||||||
|
console.log(data);
|
||||||
|
|
||||||
|
$scope.travel = data.data;
|
||||||
|
}, function(data, status, headers, config) {
|
||||||
|
console.log('data error');
|
||||||
|
});
|
||||||
|
});
|
||||||
@@ -1,5 +1,80 @@
|
|||||||
<p>This is the partial for view 2.</p>
|
<div ng-include="'views/navbar.html'"></div>
|
||||||
|
|
||||||
|
|
||||||
|
<div class="container">
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-sm-4">
|
||||||
|
<div class="panel">
|
||||||
|
<div class="panel-heading c_deepPurple300">
|
||||||
|
<h3 class="panel-title">User profile</h3>
|
||||||
|
</div>
|
||||||
|
<div class="panel-body">
|
||||||
|
<div class="list-group">
|
||||||
|
<a ng-href="#!/user" 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>
|
||||||
|
</a>
|
||||||
|
</div>
|
||||||
<p>
|
<p>
|
||||||
Showing of 'interpolate' filter:
|
{{user.email}}
|
||||||
{{ 'Current version is v%VERSION%.' | interpolate }}
|
|
||||||
</p>
|
</p>
|
||||||
|
<p>
|
||||||
|
{{user.telegram}}
|
||||||
|
</p>
|
||||||
|
<p>
|
||||||
|
{{user.phone}}
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="panel">
|
||||||
|
<div class="panel-heading c_deepPurple300">
|
||||||
|
<h3 class="panel-title">User likes</h3>
|
||||||
|
</div>
|
||||||
|
<div class="panel-body">
|
||||||
|
Panel content
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="col-sm-8">
|
||||||
|
<div class="panel">
|
||||||
|
<div class="panel-heading c_deepPurple300">
|
||||||
|
<h3 class="panel-title">User travels</h3>
|
||||||
|
</div>
|
||||||
|
<div class="panel-body">
|
||||||
|
<table class="table table-striped table-hover ">
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<th>Type</th>
|
||||||
|
<th>Title</th>
|
||||||
|
<th>Date</th>
|
||||||
|
<th>User</th>
|
||||||
|
<th>nºJoins</th>
|
||||||
|
<th></th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
<tr ng-repeat="travel in user.travels">
|
||||||
|
<td>{{travel.type}}</td>
|
||||||
|
<td>{{travel.title}}</td>
|
||||||
|
<td>{{travel.date | date}}</td>
|
||||||
|
<td>
|
||||||
|
<a ng-href="#!/user/{{travel.user._id}}">
|
||||||
|
{{travel.user.username}}
|
||||||
|
</a>
|
||||||
|
</td>
|
||||||
|
<td>{{travel.joins.length}}</td>
|
||||||
|
<td><a ng-href="#!/travel/{{travel._id}}">View</a></td>
|
||||||
|
</tr>
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|||||||
@@ -3,12 +3,21 @@
|
|||||||
angular.module('app.user', ['ngRoute'])
|
angular.module('app.user', ['ngRoute'])
|
||||||
|
|
||||||
.config(['$routeProvider', function($routeProvider) {
|
.config(['$routeProvider', function($routeProvider) {
|
||||||
$routeProvider.when('/user', {
|
$routeProvider.when('/user/:userid', {
|
||||||
templateUrl: 'views/user/user.html',
|
templateUrl: 'views/user/user.html',
|
||||||
controller: 'UserCtrl'
|
controller: 'UserCtrl'
|
||||||
});
|
});
|
||||||
}])
|
}])
|
||||||
|
|
||||||
.controller('UserCtrl', [function() {
|
.controller('UserCtrl', function($scope, $http, $routeParams) {
|
||||||
|
$scope.user = {};
|
||||||
|
$http.get(urlapi + 'users/id/' + $routeParams.userid)
|
||||||
|
.then(function(data, status, headers, config) {
|
||||||
|
console.log('data success');
|
||||||
|
console.log(data);
|
||||||
|
|
||||||
}]);
|
$scope.user = data.data;
|
||||||
|
}, function(data, status, headers, config) {
|
||||||
|
console.log('data error');
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user