|
|
@@ -1,3 +1,4 @@
|
|
|
+/* globals pedidosService: true */
|
|
|
app.controller('editPedidoCtrl', function ($scope, $http, $routeParams, notify, $location, $timeout, editing, pedidosService) {
|
|
|
$scope.cero=true;
|
|
|
$scope.total=0;
|
|
|
@@ -6,7 +7,7 @@ app.controller('editPedidoCtrl', function ($scope, $http, $routeParams, notify,
|
|
|
|
|
|
$scope.modificar = function() {
|
|
|
$scope.cero=true;
|
|
|
- }
|
|
|
+ };
|
|
|
|
|
|
$scope.confirmar = function() {
|
|
|
var filtrados = $scope.listaproductos.filter(function(el) { return el.cantidad > 0; });
|
|
|
@@ -65,7 +66,7 @@ app.controller('editPedidoCtrl', function ($scope, $http, $routeParams, notify,
|
|
|
var total=0;
|
|
|
total=$scope.listaproductos.reduce(
|
|
|
function(acc,cur) {
|
|
|
- return acc+(cur.cantidad*cur.precio)
|
|
|
+ return acc+(cur.cantidad*cur.precio);
|
|
|
},0);
|
|
|
$scope.total=total;
|
|
|
};
|
|
|
@@ -89,7 +90,7 @@ app.controller('editPedidoCtrl', function ($scope, $http, $routeParams, notify,
|
|
|
$http.post('back/pedido', { pedido: pedido } )
|
|
|
.success(function(data, status, headers, config) {
|
|
|
notify("Actualizado correctamente");
|
|
|
- $timeout(function() { $location.url("/"+$routeParams.hash) }, 2000);
|
|
|
+ $timeout(function() { $location.url("/"+$routeParams.hash); }, 2000);
|
|
|
})
|
|
|
.error(function(data, status, headers, config) {
|
|
|
notify({classes:"alert alert-danger", message:"Error: "+ data.err});
|