genofire/hs_monolith
genofire
/
hs_monolith
Archived
1
0
Fork 0

[TASK] add design to add form of goods

This commit is contained in:
Martin Geno 2017-05-12 11:54:59 +02:00
parent 0ffcf653c9
commit ced8a5d959
No known key found for this signature in database
GPG Key ID: F0D39A37E925E941
4 changed files with 24 additions and 8 deletions

View File

@ -16,7 +16,7 @@
<a class="item" ui-sref="statistics" ui-active="active">Statistics</a>< <a class="item" ui-sref="statistics" ui-active="active">Statistics</a><
<div class="right menu"> <div class="right menu">
<a class="ui item" ng-click="login()"> <a class="ui item" ng-click="login()">
<i class="icon" ng-class="{'unlock':loggedIn,'lock':!loggedIn}"></i> <i class="icon" ng-class="{'unlock':!loggedIn,'lock':loggedIn}"></i>
</a> </a>
</div> </div>
</div> </div>

View File

@ -1,5 +1,11 @@
<h1>{{product.title}}</h1> <h1>
<form class="ui form" ng-submit="submit()"> {{product.title}}
<a ui-sref="item({productid:product.id})">
<i class="icon linkify"></i>
</a>
</h1>
<form class="ui form segment" ng-submit="submit()" ng-class="{'top attached':msg.type}">
<div class="field"> <div class="field">
<label>Fouled at</label> <label>Fouled at</label>
<input type="date" name="fouled_at" placeholder="Fouled at date" ng-model="obj.fouled_at"> <input type="date" name="fouled_at" placeholder="Fouled at date" ng-model="obj.fouled_at">
@ -18,3 +24,6 @@
</div> </div>
<button class="ui button" type="submit">Submit</button> <button class="ui button" type="submit">Submit</button>
</form> </form>
<div class="ui bottom attached message {{msg.type}}" ng-show="msg.type">
{{msg.text}}
</div>

View File

@ -14,6 +14,9 @@
</tr> </tr>
</table> </table>
<h2>Goods of this product</h2> <h2>Goods of this product</h2>
<div class="ui warning message" ng-if="list.length <= 0">
<p>There are no goods for this product.</p>
</div>
<table class="ui table list" ng-if="list.length > 0"> <table class="ui table list" ng-if="list.length > 0">
<thead> <thead>
<tr> <tr>
@ -31,9 +34,7 @@
<td>{{item.position}}</td> <td>{{item.position}}</td>
<td>{{item.comment}}</td> <td>{{item.comment}}</td>
<td></td> <td></td>
<td valign="middle"> <td valign="middle"><img class="icon" ng-src="/api/good/freshness/{{item.id}}"/></td>
<img class="icon" ng-src="/api/good/freshness/{{item.id}}"/>
</td>
<td><i class="trash icon" ng-click="delete(item.id)"></i></td> <td><i class="trash icon" ng-click="delete(item.id)"></i></td>
</tr> </tr>
</tbody> </tbody>

View File

@ -4,6 +4,7 @@ angular.module('microStock')
.controller('ItemAddCtrl',['$scope','$http','$stateParams',function($scope,$http,$stateParams){ .controller('ItemAddCtrl',['$scope','$http','$stateParams',function($scope,$http,$stateParams){
$scope.product = {}; $scope.product = {};
$scope.obj = {}; $scope.obj = {};
$scope.msg = {};
$scope.count = 1; $scope.count = 1;
$http.get(config.microservice_dependencies.productById.replace("%d", $stateParams.productid)).then(function(res) { $http.get(config.microservice_dependencies.productById.replace("%d", $stateParams.productid)).then(function(res) {
@ -11,15 +12,20 @@ angular.module('microStock')
}); });
$scope.submit = function(){ $scope.submit = function(){
var count = 0;
function request(){ function request(){
count++;
return $http.post(config.store.goods.productById.replace("%d",$stateParams.productid),$scope.obj); return $http.post(config.store.goods.productById.replace("%d",$stateParams.productid),$scope.obj);
} }
var last = request(); var last = request();
for(var i=1;i < $scope.count;i++){ for(var i=1;i < $scope.count;i++){
last.then(request); last.then(request);
} }
last.then(null,function(){ last.then(function(){
console.log("did not work"); $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+'.'};
}) })
}; };
}]); }]);