I have a form in grid format, in it I present information from the table Itens
of my bank (74 total).
The intent of this grid form is to add two fields: price and bdi price in all these items.
My problem is that I can not send the information of the 74 records in a single button.
I'm using ng-repeat
in the table to show the 74 items in my grid form, and even in this ng-repeat
I have the inputs.
HTML:
<div class="table-responsive">
<table class="table table-bordered table-hover table-condensed">
<thead>
<tr id="fundocoreditarcd">
<th>Código Tipo Item</th>
<th>Código Item</th>
<th>Descrição</th>
<th>Preço</th>
<th>Preço BDI</th>
<th>Ações</th>
</tr>
</thead>
<tbody>
<tr ng-repeat="item in itens">
<td>{{item.tipo_item_cod_tipo_item}}</td>
<td>{{item.cod_item}}</td>
<td>{{item.descricao}}</td>
<td><input type="text" ng-model="item.preco" class="money" id="preco" /></td>
<td><input type="text" ng-model="item.precoBdi" class="money" id="bdi" /></td>
<td><a href="/cid/editarLote"><span class="glyphicon glyphicon-pencil"></span></a> <a href="http://geradormemes.com/media/created/8kbx7r.jpg" class=""><span class="glyphicon glyphicon-trash"></span></a> </td>
</tr>
</tbody>
<button ng-click="addPrecoItens(item)" class="btn btn-primary">Enviar</button>
</table>
Part of the JS controller:
$http.get("read/itens")
.success(function (item) {
$scope.itens = item;
console.log($scope.itens);
})
.error(function (erro) {
console.log(erro);
});
$scope.addPrecoItens = function (item) {
$scope.itensLote = item;
console.log($scope.itensLote);
/*$http.put('read/itens/', $scope.itensLote)
.success(function () {
console.log($scope.itensLote);
$scope.mensagem = 'itens editados!';
})
.error(function (erro) {
$scope.mensagem = 'Erro ao editar itens!';
console.log(erro)
});*/
};