Commit 9d5a67b2bfdc62d65983f890bac1b5f692e96e35
1 parent
2f1b8cfed0
Exists in
master
and in
1 other branch
bugs, creación de nota pedido
Showing
1 changed file
with
34 additions
and
22 deletions
Show diff stats
src/js/controller.js
... | ... | @@ -3,7 +3,7 @@ angular.module('focaCrearNotaPedido') |
3 | 3 | ['$scope', '$uibModal', '$location', 'crearNotaPedidoService', 'focaModalService', |
4 | 4 | function($scope, $uibModal, $location, crearNotaPedidoService, focaModalService) { |
5 | 5 | $scope.show = false; |
6 | - $scope.edit = false; | |
6 | + $scope.cargando = true; | |
7 | 7 | $scope.dateOptions = { |
8 | 8 | maxDate: new Date(), |
9 | 9 | minDate: new Date(2010, 0, 1) |
... | ... | @@ -60,25 +60,28 @@ angular.module('focaCrearNotaPedido') |
60 | 60 | $scope.crearNotaPedido = function() { |
61 | 61 | var notaPedido = { |
62 | 62 | id: 0, |
63 | - precioCondicion: $scope.notaPedido.precioCondicion, | |
64 | 63 | fechaCarga: $scope.notaPedido.fechaCarga, |
65 | - vendedor: $scope.notaPedido.vendedor, | |
66 | - cliente: $scope.notaPedido.cliente, | |
67 | - producto: $scope.notaPedido.producto, | |
64 | + vendedor: $scope.notaPedido.vendedor.nombre, | |
65 | + cliente: $scope.notaPedido.cliente.nombre, | |
66 | + domicilio: $scope.notaPedido.domicilio.id, | |
67 | + precioCondicion: $scope.notaPedido.precioCondicion, | |
68 | 68 | bomba: $scope.notaPedido.bomba, |
69 | - petrolera: $scope.notaPedido.petrolera, | |
70 | - domicilio: $scope.notaPedido.domicilio, | |
71 | - kilometros: $scope.notaPedido.kilometros, | |
72 | - jurisdiccionIIBB: $scope.notaPedido.jurisdiccionIIBB, | |
73 | - costoFinanciacion: $scope.notaPedido.costoFinanciacion, | |
74 | 69 | flete: $scope.notaPedido.flete, |
75 | - costoUnitarioKmFlete: $scope.notaPedido.costoUnitarioKmFlete, | |
76 | - total: $scope.articulosTabla[0].subTotal | |
70 | + total: $scope.getTotal() | |
77 | 71 | }; |
78 | 72 | crearNotaPedidoService.crearNotaPedido(notaPedido).then( |
79 | 73 | function() { |
80 | - focaModalService('Nota pedido creada'); | |
81 | - $location.path('/venta-nota-pedido'); | |
74 | + focaModalService.alert('Nota pedido creada'); | |
75 | + // $location.path('/venta-nota-pedido'); | |
76 | + // var flete = { | |
77 | + // idNotaPedido: data.data.id, | |
78 | + // idTransportista: $scope.notaPedido.fleteId, | |
79 | + // idChofer: $scope.chofer.id, | |
80 | + // idVehiculo: $scope.vehiculo.id, | |
81 | + // kilometros: $scope.notaPedido.kilometros, | |
82 | + // costoKilometro: $scope.notaPedido.costoUnitarioKmFlete | |
83 | + // }; | |
84 | + //TO DO - Insert de flete | |
82 | 85 | } |
83 | 86 | ); |
84 | 87 | var articulosNotaPedido = $scope.articulosTabla; |
... | ... | @@ -90,6 +93,7 @@ angular.module('focaCrearNotaPedido') |
90 | 93 | } |
91 | 94 | ); |
92 | 95 | } |
96 | + | |
93 | 97 | }; |
94 | 98 | $scope.siguienteTab = function() { |
95 | 99 | $scope.active = 1; |
... | ... | @@ -121,9 +125,10 @@ angular.module('focaCrearNotaPedido') |
121 | 125 | nombre: producto.descripcion, |
122 | 126 | precio: producto.precio.toFixed(2), |
123 | 127 | costoUnitario: producto.costo, |
124 | - cantidad: 1 | |
128 | + edit: false | |
125 | 129 | }; |
126 | 130 | $scope.articuloACargar = newArt; |
131 | + $scope.cargando = false; | |
127 | 132 | }, function() { |
128 | 133 | // funcion ejecutada cuando se cancela el modal |
129 | 134 | } |
... | ... | @@ -247,8 +252,11 @@ angular.module('focaCrearNotaPedido') |
247 | 252 | function(flete) { |
248 | 253 | $scope.choferes = ''; |
249 | 254 | $scope.vehiculos = ''; |
255 | + $scope.notaPedido.chofer = ''; | |
256 | + $scope.notaPedido.vehiculo = ''; | |
257 | + $scope.notaPedido.costoUnitarioKmFlete = ''; | |
250 | 258 | $scope.notaPedido.fleteNombre = flete.nombre; |
251 | - $scope.notaPedido.costoUnitarioKmFlete = flete.costoKilometro; | |
259 | + $scope.notaPedido.fleteId = flete.id; | |
252 | 260 | $scope.choferes = flete.chofer; |
253 | 261 | $scope.vehiculos = flete.vehiculo; |
254 | 262 | }, function() { |
... | ... | @@ -260,19 +268,19 @@ angular.module('focaCrearNotaPedido') |
260 | 268 | $scope.agregarATabla = function(key) { |
261 | 269 | if(key === 13) { |
262 | 270 | $scope.articulosTabla.unshift($scope.articuloACargar); |
263 | - $scope.articuloACargar = undefined; | |
271 | + $scope.cargando = true; | |
264 | 272 | } |
265 | 273 | }; |
266 | 274 | $scope.quitarArticulo = function(key) { |
267 | 275 | $scope.articulosTabla.splice(key, 1); |
268 | 276 | }; |
269 | - $scope.editarArticulo = function(key) { | |
277 | + $scope.editarArticulo = function(key, articulo) { | |
270 | 278 | if(key === 13) { |
271 | - $scope.edit = false; | |
272 | - } | |
279 | + articulo.edit = false; | |
280 | + } | |
273 | 281 | }; |
274 | - $scope.cambioEdit = function() { | |
275 | - $scope.edit = !$scope.edit ? true : false; | |
282 | + $scope.cambioEdit = function(articulo) { | |
283 | + articulo.edit = true; | |
276 | 284 | }; |
277 | 285 | $scope.limpiarFlete = function() { |
278 | 286 | $scope.notaPedido.fleteNombre = ''; |
... | ... | @@ -295,6 +303,10 @@ angular.module('focaCrearNotaPedido') |
295 | 303 | $scope.domicilio.dom = ''; |
296 | 304 | $scope.notaPedido.flete = 0; |
297 | 305 | }; |
306 | + $scope.resetFilter = function() { | |
307 | + $scope.articuloACargar = {}; | |
308 | + $scope.cargando = true; | |
309 | + }; | |
298 | 310 | } |
299 | 311 | ] |
300 | 312 | ) |