@ -1,18 +1,20 @@ |
|||
{ |
|||
"name": "carsincommonAdminWeb", |
|||
"description": "carsincommonAdminWeb", |
|||
"version": "0.0.0", |
|||
"homepage": "https://github.com/arnaucode/carsincommonAdmin", |
|||
"license": "MIT", |
|||
"private": true, |
|||
"dependencies": { |
|||
"angular": "^1.6.2", |
|||
"angular-route": "^1.6.1", |
|||
"angular-chart.js": "^1.1.1", |
|||
"vis": "^4.18.1", |
|||
"mui": "^0.9.20", |
|||
"angular-bootstrap-material": "abm#^0.1.4", |
|||
"angular-bootstrap": "^2.5.0", |
|||
"angular-messages": "^1.6.5" |
|||
} |
|||
"name": "carsincommonAdminWeb", |
|||
"description": "carsincommonAdminWeb", |
|||
"version": "0.0.0", |
|||
"homepage": "https://github.com/arnaucode/carsincommonAdmin", |
|||
"license": "MIT", |
|||
"private": true, |
|||
"dependencies": { |
|||
"angular": "^1.6.2", |
|||
"angular-route": "^1.6.1", |
|||
"angular-chart.js": "^1.1.1", |
|||
"vis": "^4.18.1", |
|||
"mui": "^0.9.20", |
|||
"angular-bootstrap-material": "abm#^0.1.4", |
|||
"angular-bootstrap": "^2.5.0", |
|||
"angular-messages": "^1.6.5", |
|||
"components-font-awesome": "^4.7.0", |
|||
"ui-leaflet": "^2.0.0" |
|||
} |
|||
} |
@ -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> |
@ -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); |
|||
}); |
|||
|
|||
}; |
|||
}); |
@ -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,23 +1,60 @@ |
|||
'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'); |
|||
}); |
|||
}); |
|||
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'); |
|||
}); |
|||
|
|||
}); |