42 lines
1.3 KiB
JavaScript
42 lines
1.3 KiB
JavaScript
'use strict';
|
|
|
|
var CostCenterListController = ['$scope', 'costCenters', function ($scope, costCenters) {
|
|
$scope.info = costCenters;
|
|
}];
|
|
|
|
CostCenterListController.resolve = {
|
|
costCenters: ['CostCenter', function (CostCenter) {
|
|
return CostCenter.query({}).$promise;
|
|
}]
|
|
};
|
|
|
|
var CostCenterController = ['$scope', '$routeParams', '$location', 'costCenter', function ($scope, $routeParams, $location, costCenter) {
|
|
$scope.costCenter = costCenter;
|
|
|
|
$scope.save = function () {
|
|
$scope.costCenter.$save(function (u, putResponseHeaders) {
|
|
$scope.toasts.push({Type: 'Success', Message: ''});
|
|
$location.path('/CostCenters')
|
|
}, function (data, status) {
|
|
$scope.toasts.push({Type: 'Danger', Message: data.data});
|
|
});
|
|
};
|
|
|
|
$scope.delete = function () {
|
|
$scope.costCenter.$delete(function (u, putResponseHeaders) {
|
|
$scope.toasts.push({Type: 'Success', Message: ''});
|
|
$location.path('/CostCenters')
|
|
}, function (data, status) {
|
|
$scope.toasts.push({Type: 'Danger', Message: data.data});
|
|
});
|
|
};
|
|
$scope.foName = true;
|
|
}];
|
|
|
|
CostCenterController.resolve = {
|
|
costCenter: ['$route', 'CostCenter', function ($route, CostCenter) {
|
|
var id = $route.current.params.id;
|
|
return CostCenter.get({id: id}).$promise;
|
|
}]
|
|
};
|