From ced8a5d9598f650a15c154a8e07d9ff5011d64b6 Mon Sep 17 00:00:00 2001 From: Martin Geno Date: Fri, 12 May 2017 11:54:59 +0200 Subject: [PATCH] [TASK] add design to add form of goods --- webroot/index.html | 2 +- webroot/static/html/item-add.html | 13 +++++++++++-- webroot/static/html/item.html | 7 ++++--- webroot/static/js/item-add.controller.js | 10 ++++++++-- 4 files changed, 24 insertions(+), 8 deletions(-) diff --git a/webroot/index.html b/webroot/index.html index 96f9523..cbb3565 100644 --- a/webroot/index.html +++ b/webroot/index.html @@ -16,7 +16,7 @@ Statistics< diff --git a/webroot/static/html/item-add.html b/webroot/static/html/item-add.html index f809a35..6c88903 100644 --- a/webroot/static/html/item-add.html +++ b/webroot/static/html/item-add.html @@ -1,5 +1,11 @@ -

{{product.title}}

-
+

+ {{product.title}} + + + +

+ +
@@ -18,3 +24,6 @@
+
+ {{msg.text}} +
diff --git a/webroot/static/html/item.html b/webroot/static/html/item.html index a3003ee..8e15bb8 100644 --- a/webroot/static/html/item.html +++ b/webroot/static/html/item.html @@ -14,6 +14,9 @@

Goods of this product

+
+

There are no goods for this product.

+
@@ -31,9 +34,7 @@ - + diff --git a/webroot/static/js/item-add.controller.js b/webroot/static/js/item-add.controller.js index bc005de..56b017a 100644 --- a/webroot/static/js/item-add.controller.js +++ b/webroot/static/js/item-add.controller.js @@ -4,6 +4,7 @@ angular.module('microStock') .controller('ItemAddCtrl',['$scope','$http','$stateParams',function($scope,$http,$stateParams){ $scope.product = {}; $scope.obj = {}; + $scope.msg = {}; $scope.count = 1; $http.get(config.microservice_dependencies.productById.replace("%d", $stateParams.productid)).then(function(res) { @@ -11,15 +12,20 @@ angular.module('microStock') }); $scope.submit = function(){ + var count = 0; function request(){ + count++; return $http.post(config.store.goods.productById.replace("%d",$stateParams.productid),$scope.obj); } var last = request(); for(var i=1;i < $scope.count;i++){ last.then(request); } - last.then(null,function(){ - console.log("did not work"); + last.then(function(){ + $scope.obj = {}; + $scope.msg = {type:'success',text:'There was '+count+' goods saved from '+$scope.product.title+'.'}; + },function(){ + $scope.msg = {type:'error',text:'There was '+count+' goods saved from '+$scope.product.title+'.'}; }) }; }]);
{{item.position}} {{item.comment}} - -