This repository has been archived on 2020-09-27. You can view files and clone it, but cannot push or open issues or pull requests.
2017-04-07 15:05:56 +02:00
|
|
|
'use strict';
|
|
|
|
|
|
|
|
angular.module('microStock')
|
|
|
|
.controller('ItemCtrl',['$scope','$http','$stateParams',function($scope,$http,$stateParams){
|
|
|
|
$scope.obj = {};
|
|
|
|
$scope.list = [];
|
|
|
|
|
2017-05-19 11:02:19 +02:00
|
|
|
function load(){
|
|
|
|
$http.get(config.microservice_dependencies.productById.replace("%d", $stateParams.productid)).then(function(res) {
|
|
|
|
$scope.obj = res.data
|
2017-05-12 10:17:27 +02:00
|
|
|
});
|
2017-05-19 11:02:19 +02:00
|
|
|
$http.get(config.store.goods.productById.replace("%d",$stateParams.productid)).then(function(res) {
|
|
|
|
$scope.list = res.data;
|
|
|
|
},function(){
|
|
|
|
$scope.list = [];
|
|
|
|
});
|
|
|
|
}
|
|
|
|
load();
|
|
|
|
$scope.delete = function(id){
|
2017-05-19 16:47:08 +02:00
|
|
|
$http.delete(config.store.goods.productById.replace("%d",id)).then(load,function(e){
|
|
|
|
if(e.status == 403) {
|
|
|
|
alert("You are not allowed to delete manuelle goods, maybe you should login!");
|
|
|
|
}else{
|
|
|
|
alert("A error occurred during deleting this good: "+e.data);
|
|
|
|
}
|
|
|
|
});
|
2017-05-12 10:17:27 +02:00
|
|
|
}
|
2017-04-07 15:05:56 +02:00
|
|
|
}]);
|