Commit 313e64b260aed6f64b6b8158fa308ecd6cc8b397
Exists in
master
Merge branch 'master' into 'master'
limpio pantalla despues de crear nota pedido See merge request modulos-npm/foca-crear-nota-pedido!14
Showing
1 changed file
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.cargando = true; | 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 | fechaCarga: $scope.notaPedido.fechaCarga, | 63 | fechaCarga: $scope.notaPedido.fechaCarga, |
64 | vendedor: $scope.notaPedido.vendedor.nombre, | 64 | vendedor: $scope.notaPedido.vendedor.nombre, |
65 | cliente: $scope.notaPedido.cliente.nombre, | 65 | cliente: $scope.notaPedido.cliente.nombre, |
66 | domicilio: $scope.notaPedido.domicilio.id, | 66 | domicilio: $scope.notaPedido.domicilio.id, |
67 | precioCondicion: $scope.notaPedido.precioCondicion, | 67 | precioCondicion: $scope.notaPedido.precioCondicion, |
68 | bomba: $scope.notaPedido.bomba, | 68 | bomba: $scope.notaPedido.bomba, |
69 | flete: $scope.notaPedido.flete, | 69 | flete: $scope.notaPedido.flete, |
70 | total: $scope.getTotal() | 70 | total: $scope.getTotal() |
71 | }; | 71 | }; |
72 | crearNotaPedidoService.crearNotaPedido(notaPedido).then( | 72 | crearNotaPedidoService.crearNotaPedido(notaPedido).then( |
73 | function() { | 73 | function() { |
74 | focaModalService.alert('Nota pedido creada'); | 74 | focaModalService.alert('Nota pedido creada'); |
75 | // $location.path('/venta-nota-pedido'); | 75 | // $location.path('/venta-nota-pedido'); |
76 | // var flete = { | 76 | // var flete = { |
77 | // idNotaPedido: data.data.id, | 77 | // idNotaPedido: data.data.id, |
78 | // idTransportista: $scope.notaPedido.fleteId, | 78 | // idTransportista: $scope.notaPedido.fleteId, |
79 | // idChofer: $scope.chofer.id, | 79 | // idChofer: $scope.chofer.id, |
80 | // idVehiculo: $scope.vehiculo.id, | 80 | // idVehiculo: $scope.vehiculo.id, |
81 | // kilometros: $scope.notaPedido.kilometros, | 81 | // kilometros: $scope.notaPedido.kilometros, |
82 | // costoKilometro: $scope.notaPedido.costoUnitarioKmFlete | 82 | // costoKilometro: $scope.notaPedido.costoUnitarioKmFlete |
83 | // }; | 83 | // }; |
84 | //TO DO - Insert de flete | 84 | //TO DO - Insert de flete |
85 | } | 85 | } |
86 | ); | 86 | ); |
87 | var articulosNotaPedido = $scope.articulosTabla; | 87 | var articulosNotaPedido = $scope.articulosTabla; |
88 | for(var i = 0; i< articulosNotaPedido.length;i++) { | 88 | for(var i = 0; i< articulosNotaPedido.length;i++) { |
89 | delete articulosNotaPedido[i].edit; | ||
89 | crearNotaPedidoService | 90 | crearNotaPedidoService |
90 | .crearArticulosParaNotaPedido(articulosNotaPedido[i]).then( | 91 | .crearArticulosParaNotaPedido(articulosNotaPedido[i]).then( |
91 | function() { | 92 | function() { |
92 | return; | 93 | return; |
93 | } | 94 | } |
94 | ); | 95 | ); |
95 | } | 96 | } |
96 | 97 | $scope.notaPedido.precioCondicion = ''; | |
98 | $scope.articulosTabla = []; | ||
99 | $scope.notaPedido.fleteNombre = ''; | ||
100 | $scope.notaPedido.chofer = ''; | ||
101 | $scope.notaPedido.vehiculo = ''; | ||
102 | $scope.notaPedido.kilometros = ''; | ||
103 | $scope.notaPedido.costoUnitarioKmFlete = ''; | ||
104 | $scope.notaPedido.vendedor.nombre = ''; | ||
105 | $scope.notaPedido.cliente.nombre = ''; | ||
106 | $scope.domicilio = ''; | ||
107 | $scope.notaPedido.flete = 0; | ||
97 | }; | 108 | }; |
98 | $scope.siguienteTab = function() { | 109 | $scope.siguienteTab = function() { |
99 | $scope.active = 1; | 110 | $scope.active = 1; |
100 | }; | 111 | }; |
101 | $scope.seleccionarArticulo = function() { | 112 | $scope.seleccionarArticulo = function() { |
102 | if (idLista === undefined) { | 113 | if (idLista === undefined) { |
103 | focaModalService.alert( | 114 | focaModalService.alert( |
104 | 'primero seleccione una lista de precio y condicion'); | 115 | 'primero seleccione una lista de precio y condicion'); |
105 | return; | 116 | return; |
106 | } | 117 | } |
107 | var modalInstance = $uibModal.open( | 118 | var modalInstance = $uibModal.open( |
108 | { | 119 | { |
109 | ariaLabelledBy: 'Busqueda de Productos', | 120 | ariaLabelledBy: 'Busqueda de Productos', |
110 | templateUrl: 'modal-busqueda-productos.html', | 121 | templateUrl: 'modal-busqueda-productos.html', |
111 | controller: 'modalBusquedaProductosCtrl', | 122 | controller: 'modalBusquedaProductosCtrl', |
112 | resolve: { idLista: function() { return idLista; } }, | 123 | resolve: { idLista: function() { return idLista; } }, |
113 | size: 'lg' | 124 | size: 'lg' |
114 | } | 125 | } |
115 | ); | 126 | ); |
116 | modalInstance.result.then( | 127 | modalInstance.result.then( |
117 | function(producto) { | 128 | function(producto) { |
118 | var newArt = | 129 | var newArt = |
119 | { | 130 | { |
120 | id: 0, | 131 | id: 0, |
121 | codigo: producto.codigo, | 132 | codigo: producto.codigo, |
122 | sector: producto.sector, | 133 | sector: producto.sector, |
123 | descripcion: producto.descripcion, | 134 | descripcion: producto.descripcion, |
124 | item: $scope.articulosTabla.length + 1, | 135 | item: $scope.articulosTabla.length + 1, |
125 | nombre: producto.descripcion, | 136 | nombre: producto.descripcion, |
126 | precio: producto.precio.toFixed(2), | 137 | precio: producto.precio.toFixed(2), |
127 | costoUnitario: producto.costo, | 138 | costoUnitario: producto.costo, |
128 | edit: false | 139 | edit: false |
129 | }; | 140 | }; |
130 | $scope.articuloACargar = newArt; | 141 | $scope.articuloACargar = newArt; |
131 | $scope.cargando = false; | 142 | $scope.cargando = false; |
132 | }, function() { | 143 | }, function() { |
133 | // funcion ejecutada cuando se cancela el modal | 144 | // funcion ejecutada cuando se cancela el modal |
134 | } | 145 | } |
135 | ); | 146 | ); |
136 | }; | 147 | }; |
137 | $scope.seleccionarVendedor = function() { | 148 | $scope.seleccionarVendedor = function() { |
138 | var modalInstance = $uibModal.open( | 149 | var modalInstance = $uibModal.open( |
139 | { | 150 | { |
140 | ariaLabelledBy: 'Busqueda de Vendedores', | 151 | ariaLabelledBy: 'Busqueda de Vendedores', |
141 | templateUrl: 'modal-vendedores.html', | 152 | templateUrl: 'modal-vendedores.html', |
142 | controller: 'modalVendedoresCtrl', | 153 | controller: 'modalVendedoresCtrl', |
143 | size: 'lg' | 154 | size: 'lg' |
144 | } | 155 | } |
145 | ); | 156 | ); |
146 | modalInstance.result.then( | 157 | modalInstance.result.then( |
147 | function(vendedor) { | 158 | function(vendedor) { |
148 | $scope.notaPedido.vendedor.nombre = vendedor.NomVen; | 159 | $scope.notaPedido.vendedor.nombre = vendedor.NomVen; |
149 | }, function() { | 160 | }, function() { |
150 | 161 | ||
151 | } | 162 | } |
152 | ); | 163 | ); |
153 | }; | 164 | }; |
154 | $scope.seleccionarPetrolera = function() { | 165 | $scope.seleccionarPetrolera = function() { |
155 | var modalInstance = $uibModal.open( | 166 | var modalInstance = $uibModal.open( |
156 | { | 167 | { |
157 | ariaLabelledBy: 'Busqueda de Petrolera', | 168 | ariaLabelledBy: 'Busqueda de Petrolera', |
158 | templateUrl: 'modal-petroleras.html', | 169 | templateUrl: 'modal-petroleras.html', |
159 | controller: 'modalPetrolerasCtrl', | 170 | controller: 'modalPetrolerasCtrl', |
160 | size: 'lg' | 171 | size: 'lg' |
161 | } | 172 | } |
162 | ); | 173 | ); |
163 | modalInstance.result.then( | 174 | modalInstance.result.then( |
164 | function(petrolera) { | 175 | function(petrolera) { |
165 | $scope.notaPedido.petrolera = petrolera.NOM; | 176 | $scope.notaPedido.petrolera = petrolera.NOM; |
166 | }, function() { | 177 | }, function() { |
167 | 178 | ||
168 | } | 179 | } |
169 | ); | 180 | ); |
170 | }; | 181 | }; |
171 | $scope.seleccionarCliente = function() { | 182 | $scope.seleccionarCliente = function() { |
172 | var modalInstance = $uibModal.open( | 183 | var modalInstance = $uibModal.open( |
173 | { | 184 | { |
174 | ariaLabelledBy: 'Busqueda de Cliente', | 185 | ariaLabelledBy: 'Busqueda de Cliente', |
175 | templateUrl: 'foca-busqueda-cliente-modal.html', | 186 | templateUrl: 'foca-busqueda-cliente-modal.html', |
176 | controller: 'focaBusquedaClienteModalController', | 187 | controller: 'focaBusquedaClienteModalController', |
177 | size: 'lg' | 188 | size: 'lg' |
178 | } | 189 | } |
179 | ); | 190 | ); |
180 | modalInstance.result.then( | 191 | modalInstance.result.then( |
181 | function(cliente) { | 192 | function(cliente) { |
182 | $scope.notaPedido.cliente.nombre = cliente.nom; | 193 | $scope.notaPedido.cliente.nombre = cliente.nom; |
183 | }, function() { | 194 | }, function() { |
184 | 195 | ||
185 | } | 196 | } |
186 | ); | 197 | ); |
187 | }; | 198 | }; |
188 | $scope.mostrarFichaCliente = function() { | 199 | $scope.mostrarFichaCliente = function() { |
189 | $uibModal.open( | 200 | $uibModal.open( |
190 | { | 201 | { |
191 | ariaLabelledBy: 'Datos del Cliente', | 202 | ariaLabelledBy: 'Datos del Cliente', |
192 | templateUrl: 'foca-crear-nota-pedido-ficha-cliente.html', | 203 | templateUrl: 'foca-crear-nota-pedido-ficha-cliente.html', |
193 | controller: 'focaCrearNotaPedidoFichaClienteController', | 204 | controller: 'focaCrearNotaPedidoFichaClienteController', |
194 | size: 'lg' | 205 | size: 'lg' |
195 | } | 206 | } |
196 | ); | 207 | ); |
197 | }; | 208 | }; |
198 | $scope.obtenerDomicilios = function(id) { | 209 | $scope.obtenerDomicilios = function(id) { |
199 | crearNotaPedidoService.getDomicilios(id).then( | 210 | crearNotaPedidoService.getDomicilios(id).then( |
200 | function(res) { | 211 | function(res) { |
201 | $scope.notaPedido.domicilio = res.data; | 212 | $scope.notaPedido.domicilio = res.data; |
202 | } | 213 | } |
203 | ); | 214 | ); |
204 | }; | 215 | }; |
205 | $scope.getTotal = function() { | 216 | $scope.getTotal = function() { |
206 | var total = 0; | 217 | var total = 0; |
207 | var array = $scope.articulosTabla; | 218 | var array = $scope.articulosTabla; |
208 | for (var i = 0; i < array.length; i++) { | 219 | for (var i = 0; i < array.length; i++) { |
209 | total += array[i].precio * array[i].cantidad; | 220 | total += array[i].precio * array[i].cantidad; |
210 | } | 221 | } |
211 | return total.toFixed(2); | 222 | return total.toFixed(2); |
212 | }; | 223 | }; |
213 | $scope.getSubTotal = function() { | 224 | $scope.getSubTotal = function() { |
214 | if($scope.articuloACargar) { | 225 | if($scope.articuloACargar) { |
215 | return $scope.articuloACargar.precio * $scope.articuloACargar.cantidad; | 226 | return $scope.articuloACargar.precio * $scope.articuloACargar.cantidad; |
216 | } | 227 | } |
217 | }; | 228 | }; |
218 | $scope.cargarArticulos = function() { | 229 | $scope.cargarArticulos = function() { |
219 | idLista = $scope.notaPedido.precioCondicion; | 230 | idLista = $scope.notaPedido.precioCondicion; |
220 | $scope.articulosTabla = []; | 231 | $scope.articulosTabla = []; |
221 | }; | 232 | }; |
222 | $scope.abrirModalListaPrecio = function() { | 233 | $scope.abrirModalListaPrecio = function() { |
223 | var modalInstance = $uibModal.open( | 234 | var modalInstance = $uibModal.open( |
224 | { | 235 | { |
225 | ariaLabelledBy: 'Busqueda de Precio Condición', | 236 | ariaLabelledBy: 'Busqueda de Precio Condición', |
226 | templateUrl: 'modal-precio-condicion.html', | 237 | templateUrl: 'modal-precio-condicion.html', |
227 | controller: 'focaModalPrecioCondicionController', | 238 | controller: 'focaModalPrecioCondicionController', |
228 | size: 'lg' | 239 | size: 'lg' |
229 | } | 240 | } |
230 | ); | 241 | ); |
231 | modalInstance.result.then( | 242 | modalInstance.result.then( |
232 | function(precioCondicion) { | 243 | function(precioCondicion) { |
233 | $scope.notaPedido.precioCondicion = precioCondicion.nombre; | 244 | $scope.notaPedido.precioCondicion = precioCondicion.nombre; |
234 | idLista = precioCondicion.idListaPrecio; | 245 | idLista = precioCondicion.idListaPrecio; |
235 | $scope.articulosTabla = []; | 246 | $scope.articulosTabla = []; |
236 | }, function() { | 247 | }, function() { |
237 | 248 | ||
238 | } | 249 | } |
239 | ); | 250 | ); |
240 | }; | 251 | }; |
241 | $scope.abrirModalFlete = function() { | 252 | $scope.abrirModalFlete = function() { |
242 | if($scope.notaPedido.flete === '1') { | 253 | if($scope.notaPedido.flete === '1') { |
243 | var modalInstance = $uibModal.open( | 254 | var modalInstance = $uibModal.open( |
244 | { | 255 | { |
245 | ariaLabelledBy: 'Busqueda de Flete', | 256 | ariaLabelledBy: 'Busqueda de Flete', |
246 | templateUrl: 'modal-flete.html', | 257 | templateUrl: 'modal-flete.html', |
247 | controller: 'focaModalFleteController', | 258 | controller: 'focaModalFleteController', |
248 | size: 'lg' | 259 | size: 'lg' |
249 | } | 260 | } |
250 | ); | 261 | ); |
251 | modalInstance.result.then( | 262 | modalInstance.result.then( |
252 | function(flete) { | 263 | function(flete) { |
253 | $scope.choferes = ''; | 264 | $scope.choferes = ''; |
254 | $scope.vehiculos = ''; | 265 | $scope.vehiculos = ''; |
255 | $scope.notaPedido.chofer = ''; | 266 | $scope.notaPedido.chofer = ''; |
256 | $scope.notaPedido.vehiculo = ''; | 267 | $scope.notaPedido.vehiculo = ''; |
257 | $scope.notaPedido.costoUnitarioKmFlete = ''; | 268 | $scope.notaPedido.costoUnitarioKmFlete = ''; |
258 | $scope.notaPedido.fleteNombre = flete.nombre; | 269 | $scope.notaPedido.fleteNombre = flete.nombre; |
259 | $scope.notaPedido.fleteId = flete.id; | 270 | $scope.notaPedido.fleteId = flete.id; |
260 | $scope.choferes = flete.chofer; | 271 | $scope.choferes = flete.chofer; |
261 | $scope.vehiculos = flete.vehiculo; | 272 | $scope.vehiculos = flete.vehiculo; |
262 | }, function() { | 273 | }, function() { |
263 | 274 | ||
264 | } | 275 | } |
265 | ); | 276 | ); |
266 | } | 277 | } |
267 | }; | 278 | }; |
268 | $scope.agregarATabla = function(key) { | 279 | $scope.agregarATabla = function(key) { |
269 | if(key === 13) { | 280 | if(key === 13) { |
270 | if($scope.articuloACargar.cantidad === undefined || | 281 | if($scope.articuloACargar.cantidad === undefined || |
271 | $scope.articuloACargar.cantidad === 0 || | 282 | $scope.articuloACargar.cantidad === 0 || |
272 | $scope.articuloACargar.cantidad === null ){ | 283 | $scope.articuloACargar.cantidad === null ){ |
273 | focaModalService.alert('El valor debe ser al menos 1'); | 284 | focaModalService.alert('El valor debe ser al menos 1'); |
274 | return; | 285 | return; |
275 | } | 286 | } |
276 | $scope.articulosTabla.unshift($scope.articuloACargar); | 287 | $scope.articulosTabla.unshift($scope.articuloACargar); |
277 | $scope.cargando = true; | 288 | $scope.cargando = true; |
278 | } | 289 | } |
279 | }; | 290 | }; |
280 | $scope.quitarArticulo = function(key) { | 291 | $scope.quitarArticulo = function(key) { |
281 | $scope.articulosTabla.splice(key, 1); | 292 | $scope.articulosTabla.splice(key, 1); |
282 | }; | 293 | }; |
283 | $scope.editarArticulo = function(key, articulo) { | 294 | $scope.editarArticulo = function(key, articulo) { |
284 | if(key === 13) { | 295 | if(key === 13) { |
285 | if(articulo.cantidad === null || articulo.cantidad === 0 || | 296 | if(articulo.cantidad === null || articulo.cantidad === 0 || |
286 | articulo.cantidad === undefined){ | 297 | articulo.cantidad === undefined){ |
287 | focaModalService.alert('El valor debe ser al menos 1'); | 298 | focaModalService.alert('El valor debe ser al menos 1'); |
288 | return; | 299 | return; |
289 | } | 300 | } |
290 | articulo.edit = false; | 301 | articulo.edit = false; |
291 | } | 302 | } |
292 | }; | 303 | }; |
293 | $scope.cambioEdit = function(articulo) { | 304 | $scope.cambioEdit = function(articulo) { |
294 | articulo.edit = true; | 305 | articulo.edit = true; |
295 | }; | 306 | }; |
296 | $scope.limpiarFlete = function() { | 307 | $scope.limpiarFlete = function() { |
297 | $scope.notaPedido.fleteNombre = ''; | 308 | $scope.notaPedido.fleteNombre = ''; |
298 | $scope.notaPedido.chofer = ''; | 309 | $scope.notaPedido.chofer = ''; |
299 | $scope.notaPedido.vehiculo = ''; | 310 | $scope.notaPedido.vehiculo = ''; |
300 | $scope.notaPedido.kilometros = ''; | 311 | $scope.notaPedido.kilometros = ''; |
301 | $scope.notaPedido.costoUnitarioKmFlete = ''; | 312 | $scope.notaPedido.costoUnitarioKmFlete = ''; |
302 | }; | 313 | }; |
303 | $scope.crearPedidoDemo = function() { | 314 | $scope.crearPedidoDemo = function() { |
304 | focaModalService.alert('Pedido Creado'); | 315 | focaModalService.alert('Pedido Creado'); |
305 | $scope.notaPedido.precioCondicion = ''; | 316 | $scope.notaPedido.precioCondicion = ''; |
306 | $scope.articulosTabla = []; | 317 | $scope.articulosTabla = []; |
307 | $scope.notaPedido.fleteNombre = ''; | 318 | $scope.notaPedido.fleteNombre = ''; |
308 | $scope.notaPedido.chofer = ''; | 319 | $scope.notaPedido.chofer = ''; |
309 | $scope.notaPedido.vehiculo = ''; | 320 | $scope.notaPedido.vehiculo = ''; |
310 | $scope.notaPedido.kilometros = ''; | 321 | $scope.notaPedido.kilometros = ''; |
311 | $scope.notaPedido.costoUnitarioKmFlete = ''; | 322 | $scope.notaPedido.costoUnitarioKmFlete = ''; |
312 | $scope.notaPedido.vendedor.nombre = ''; | 323 | $scope.notaPedido.vendedor.nombre = ''; |
313 | $scope.notaPedido.cliente.nombre = ''; | 324 | $scope.notaPedido.cliente.nombre = ''; |
314 | $scope.domicilio.dom = ''; | 325 | $scope.domicilio.dom = ''; |
315 | $scope.notaPedido.flete = 0; | 326 | $scope.notaPedido.flete = 0; |
316 | }; | 327 | }; |
317 | $scope.resetFilter = function() { | 328 | $scope.resetFilter = function() { |
318 | $scope.articuloACargar = {}; | 329 | $scope.articuloACargar = {}; |
319 | $scope.cargando = true; | 330 | $scope.cargando = true; |
320 | }; | 331 | }; |
321 | } | 332 | } |
322 | ] | 333 | ] |
323 | ) | 334 | ) |
324 | .controller('notaPedidoListaCtrl', [ | 335 | .controller('notaPedidoListaCtrl', [ |
325 | '$scope', | 336 | '$scope', |
326 | 'crearNotaPedidoService', | 337 | 'crearNotaPedidoService', |
327 | '$location', | 338 | '$location', |
328 | function($scope, crearNotaPedidoService, $location) { | 339 | function($scope, crearNotaPedidoService, $location) { |
329 | crearNotaPedidoService.obtenerNotaPedido().then(function(datos) { | 340 | crearNotaPedidoService.obtenerNotaPedido().then(function(datos) { |
330 | $scope.notaPedidos = datos.data; | 341 | $scope.notaPedidos = datos.data; |
331 | }); | 342 | }); |
332 | $scope.editar = function(notaPedido) { | 343 | $scope.editar = function(notaPedido) { |
333 | crearNotaPedidoService.setNotaPedido(notaPedido); | 344 | crearNotaPedidoService.setNotaPedido(notaPedido); |
334 | $location.path('/venta-nota-pedido/abm/'); | 345 | $location.path('/venta-nota-pedido/abm/'); |
335 | }; | 346 | }; |
336 | $scope.crearPedido = function() { | 347 | $scope.crearPedido = function() { |
337 | crearNotaPedidoService.clearNotaPedido(); | 348 | crearNotaPedidoService.clearNotaPedido(); |
338 | $location.path('/venta-nota-pedido/abm/'); | 349 | $location.path('/venta-nota-pedido/abm/'); |
339 | }; | 350 | }; |
340 | } | 351 | } |
341 | ]) | 352 | ]) |
342 | .controller('focaCrearNotaPedidoFichaClienteController', [ | 353 | .controller('focaCrearNotaPedidoFichaClienteController', [ |
343 | '$scope', | 354 | '$scope', |
344 | 'crearNotaPedidoService', | 355 | 'crearNotaPedidoService', |
345 | '$location', | 356 | '$location', |
346 | function($scope, crearNotaPedidoService, $location) { | 357 | function($scope, crearNotaPedidoService, $location) { |
347 | crearNotaPedidoService.obtenerNotaPedido().then(function(datos) { | 358 | crearNotaPedidoService.obtenerNotaPedido().then(function(datos) { |
348 | $scope.notaPedidos = datos.data; | 359 | $scope.notaPedidos = datos.data; |
349 | }); | 360 | }); |
350 | $scope.editar = function(notaPedido) { | 361 | $scope.editar = function(notaPedido) { |
351 | crearNotaPedidoService.setNotaPedido(notaPedido); | 362 | crearNotaPedidoService.setNotaPedido(notaPedido); |
352 | $location.path('/venta-nota-pedido/abm/'); | 363 | $location.path('/venta-nota-pedido/abm/'); |
353 | }; | 364 | }; |
354 | $scope.crearPedido = function() { | 365 | $scope.crearPedido = function() { |
355 | crearNotaPedidoService.clearNotaPedido(); | 366 | crearNotaPedidoService.clearNotaPedido(); |
356 | $location.path('/venta-nota-pedido/abm/'); | 367 | $location.path('/venta-nota-pedido/abm/'); |
357 | }; | 368 | }; |
358 | } | 369 | } |
359 | ]); | 370 | ]); |
360 | 371 |