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-05-12 10:58:43 +02:00
|
|
|
'use strict';
|
|
|
|
|
|
|
|
angular.module('microStock')
|
|
|
|
.controller('ItemAddCtrl',['$scope','$http','$stateParams',function($scope,$http,$stateParams){
|
|
|
|
$scope.product = {};
|
|
|
|
$scope.obj = {};
|
2017-05-12 11:54:59 +02:00
|
|
|
$scope.msg = {};
|
2017-05-12 10:58:43 +02:00
|
|
|
$scope.count = 1;
|
|
|
|
|
|
|
|
$http.get(config.microservice_dependencies.productById.replace("%d", $stateParams.productid)).then(function(res) {
|
|
|
|
$scope.product = res.data
|
|
|
|
});
|
|
|
|
|
|
|
|
$scope.submit = function(){
|
2017-05-19 11:02:19 +02:00
|
|
|
$http.post(config.store.goods.productById.replace("%d",$stateParams.productid)+'?count='+$scope.count,$scope.obj).then(function(){
|
2017-05-12 11:54:59 +02:00
|
|
|
$scope.obj = {};
|
2017-05-19 11:47:38 +02:00
|
|
|
$scope.msg = {type:'success',text:'Saved '+$scope.count+' good(s) from product '+$scope.product.title+'.'};
|
2017-05-19 11:02:19 +02:00
|
|
|
}, function(){
|
2017-05-19 12:41:07 +02:00
|
|
|
$scope.msg = {type:'error',text:'Error: During saving of '+$scope.count+' good(s) from product '+$scope.product.title+'.'};
|
2017-05-19 11:02:19 +02:00
|
|
|
});
|
2017-05-12 10:58:43 +02:00
|
|
|
};
|
|
|
|
}]);
|