mirror of
https://github.com/arnaucube/commonroutesWebApp.git
synced 2026-02-07 03:16:41 +01:00
starting, login and signup runs ok, implementing main dashboard layout
This commit is contained in:
101
views/travel/travel.html
Executable file
101
views/travel/travel.html
Executable file
@@ -0,0 +1,101 @@
|
||||
<div class="container">
|
||||
<div class="row">
|
||||
<div class="col-sm-4">
|
||||
<div class="panel">
|
||||
<div class="panel-heading c_deepPurpleG500to300">
|
||||
<h3 class="panel-title">{{travel.title}}</h3>
|
||||
</div>
|
||||
<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>
|
||||
From: <b>{{travel.from.name}}</b>
|
||||
</p>
|
||||
<p>
|
||||
To: <b>{{travel.from.name}}</b>
|
||||
</p>
|
||||
<p ng-show="travel.package">
|
||||
Can transport package
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
<div class="panel">
|
||||
<div class="panel-heading c_deepPurpleG500to300">
|
||||
<h3 class="panel-title">Map</h3>
|
||||
</div>
|
||||
<div class="panel-body">
|
||||
<leaflet width="100%" height="300px" markers="markers" center="center"
|
||||
tiles="tiles" id="map-simple-map"></leaflet>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-sm-3">
|
||||
<div class="panel">
|
||||
<div class="panel-heading c_deepPurpleG500to300">
|
||||
<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-3">
|
||||
<div class="panel">
|
||||
<div class="panel-heading c_deepPurpleG500to300">
|
||||
<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 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 ng-click="deleteTravel()" class="btn btn-block btn-sm c_red300">Delete travel</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
79
views/travel/travel.js
Executable file
79
views/travel/travel.js
Executable file
@@ -0,0 +1,79 @@
|
||||
'use strict';
|
||||
|
||||
angular.module('app.travel', ['ngRoute', 'ui-leaflet'])
|
||||
|
||||
.config(['$routeProvider', function($routeProvider) {
|
||||
$routeProvider.when('/travel/:travelid', {
|
||||
templateUrl: 'views/travel/travel.html',
|
||||
controller: 'TravelCtrl'
|
||||
});
|
||||
}])
|
||||
|
||||
.controller('TravelCtrl', function($scope, $http, $routeParams,
|
||||
leafletData, leafletBoundsHelpers) {
|
||||
$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)
|
||||
.then(function(data, status, headers, config) {
|
||||
console.log('data success');
|
||||
console.log(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) {
|
||||
console.log('data error');
|
||||
});
|
||||
|
||||
|
||||
//delete travel
|
||||
$scope.deleteTravel = function() {
|
||||
console.log("delete travel: " + $routeParams.travelid);
|
||||
$http({
|
||||
url: urlapi + '/admin/travels/id/' + $routeParams.travelid,
|
||||
method: "DELETE"
|
||||
})
|
||||
.then(function(data) {
|
||||
console.log(data);
|
||||
$scope.travels = data.data;
|
||||
|
||||
window.location = "#!/main/";
|
||||
},
|
||||
function(data) { // optional
|
||||
// failed
|
||||
});
|
||||
};
|
||||
|
||||
});
|
||||
Reference in New Issue
Block a user