Commit 9d5a67b2bfdc62d65983f890bac1b5f692e96e35
1 parent
2f1b8cfed0
Exists in
master
bugs, creación de nota pedido
Showing
1 changed file
with
34 additions
and
22 deletions
Show diff stats
src/js/controller.js
1 | angular.module('focaCrearNotaPedido') | 1 | angular.module('focaCrearNotaPedido') |
2 | .controller('notaPedidoCtrl', | 2 | .controller('notaPedidoCtrl', |
3 | ['$scope', '$uibModal', '$location', 'crearNotaPedidoService', 'focaModalService', | 3 | ['$scope', '$uibModal', '$location', 'crearNotaPedidoService', 'focaModalService', |
4 | function($scope, $uibModal, $location, crearNotaPedidoService, focaModalService) { | 4 | function($scope, $uibModal, $location, crearNotaPedidoService, focaModalService) { |
5 | $scope.show = false; | 5 | $scope.show = false; |
6 | $scope.edit = false; | 6 | $scope.cargando = true; |
7 | $scope.dateOptions = { | 7 | $scope.dateOptions = { |
8 | maxDate: new Date(), | 8 | maxDate: new Date(), |
9 | minDate: new Date(2010, 0, 1) | 9 | minDate: new Date(2010, 0, 1) |
10 | }; | 10 | }; |
11 | $scope.notaPedido = { | 11 | $scope.notaPedido = { |
12 | vendedor: {}, | 12 | vendedor: {}, |
13 | cliente: {} | 13 | cliente: {} |
14 | }; | 14 | }; |
15 | $scope.articulosTabla = []; | 15 | $scope.articulosTabla = []; |
16 | var idLista; | 16 | var idLista; |
17 | var notaPedidoTemp = crearNotaPedidoService.getNotaPedido(); | 17 | var notaPedidoTemp = crearNotaPedidoService.getNotaPedido(); |
18 | $scope.domiciliosCliente = crearNotaPedidoService.getDomicilios(1); | 18 | $scope.domiciliosCliente = crearNotaPedidoService.getDomicilios(1); |
19 | crearNotaPedidoService.getPrecioCondicion().then( | 19 | crearNotaPedidoService.getPrecioCondicion().then( |
20 | function(res) { | 20 | function(res) { |
21 | $scope.precioCondiciones = res.data; | 21 | $scope.precioCondiciones = res.data; |
22 | } | 22 | } |
23 | ); | 23 | ); |
24 | if (notaPedidoTemp !== undefined) { | 24 | if (notaPedidoTemp !== undefined) { |
25 | notaPedidoTemp.fechaCarga = new Date(notaPedidoTemp.fechaCarga); | 25 | notaPedidoTemp.fechaCarga = new Date(notaPedidoTemp.fechaCarga); |
26 | $scope.notaPedido = notaPedidoTemp; | 26 | $scope.notaPedido = notaPedidoTemp; |
27 | $scope.notaPedido.flete = ($scope.notaPedido.flete).toString(); | 27 | $scope.notaPedido.flete = ($scope.notaPedido.flete).toString(); |
28 | $scope.notaPedido.bomba = ($scope.notaPedido.bomba).toString(); | 28 | $scope.notaPedido.bomba = ($scope.notaPedido.bomba).toString(); |
29 | idLista = $scope.notaPedido.precioCondicion; | 29 | idLista = $scope.notaPedido.precioCondicion; |
30 | crearNotaPedidoService | 30 | crearNotaPedidoService |
31 | .getArticulosByIdNotaPedido($scope.notaPedido.id).then( | 31 | .getArticulosByIdNotaPedido($scope.notaPedido.id).then( |
32 | function(res) { | 32 | function(res) { |
33 | $scope.articulosTabla = res.data; | 33 | $scope.articulosTabla = res.data; |
34 | } | 34 | } |
35 | ); | 35 | ); |
36 | crearNotaPedidoService.getDomiciliosByIdNotaPedido($scope.notaPedido.id).then( | 36 | crearNotaPedidoService.getDomiciliosByIdNotaPedido($scope.notaPedido.id).then( |
37 | function(res) { | 37 | function(res) { |
38 | $scope.notaPedido.domicilio = res.data; | 38 | $scope.notaPedido.domicilio = res.data; |
39 | } | 39 | } |
40 | ); | 40 | ); |
41 | } else { | 41 | } else { |
42 | $scope.notaPedido.fechaCarga = new Date(); | 42 | $scope.notaPedido.fechaCarga = new Date(); |
43 | $scope.notaPedido.domicilio = [{ id: 0 }]; | 43 | $scope.notaPedido.domicilio = [{ id: 0 }]; |
44 | $scope.notaPedido.bomba = '1'; | 44 | $scope.notaPedido.bomba = '1'; |
45 | $scope.notaPedido.flete = '0'; | 45 | $scope.notaPedido.flete = '0'; |
46 | idLista = undefined; | 46 | idLista = undefined; |
47 | } | 47 | } |
48 | $scope.addNewDom = function() { | 48 | $scope.addNewDom = function() { |
49 | $scope.notaPedido.domicilio.push({ 'id': 0 }); | 49 | $scope.notaPedido.domicilio.push({ 'id': 0 }); |
50 | }; | 50 | }; |
51 | $scope.removeNewChoice = function(choice) { | 51 | $scope.removeNewChoice = function(choice) { |
52 | if ($scope.notaPedido.domicilio.length > 1) { | 52 | if ($scope.notaPedido.domicilio.length > 1) { |
53 | $scope.notaPedido.domicilio.splice($scope.notaPedido.domicilio.findIndex( | 53 | $scope.notaPedido.domicilio.splice($scope.notaPedido.domicilio.findIndex( |
54 | function(c) { | 54 | function(c) { |
55 | return c.$$hashKey === choice.$$hashKey; | 55 | return c.$$hashKey === choice.$$hashKey; |
56 | } | 56 | } |
57 | ), 1); | 57 | ), 1); |
58 | } | 58 | } |
59 | }; | 59 | }; |
60 | $scope.crearNotaPedido = function() { | 60 | $scope.crearNotaPedido = function() { |
61 | var notaPedido = { | 61 | var notaPedido = { |
62 | id: 0, | 62 | id: 0, |
63 | precioCondicion: $scope.notaPedido.precioCondicion, | ||
64 | fechaCarga: $scope.notaPedido.fechaCarga, | 63 | fechaCarga: $scope.notaPedido.fechaCarga, |
65 | vendedor: $scope.notaPedido.vendedor, | 64 | vendedor: $scope.notaPedido.vendedor.nombre, |
66 | cliente: $scope.notaPedido.cliente, | 65 | cliente: $scope.notaPedido.cliente.nombre, |
67 | producto: $scope.notaPedido.producto, | 66 | domicilio: $scope.notaPedido.domicilio.id, |
67 | precioCondicion: $scope.notaPedido.precioCondicion, | ||
68 | bomba: $scope.notaPedido.bomba, | 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 | flete: $scope.notaPedido.flete, | 69 | flete: $scope.notaPedido.flete, |
75 | costoUnitarioKmFlete: $scope.notaPedido.costoUnitarioKmFlete, | 70 | total: $scope.getTotal() |
76 | total: $scope.articulosTabla[0].subTotal | ||
77 | }; | 71 | }; |
78 | crearNotaPedidoService.crearNotaPedido(notaPedido).then( | 72 | crearNotaPedidoService.crearNotaPedido(notaPedido).then( |
79 | function() { | 73 | function() { |
80 | focaModalService('Nota pedido creada'); | 74 | focaModalService.alert('Nota pedido creada'); |
81 | $location.path('/venta-nota-pedido'); | 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 | var articulosNotaPedido = $scope.articulosTabla; | 87 | var articulosNotaPedido = $scope.articulosTabla; |
85 | for(var i = 0; i< articulosNotaPedido.length;i++) { | 88 | for(var i = 0; i< articulosNotaPedido.length;i++) { |
86 | crearNotaPedidoService | 89 | crearNotaPedidoService |
87 | .crearArticulosParaNotaPedido(articulosNotaPedido[i]).then( | 90 | .crearArticulosParaNotaPedido(articulosNotaPedido[i]).then( |
88 | function() { | 91 | function() { |
89 | return; | 92 | return; |
90 | } | 93 | } |
91 | ); | 94 | ); |
92 | } | 95 | } |
96 | |||
93 | }; | 97 | }; |
94 | $scope.siguienteTab = function() { | 98 | $scope.siguienteTab = function() { |
95 | $scope.active = 1; | 99 | $scope.active = 1; |
96 | }; | 100 | }; |
97 | $scope.seleccionarArticulo = function() { | 101 | $scope.seleccionarArticulo = function() { |
98 | if (idLista === undefined) { | 102 | if (idLista === undefined) { |
99 | focaModalService.alert( | 103 | focaModalService.alert( |
100 | 'primero seleccione una lista de precio y condicion'); | 104 | 'primero seleccione una lista de precio y condicion'); |
101 | return; | 105 | return; |
102 | } | 106 | } |
103 | var modalInstance = $uibModal.open( | 107 | var modalInstance = $uibModal.open( |
104 | { | 108 | { |
105 | ariaLabelledBy: 'Busqueda de Productos', | 109 | ariaLabelledBy: 'Busqueda de Productos', |
106 | templateUrl: 'modal-busqueda-productos.html', | 110 | templateUrl: 'modal-busqueda-productos.html', |
107 | controller: 'modalBusquedaProductosCtrl', | 111 | controller: 'modalBusquedaProductosCtrl', |
108 | resolve: { idLista: function() { return idLista; } }, | 112 | resolve: { idLista: function() { return idLista; } }, |
109 | size: 'lg' | 113 | size: 'lg' |
110 | } | 114 | } |
111 | ); | 115 | ); |
112 | modalInstance.result.then( | 116 | modalInstance.result.then( |
113 | function(producto) { | 117 | function(producto) { |
114 | var newArt = | 118 | var newArt = |
115 | { | 119 | { |
116 | id: 0, | 120 | id: 0, |
117 | codigo: producto.codigo, | 121 | codigo: producto.codigo, |
118 | sector: producto.sector, | 122 | sector: producto.sector, |
119 | descripcion: producto.descripcion, | 123 | descripcion: producto.descripcion, |
120 | item: $scope.articulosTabla.length + 1, | 124 | item: $scope.articulosTabla.length + 1, |
121 | nombre: producto.descripcion, | 125 | nombre: producto.descripcion, |
122 | precio: producto.precio.toFixed(2), | 126 | precio: producto.precio.toFixed(2), |
123 | costoUnitario: producto.costo, | 127 | costoUnitario: producto.costo, |
124 | cantidad: 1 | 128 | edit: false |
125 | }; | 129 | }; |
126 | $scope.articuloACargar = newArt; | 130 | $scope.articuloACargar = newArt; |
131 | $scope.cargando = false; | ||
127 | }, function() { | 132 | }, function() { |
128 | // funcion ejecutada cuando se cancela el modal | 133 | // funcion ejecutada cuando se cancela el modal |
129 | } | 134 | } |
130 | ); | 135 | ); |
131 | }; | 136 | }; |
132 | $scope.seleccionarVendedor = function() { | 137 | $scope.seleccionarVendedor = function() { |
133 | var modalInstance = $uibModal.open( | 138 | var modalInstance = $uibModal.open( |
134 | { | 139 | { |
135 | ariaLabelledBy: 'Busqueda de Vendedores', | 140 | ariaLabelledBy: 'Busqueda de Vendedores', |
136 | templateUrl: 'modal-vendedores.html', | 141 | templateUrl: 'modal-vendedores.html', |
137 | controller: 'modalVendedoresCtrl', | 142 | controller: 'modalVendedoresCtrl', |
138 | size: 'lg' | 143 | size: 'lg' |
139 | } | 144 | } |
140 | ); | 145 | ); |
141 | modalInstance.result.then( | 146 | modalInstance.result.then( |
142 | function(vendedor) { | 147 | function(vendedor) { |
143 | $scope.notaPedido.vendedor.nombre = vendedor.NomVen; | 148 | $scope.notaPedido.vendedor.nombre = vendedor.NomVen; |
144 | }, function() { | 149 | }, function() { |
145 | 150 | ||
146 | } | 151 | } |
147 | ); | 152 | ); |
148 | }; | 153 | }; |
149 | $scope.seleccionarPetrolera = function() { | 154 | $scope.seleccionarPetrolera = function() { |
150 | var modalInstance = $uibModal.open( | 155 | var modalInstance = $uibModal.open( |
151 | { | 156 | { |
152 | ariaLabelledBy: 'Busqueda de Petrolera', | 157 | ariaLabelledBy: 'Busqueda de Petrolera', |
153 | templateUrl: 'modal-petroleras.html', | 158 | templateUrl: 'modal-petroleras.html', |
154 | controller: 'modalPetrolerasCtrl', | 159 | controller: 'modalPetrolerasCtrl', |
155 | size: 'lg' | 160 | size: 'lg' |
156 | } | 161 | } |
157 | ); | 162 | ); |
158 | modalInstance.result.then( | 163 | modalInstance.result.then( |
159 | function(petrolera) { | 164 | function(petrolera) { |
160 | $scope.notaPedido.petrolera = petrolera.NOM; | 165 | $scope.notaPedido.petrolera = petrolera.NOM; |
161 | }, function() { | 166 | }, function() { |
162 | 167 | ||
163 | } | 168 | } |
164 | ); | 169 | ); |
165 | }; | 170 | }; |
166 | $scope.seleccionarCliente = function() { | 171 | $scope.seleccionarCliente = function() { |
167 | var modalInstance = $uibModal.open( | 172 | var modalInstance = $uibModal.open( |
168 | { | 173 | { |
169 | ariaLabelledBy: 'Busqueda de Cliente', | 174 | ariaLabelledBy: 'Busqueda de Cliente', |
170 | templateUrl: 'foca-busqueda-cliente-modal.html', | 175 | templateUrl: 'foca-busqueda-cliente-modal.html', |
171 | controller: 'focaBusquedaClienteModalController', | 176 | controller: 'focaBusquedaClienteModalController', |
172 | size: 'lg' | 177 | size: 'lg' |
173 | } | 178 | } |
174 | ); | 179 | ); |
175 | modalInstance.result.then( | 180 | modalInstance.result.then( |
176 | function(cliente) { | 181 | function(cliente) { |
177 | $scope.notaPedido.cliente.nombre = cliente.nom; | 182 | $scope.notaPedido.cliente.nombre = cliente.nom; |
178 | }, function() { | 183 | }, function() { |
179 | 184 | ||
180 | } | 185 | } |
181 | ); | 186 | ); |
182 | }; | 187 | }; |
183 | $scope.mostrarFichaCliente = function() { | 188 | $scope.mostrarFichaCliente = function() { |
184 | $uibModal.open( | 189 | $uibModal.open( |
185 | { | 190 | { |
186 | ariaLabelledBy: 'Datos del Cliente', | 191 | ariaLabelledBy: 'Datos del Cliente', |
187 | templateUrl: 'foca-crear-nota-pedido-ficha-cliente.html', | 192 | templateUrl: 'foca-crear-nota-pedido-ficha-cliente.html', |
188 | controller: 'focaCrearNotaPedidoFichaClienteController', | 193 | controller: 'focaCrearNotaPedidoFichaClienteController', |
189 | size: 'lg' | 194 | size: 'lg' |
190 | } | 195 | } |
191 | ); | 196 | ); |
192 | }; | 197 | }; |
193 | $scope.obtenerDomicilios = function(id) { | 198 | $scope.obtenerDomicilios = function(id) { |
194 | crearNotaPedidoService.getDomicilios(id).then( | 199 | crearNotaPedidoService.getDomicilios(id).then( |
195 | function(res) { | 200 | function(res) { |
196 | $scope.notaPedido.domicilio = res.data; | 201 | $scope.notaPedido.domicilio = res.data; |
197 | } | 202 | } |
198 | ); | 203 | ); |
199 | }; | 204 | }; |
200 | $scope.getTotal = function() { | 205 | $scope.getTotal = function() { |
201 | var total = 0; | 206 | var total = 0; |
202 | var array = $scope.articulosTabla; | 207 | var array = $scope.articulosTabla; |
203 | for (var i = 0; i < array.length; i++) { | 208 | for (var i = 0; i < array.length; i++) { |
204 | total += array[i].precio * array[i].cantidad; | 209 | total += array[i].precio * array[i].cantidad; |
205 | } | 210 | } |
206 | return total.toFixed(2); | 211 | return total.toFixed(2); |
207 | }; | 212 | }; |
208 | $scope.getSubTotal = function() { | 213 | $scope.getSubTotal = function() { |
209 | if($scope.articuloACargar) { | 214 | if($scope.articuloACargar) { |
210 | return $scope.articuloACargar.precio * $scope.articuloACargar.cantidad; | 215 | return $scope.articuloACargar.precio * $scope.articuloACargar.cantidad; |
211 | } | 216 | } |
212 | }; | 217 | }; |
213 | $scope.cargarArticulos = function() { | 218 | $scope.cargarArticulos = function() { |
214 | idLista = $scope.notaPedido.precioCondicion; | 219 | idLista = $scope.notaPedido.precioCondicion; |
215 | $scope.articulosTabla = []; | 220 | $scope.articulosTabla = []; |
216 | }; | 221 | }; |
217 | $scope.abrirModalListaPrecio = function() { | 222 | $scope.abrirModalListaPrecio = function() { |
218 | var modalInstance = $uibModal.open( | 223 | var modalInstance = $uibModal.open( |
219 | { | 224 | { |
220 | ariaLabelledBy: 'Busqueda de Precio Condición', | 225 | ariaLabelledBy: 'Busqueda de Precio Condición', |
221 | templateUrl: 'modal-precio-condicion.html', | 226 | templateUrl: 'modal-precio-condicion.html', |
222 | controller: 'focaModalPrecioCondicionController', | 227 | controller: 'focaModalPrecioCondicionController', |
223 | size: 'lg' | 228 | size: 'lg' |
224 | } | 229 | } |
225 | ); | 230 | ); |
226 | modalInstance.result.then( | 231 | modalInstance.result.then( |
227 | function(precioCondicion) { | 232 | function(precioCondicion) { |
228 | $scope.notaPedido.precioCondicion = precioCondicion.nombre; | 233 | $scope.notaPedido.precioCondicion = precioCondicion.nombre; |
229 | idLista = precioCondicion.idListaPrecio; | 234 | idLista = precioCondicion.idListaPrecio; |
230 | $scope.articulosTabla = []; | 235 | $scope.articulosTabla = []; |
231 | }, function() { | 236 | }, function() { |
232 | 237 | ||
233 | } | 238 | } |
234 | ); | 239 | ); |
235 | }; | 240 | }; |
236 | $scope.abrirModalFlete = function() { | 241 | $scope.abrirModalFlete = function() { |
237 | if($scope.notaPedido.flete === '1') { | 242 | if($scope.notaPedido.flete === '1') { |
238 | var modalInstance = $uibModal.open( | 243 | var modalInstance = $uibModal.open( |
239 | { | 244 | { |
240 | ariaLabelledBy: 'Busqueda de Flete', | 245 | ariaLabelledBy: 'Busqueda de Flete', |
241 | templateUrl: 'modal-flete.html', | 246 | templateUrl: 'modal-flete.html', |
242 | controller: 'focaModalFleteController', | 247 | controller: 'focaModalFleteController', |
243 | size: 'lg' | 248 | size: 'lg' |
244 | } | 249 | } |
245 | ); | 250 | ); |
246 | modalInstance.result.then( | 251 | modalInstance.result.then( |
247 | function(flete) { | 252 | function(flete) { |
248 | $scope.choferes = ''; | 253 | $scope.choferes = ''; |
249 | $scope.vehiculos = ''; | 254 | $scope.vehiculos = ''; |
255 | $scope.notaPedido.chofer = ''; | ||
256 | $scope.notaPedido.vehiculo = ''; | ||
257 | $scope.notaPedido.costoUnitarioKmFlete = ''; | ||
250 | $scope.notaPedido.fleteNombre = flete.nombre; | 258 | $scope.notaPedido.fleteNombre = flete.nombre; |
251 | $scope.notaPedido.costoUnitarioKmFlete = flete.costoKilometro; | 259 | $scope.notaPedido.fleteId = flete.id; |
252 | $scope.choferes = flete.chofer; | 260 | $scope.choferes = flete.chofer; |
253 | $scope.vehiculos = flete.vehiculo; | 261 | $scope.vehiculos = flete.vehiculo; |
254 | }, function() { | 262 | }, function() { |
255 | 263 | ||
256 | } | 264 | } |
257 | ); | 265 | ); |
258 | } | 266 | } |
259 | }; | 267 | }; |
260 | $scope.agregarATabla = function(key) { | 268 | $scope.agregarATabla = function(key) { |
261 | if(key === 13) { | 269 | if(key === 13) { |
262 | $scope.articulosTabla.unshift($scope.articuloACargar); | 270 | $scope.articulosTabla.unshift($scope.articuloACargar); |
263 | $scope.articuloACargar = undefined; | 271 | $scope.cargando = true; |
264 | } | 272 | } |
265 | }; | 273 | }; |
266 | $scope.quitarArticulo = function(key) { | 274 | $scope.quitarArticulo = function(key) { |
267 | $scope.articulosTabla.splice(key, 1); | 275 | $scope.articulosTabla.splice(key, 1); |
268 | }; | 276 | }; |
269 | $scope.editarArticulo = function(key) { | 277 | $scope.editarArticulo = function(key, articulo) { |
270 | if(key === 13) { | 278 | if(key === 13) { |
271 | $scope.edit = false; | 279 | articulo.edit = false; |
272 | } | 280 | } |
273 | }; | 281 | }; |
274 | $scope.cambioEdit = function() { | 282 | $scope.cambioEdit = function(articulo) { |
275 | $scope.edit = !$scope.edit ? true : false; | 283 | articulo.edit = true; |
276 | }; | 284 | }; |
277 | $scope.limpiarFlete = function() { | 285 | $scope.limpiarFlete = function() { |
278 | $scope.notaPedido.fleteNombre = ''; | 286 | $scope.notaPedido.fleteNombre = ''; |
279 | $scope.notaPedido.chofer = ''; | 287 | $scope.notaPedido.chofer = ''; |
280 | $scope.notaPedido.vehiculo = ''; | 288 | $scope.notaPedido.vehiculo = ''; |
281 | $scope.notaPedido.kilometros = ''; | 289 | $scope.notaPedido.kilometros = ''; |
282 | $scope.notaPedido.costoUnitarioKmFlete = ''; | 290 | $scope.notaPedido.costoUnitarioKmFlete = ''; |
283 | }; | 291 | }; |
284 | $scope.crearPedidoDemo = function() { | 292 | $scope.crearPedidoDemo = function() { |
285 | focaModalService.alert('Pedido Creado'); | 293 | focaModalService.alert('Pedido Creado'); |
286 | $scope.notaPedido.precioCondicion = ''; | 294 | $scope.notaPedido.precioCondicion = ''; |
287 | $scope.articulosTabla = []; | 295 | $scope.articulosTabla = []; |
288 | $scope.notaPedido.fleteNombre = ''; | 296 | $scope.notaPedido.fleteNombre = ''; |
289 | $scope.notaPedido.chofer = ''; | 297 | $scope.notaPedido.chofer = ''; |
290 | $scope.notaPedido.vehiculo = ''; | 298 | $scope.notaPedido.vehiculo = ''; |
291 | $scope.notaPedido.kilometros = ''; | 299 | $scope.notaPedido.kilometros = ''; |
292 | $scope.notaPedido.costoUnitarioKmFlete = ''; | 300 | $scope.notaPedido.costoUnitarioKmFlete = ''; |
293 | $scope.notaPedido.vendedor.nombre = ''; | 301 | $scope.notaPedido.vendedor.nombre = ''; |
294 | $scope.notaPedido.cliente.nombre = ''; | 302 | $scope.notaPedido.cliente.nombre = ''; |
295 | $scope.domicilio.dom = ''; | 303 | $scope.domicilio.dom = ''; |
296 | $scope.notaPedido.flete = 0; | 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 | ) |
301 | .controller('notaPedidoListaCtrl', [ | 313 | .controller('notaPedidoListaCtrl', [ |
302 | '$scope', | 314 | '$scope', |
303 | 'crearNotaPedidoService', | 315 | 'crearNotaPedidoService', |
304 | '$location', | 316 | '$location', |
305 | function($scope, crearNotaPedidoService, $location) { | 317 | function($scope, crearNotaPedidoService, $location) { |
306 | crearNotaPedidoService.obtenerNotaPedido().then(function(datos) { | 318 | crearNotaPedidoService.obtenerNotaPedido().then(function(datos) { |
307 | $scope.notaPedidos = datos.data; | 319 | $scope.notaPedidos = datos.data; |
308 | }); | 320 | }); |
309 | $scope.editar = function(notaPedido) { | 321 | $scope.editar = function(notaPedido) { |
310 | crearNotaPedidoService.setNotaPedido(notaPedido); | 322 | crearNotaPedidoService.setNotaPedido(notaPedido); |
311 | $location.path('/venta-nota-pedido/abm/'); | 323 | $location.path('/venta-nota-pedido/abm/'); |
312 | }; | 324 | }; |
313 | $scope.crearPedido = function() { | 325 | $scope.crearPedido = function() { |
314 | crearNotaPedidoService.clearNotaPedido(); | 326 | crearNotaPedidoService.clearNotaPedido(); |
315 | $location.path('/venta-nota-pedido/abm/'); | 327 | $location.path('/venta-nota-pedido/abm/'); |
316 | }; | 328 | }; |
317 | } | 329 | } |
318 | ]) | 330 | ]) |
319 | .controller('focaCrearNotaPedidoFichaClienteController', [ | 331 | .controller('focaCrearNotaPedidoFichaClienteController', [ |
320 | '$scope', | 332 | '$scope', |
321 | 'crearNotaPedidoService', | 333 | 'crearNotaPedidoService', |
322 | '$location', | 334 | '$location', |
323 | function($scope, crearNotaPedidoService, $location) { | 335 | function($scope, crearNotaPedidoService, $location) { |
324 | crearNotaPedidoService.obtenerNotaPedido().then(function(datos) { | 336 | crearNotaPedidoService.obtenerNotaPedido().then(function(datos) { |
325 | $scope.notaPedidos = datos.data; | 337 | $scope.notaPedidos = datos.data; |
326 | }); | 338 | }); |
327 | $scope.editar = function(notaPedido) { | 339 | $scope.editar = function(notaPedido) { |
328 | crearNotaPedidoService.setNotaPedido(notaPedido); | 340 | crearNotaPedidoService.setNotaPedido(notaPedido); |
329 | $location.path('/venta-nota-pedido/abm/'); | 341 | $location.path('/venta-nota-pedido/abm/'); |
330 | }; | 342 | }; |