Commit 0ed74d25c8a6ebbd6e783d226e737c0520353971
1 parent
e75ea99a47
Exists in
master
validacion domicilio antes de guardar
Showing
1 changed file
with
5 additions
and
2 deletions
Show diff stats
src/js/controller.js
1 | angular.module('focaCrearNotaPedido') .controller('notaPedidoCtrl', | 1 | angular.module('focaCrearNotaPedido') .controller('notaPedidoCtrl', |
2 | [ | 2 | [ |
3 | '$scope', | 3 | '$scope', |
4 | '$uibModal', | 4 | '$uibModal', |
5 | '$location', | 5 | '$location', |
6 | '$filter', | 6 | '$filter', |
7 | '$timeout', | 7 | '$timeout', |
8 | 'crearNotaPedidoService', | 8 | 'crearNotaPedidoService', |
9 | 'focaBotoneraLateralService', | 9 | 'focaBotoneraLateralService', |
10 | 'focaModalService', | 10 | 'focaModalService', |
11 | 'notaPedidoBusinessService', | 11 | 'notaPedidoBusinessService', |
12 | '$rootScope', | 12 | '$rootScope', |
13 | 'focaSeguimientoService', | 13 | 'focaSeguimientoService', |
14 | 'APP', | 14 | 'APP', |
15 | 'focaLoginService', | 15 | 'focaLoginService', |
16 | function( | 16 | function( |
17 | $scope, $uibModal, $location, $filter, $timeout, crearNotaPedidoService, | 17 | $scope, $uibModal, $location, $filter, $timeout, crearNotaPedidoService, |
18 | focaBotoneraLateralService, focaModalService, notaPedidoBusinessService, | 18 | focaBotoneraLateralService, focaModalService, notaPedidoBusinessService, |
19 | $rootScope, focaSeguimientoService, APP, focaLoginService) | 19 | $rootScope, focaSeguimientoService, APP, focaLoginService) |
20 | { | 20 | { |
21 | config(); | 21 | config(); |
22 | 22 | ||
23 | function config() { | 23 | function config() { |
24 | // PARAMETROS INICIALES PARA FUNCIONAMIENTO DEL PROGRAMA | 24 | // PARAMETROS INICIALES PARA FUNCIONAMIENTO DEL PROGRAMA |
25 | $scope.isNumber = angular.isNumber; | 25 | $scope.isNumber = angular.isNumber; |
26 | $scope.datepickerAbierto = false; | 26 | $scope.datepickerAbierto = false; |
27 | $scope.show = false; | 27 | $scope.show = false; |
28 | $scope.cargando = true; | 28 | $scope.cargando = true; |
29 | $scope.now = new Date(); | 29 | $scope.now = new Date(); |
30 | $scope.puntoVenta = $filter('rellenarDigitos')(0, 4); | 30 | $scope.puntoVenta = $filter('rellenarDigitos')(0, 4); |
31 | $scope.comprobante = $filter('rellenarDigitos')(0, 8); | 31 | $scope.comprobante = $filter('rellenarDigitos')(0, 8); |
32 | $scope.dateOptions = { | 32 | $scope.dateOptions = { |
33 | maxDate: new Date(), | 33 | maxDate: new Date(), |
34 | minDate: new Date(2010, 0, 1) | 34 | minDate: new Date(2010, 0, 1) |
35 | }; | 35 | }; |
36 | 36 | ||
37 | //Trabajo con la cotización más reciente, por eso uso siempre la primera '[0]' | 37 | //Trabajo con la cotización más reciente, por eso uso siempre la primera '[0]' |
38 | var monedaPorDefecto; | 38 | var monedaPorDefecto; |
39 | crearNotaPedidoService.getCotizacionByIdMoneda(1).then(function(res) { | 39 | crearNotaPedidoService.getCotizacionByIdMoneda(1).then(function(res) { |
40 | monedaPorDefecto = res.data[0]; | 40 | monedaPorDefecto = res.data[0]; |
41 | 41 | ||
42 | $scope.notaPedido.moneda = monedaPorDefecto; | 42 | $scope.notaPedido.moneda = monedaPorDefecto; |
43 | $scope.inicial.notaPedido.moneda = $scope.notaPedido.moneda; | 43 | $scope.inicial.notaPedido.moneda = $scope.notaPedido.moneda; |
44 | 44 | ||
45 | $scope.notaPedido.cotizacion = monedaPorDefecto.cotizaciones[0]; | 45 | $scope.notaPedido.cotizacion = monedaPorDefecto.cotizaciones[0]; |
46 | $scope.inicial.notaPedido.cotizacion = $scope.notaPedido.cotizacion; | 46 | $scope.inicial.notaPedido.cotizacion = $scope.notaPedido.cotizacion; |
47 | }); | 47 | }); |
48 | 48 | ||
49 | //SETEO BOTONERA LATERAL | 49 | //SETEO BOTONERA LATERAL |
50 | $timeout(function() { | 50 | $timeout(function() { |
51 | focaBotoneraLateralService.showSalir(false); | 51 | focaBotoneraLateralService.showSalir(false); |
52 | focaBotoneraLateralService.showPausar(true); | 52 | focaBotoneraLateralService.showPausar(true); |
53 | focaBotoneraLateralService.showGuardar(true, $scope.crearNotaPedido); | 53 | focaBotoneraLateralService.showGuardar(true, $scope.crearNotaPedido); |
54 | focaBotoneraLateralService.addCustomButton('Salir', salir); | 54 | focaBotoneraLateralService.addCustomButton('Salir', salir); |
55 | }); | 55 | }); |
56 | 56 | ||
57 | // SETEA BOTONERA DE FACTURADOR TENIENDO EN CUENTA SI ESTA SETEADO EL VENDEDOR | 57 | // SETEA BOTONERA DE FACTURADOR TENIENDO EN CUENTA SI ESTA SETEADO EL VENDEDOR |
58 | if (APP === 'distribuidor') { | 58 | if (APP === 'distribuidor') { |
59 | $scope.idVendedor = focaLoginService.getLoginData().vendedorCobrador; | 59 | $scope.idVendedor = focaLoginService.getLoginData().vendedorCobrador; |
60 | $scope.botonera = crearNotaPedidoService.getBotonera($scope.idVendedor); | 60 | $scope.botonera = crearNotaPedidoService.getBotonera($scope.idVendedor); |
61 | } else { | 61 | } else { |
62 | $scope.botonera = crearNotaPedidoService.getBotonera(); | 62 | $scope.botonera = crearNotaPedidoService.getBotonera(); |
63 | } | 63 | } |
64 | 64 | ||
65 | init(); | 65 | init(); |
66 | } | 66 | } |
67 | 67 | ||
68 | function init() { | 68 | function init() { |
69 | $scope.$broadcast('cleanCabecera'); | 69 | $scope.$broadcast('cleanCabecera'); |
70 | 70 | ||
71 | $scope.notaPedido = { | 71 | $scope.notaPedido = { |
72 | id: 0, | 72 | id: 0, |
73 | cliente: {}, | 73 | cliente: {}, |
74 | proveedor: {}, | 74 | proveedor: {}, |
75 | domicilio: {dom: ''}, | 75 | domicilio: {dom: ''}, |
76 | vendedor: {} | 76 | vendedor: {} |
77 | }; | 77 | }; |
78 | 78 | ||
79 | $scope.articulosTabla = []; | 79 | $scope.articulosTabla = []; |
80 | $scope.idLista = undefined; | 80 | $scope.idLista = undefined; |
81 | 81 | ||
82 | crearNotaPedidoService.getNumeroNotaPedido().then( | 82 | crearNotaPedidoService.getNumeroNotaPedido().then( |
83 | function(res) { | 83 | function(res) { |
84 | $scope.puntoVenta = $filter('rellenarDigitos')( | 84 | $scope.puntoVenta = $filter('rellenarDigitos')( |
85 | res.data.sucursal, 4 | 85 | res.data.sucursal, 4 |
86 | ); | 86 | ); |
87 | 87 | ||
88 | $scope.comprobante = $filter('rellenarDigitos')( | 88 | $scope.comprobante = $filter('rellenarDigitos')( |
89 | res.data.numeroNotaPedido, 8 | 89 | res.data.numeroNotaPedido, 8 |
90 | ); | 90 | ); |
91 | }, | 91 | }, |
92 | function(err) { | 92 | function(err) { |
93 | focaModalService.alert('La terminal no esta configurada correctamente'); | 93 | focaModalService.alert('La terminal no esta configurada correctamente'); |
94 | console.info(err); | 94 | console.info(err); |
95 | } | 95 | } |
96 | ); | 96 | ); |
97 | 97 | ||
98 | if (APP === 'distribuidor') { | 98 | if (APP === 'distribuidor') { |
99 | crearNotaPedidoService.getVendedorById($scope.idVendedor).then( | 99 | crearNotaPedidoService.getVendedorById($scope.idVendedor).then( |
100 | function(res) { | 100 | function(res) { |
101 | var vendedor = res.data; | 101 | var vendedor = res.data; |
102 | $scope.$broadcast('addCabecera', { | 102 | $scope.$broadcast('addCabecera', { |
103 | label: 'Vendedor:', | 103 | label: 'Vendedor:', |
104 | valor: $filter('rellenarDigitos')(vendedor.NUM, 3) + ' - ' + | 104 | valor: $filter('rellenarDigitos')(vendedor.NUM, 3) + ' - ' + |
105 | vendedor.NOM | 105 | vendedor.NOM |
106 | }); | 106 | }); |
107 | 107 | ||
108 | $scope.notaPedido.vendedor = vendedor; | 108 | $scope.notaPedido.vendedor = vendedor; |
109 | $scope.inicial.notaPedido.vendedor =$scope.notaPedido.vendedor; | 109 | $scope.inicial.notaPedido.vendedor =$scope.notaPedido.vendedor; |
110 | } | 110 | } |
111 | ); | 111 | ); |
112 | } | 112 | } |
113 | 113 | ||
114 | $scope.inicial = { | 114 | $scope.inicial = { |
115 | notaPedido: angular.copy($scope.notaPedido), | 115 | notaPedido: angular.copy($scope.notaPedido), |
116 | articulosTabla: angular.copy($scope.articulosTabla), | 116 | articulosTabla: angular.copy($scope.articulosTabla), |
117 | idLista: angular.copy($scope.idLista) | 117 | idLista: angular.copy($scope.idLista) |
118 | }; | 118 | }; |
119 | } | 119 | } |
120 | 120 | ||
121 | $scope.crearNotaPedido = function() { | 121 | $scope.crearNotaPedido = function() { |
122 | if(!$scope.notaPedido.vendedor.id) { | 122 | if(!$scope.notaPedido.vendedor.id) { |
123 | focaModalService.alert('Ingrese Vendedor'); | 123 | focaModalService.alert('Ingrese Vendedor'); |
124 | return; | 124 | return; |
125 | } else if(!$scope.notaPedido.cliente.COD) { | 125 | } else if(!$scope.notaPedido.cliente.COD) { |
126 | focaModalService.alert('Ingrese Cliente'); | 126 | focaModalService.alert('Ingrese Cliente'); |
127 | return; | 127 | return; |
128 | } else if(!$scope.notaPedido.proveedor.COD) { | 128 | } else if(!$scope.notaPedido.proveedor.COD) { |
129 | focaModalService.alert('Ingrese Proveedor'); | 129 | focaModalService.alert('Ingrese Proveedor'); |
130 | return; | 130 | return; |
131 | } else if(!$scope.notaPedido.moneda.ID) { | 131 | } else if(!$scope.notaPedido.moneda.ID) { |
132 | focaModalService.alert('Ingrese Moneda'); | 132 | focaModalService.alert('Ingrese Moneda'); |
133 | return; | 133 | return; |
134 | } else if(!$scope.notaPedido.cotizacion.ID) { | 134 | } else if(!$scope.notaPedido.cotizacion.ID) { |
135 | focaModalService.alert('Ingrese Cotización'); | 135 | focaModalService.alert('Ingrese Cotización'); |
136 | return; | 136 | return; |
137 | } else if(!$scope.plazosPagos) { | 137 | } else if(!$scope.plazosPagos) { |
138 | focaModalService.alert('Ingrese Precios y Condiciones'); | 138 | focaModalService.alert('Ingrese Precios y Condiciones'); |
139 | return; | 139 | return; |
140 | } else if( | 140 | } else if( |
141 | $scope.notaPedido.flete === undefined || $scope.notaPedido.flete === null) | 141 | $scope.notaPedido.flete === undefined || $scope.notaPedido.flete === null) |
142 | { | 142 | { |
143 | focaModalService.alert('Ingrese Flete'); | 143 | focaModalService.alert('Ingrese Flete'); |
144 | return; | 144 | return; |
145 | } else if(!$scope.notaPedido.domicilioStamp) {//TODO validar domicilio correcto | 145 | } else if(!$scope.notaPedido.domicilioStamp) {//TODO validar domicilio correcto |
146 | focaModalService.alert('Ingrese Domicilio'); | 146 | focaModalService.alert('Ingrese Domicilio'); |
147 | return; | 147 | return; |
148 | } else if($scope.articulosTabla.length === 0) { | 148 | } else if($scope.articulosTabla.length === 0) { |
149 | focaModalService.alert('Debe cargar al menos un articulo'); | 149 | focaModalService.alert('Debe cargar al menos un articulo'); |
150 | return; | 150 | return; |
151 | } | 151 | } |
152 | focaBotoneraLateralService.startGuardar(); | 152 | focaBotoneraLateralService.startGuardar(); |
153 | $scope.saveLoading = true; | 153 | $scope.saveLoading = true; |
154 | var notaPedido = { | 154 | var notaPedido = { |
155 | id: $scope.notaPedido.id, | 155 | id: $scope.notaPedido.id, |
156 | fechaCarga: $scope.now.toISOString().slice(0, 19).replace('T', ' '), | 156 | fechaCarga: $scope.now.toISOString().slice(0, 19).replace('T', ' '), |
157 | idVendedor: $scope.notaPedido.vendedor.id, | 157 | idVendedor: $scope.notaPedido.vendedor.id, |
158 | idCliente: $scope.notaPedido.cliente.COD, | 158 | idCliente: $scope.notaPedido.cliente.COD, |
159 | nombreCliente: $scope.notaPedido.cliente.NOM, | 159 | nombreCliente: $scope.notaPedido.cliente.NOM, |
160 | cuitCliente: $scope.notaPedido.cliente.CUIT, | 160 | cuitCliente: $scope.notaPedido.cliente.CUIT, |
161 | idProveedor: $scope.notaPedido.proveedor.COD, | 161 | idProveedor: $scope.notaPedido.proveedor.COD, |
162 | idDomicilio: $scope.notaPedido.domicilio.id, | ||
163 | idCotizacion: $scope.notaPedido.cotizacion.ID, | 162 | idCotizacion: $scope.notaPedido.cotizacion.ID, |
164 | idPrecioCondicion: $scope.notaPedido.idPrecioCondicion, | 163 | idPrecioCondicion: $scope.notaPedido.idPrecioCondicion, |
165 | cotizacion: $scope.notaPedido.cotizacion.VENDEDOR, | 164 | cotizacion: $scope.notaPedido.cotizacion.VENDEDOR, |
166 | flete: $scope.notaPedido.flete, | 165 | flete: $scope.notaPedido.flete, |
167 | fob: $scope.notaPedido.fob, | 166 | fob: $scope.notaPedido.fob, |
168 | bomba: $scope.notaPedido.bomba, | 167 | bomba: $scope.notaPedido.bomba, |
169 | kilometros: $scope.notaPedido.kilometros, | 168 | kilometros: $scope.notaPedido.kilometros, |
170 | domicilioStamp: $scope.notaPedido.domicilioStamp, | ||
171 | observaciones: $scope.notaPedido.observaciones, | 169 | observaciones: $scope.notaPedido.observaciones, |
172 | estado: 0, | 170 | estado: 0, |
173 | total: $scope.getTotal() | 171 | total: $scope.getTotal() |
174 | }; | 172 | }; |
173 | |||
174 | if ($scope.notaPedido.domicilio) { | ||
175 | notaPedido.idDomicilio = $scope.notaPedido.domicilio.id; | ||
176 | notaPedido.domicilioStamp = $scope.notaPedido.domicilioStamp; | ||
177 | } | ||
175 | crearNotaPedidoService.crearNotaPedido(notaPedido).then( | 178 | crearNotaPedidoService.crearNotaPedido(notaPedido).then( |
176 | function(data) { | 179 | function(data) { |
177 | // Al guardar los datos de la nota de pedido logueamos la | 180 | // Al guardar los datos de la nota de pedido logueamos la |
178 | // actividad para su seguimiento. | 181 | // actividad para su seguimiento. |
179 | //TODO: GUARDAR POSISIONAMIENTO AL EDITAR? | 182 | //TODO: GUARDAR POSISIONAMIENTO AL EDITAR? |
180 | focaSeguimientoService.guardarPosicion( | 183 | focaSeguimientoService.guardarPosicion( |
181 | 'Nota de pedido', | 184 | 'Nota de pedido', |
182 | data.data.id, | 185 | data.data.id, |
183 | '' | 186 | '' |
184 | ); | 187 | ); |
185 | notaPedidoBusinessService.addArticulos($scope.articulosTabla, | 188 | notaPedidoBusinessService.addArticulos($scope.articulosTabla, |
186 | data.data.id, $scope.notaPedido.cotizacion.VENDEDOR); | 189 | data.data.id, $scope.notaPedido.cotizacion.VENDEDOR); |
187 | 190 | ||
188 | if($scope.notaPedido.puntosDescarga) { | 191 | if($scope.notaPedido.puntosDescarga) { |
189 | notaPedidoBusinessService.addPuntosDescarga(data.data.id, | 192 | notaPedidoBusinessService.addPuntosDescarga(data.data.id, |
190 | $scope.notaPedido.puntosDescarga); | 193 | $scope.notaPedido.puntosDescarga); |
191 | } | 194 | } |
192 | 195 | ||
193 | var plazos = $scope.plazosPagos; | 196 | var plazos = $scope.plazosPagos; |
194 | var plazosACrear = []; | 197 | var plazosACrear = []; |
195 | plazos.forEach(function(plazo) { | 198 | plazos.forEach(function(plazo) { |
196 | plazosACrear.push({ | 199 | plazosACrear.push({ |
197 | idNotaPedido: data.data.id, | 200 | idNotaPedido: data.data.id, |
198 | dias: plazo.dias | 201 | dias: plazo.dias |
199 | }); | 202 | }); |
200 | }); | 203 | }); |
201 | 204 | ||
202 | if (plazosACrear.length) { | 205 | if (plazosACrear.length) { |
203 | crearNotaPedidoService.crearPlazosParaNotaPedido(plazosACrear); | 206 | crearNotaPedidoService.crearPlazosParaNotaPedido(plazosACrear); |
204 | } | 207 | } |
205 | 208 | ||
206 | notaPedidoBusinessService.addEstado(data.data.id, | 209 | notaPedidoBusinessService.addEstado(data.data.id, |
207 | $scope.notaPedido.vendedor.id); | 210 | $scope.notaPedido.vendedor.id); |
208 | 211 | ||
209 | focaBotoneraLateralService.endGuardar(true); | 212 | focaBotoneraLateralService.endGuardar(true); |
210 | $scope.saveLoading = false; | 213 | $scope.saveLoading = false; |
211 | 214 | ||
212 | init(); | 215 | init(); |
213 | }, function(error) { | 216 | }, function(error) { |
214 | focaModalService.alert('Hubo un error al crear la nota de pedido'); | 217 | focaModalService.alert('Hubo un error al crear la nota de pedido'); |
215 | focaBotoneraLateralService.endGuardar(); | 218 | focaBotoneraLateralService.endGuardar(); |
216 | $scope.saveLoading = false; | 219 | $scope.saveLoading = false; |
217 | console.info(error); | 220 | console.info(error); |
218 | } | 221 | } |
219 | ); | 222 | ); |
220 | }; | 223 | }; |
221 | 224 | ||
222 | $scope.seleccionarNotaPedido = function() { | 225 | $scope.seleccionarNotaPedido = function() { |
223 | var modalInstance = $uibModal.open( | 226 | var modalInstance = $uibModal.open( |
224 | { | 227 | { |
225 | ariaLabelledBy: 'Busqueda de Nota de Pedido', | 228 | ariaLabelledBy: 'Busqueda de Nota de Pedido', |
226 | templateUrl: 'foca-modal-nota-pedido.html', | 229 | templateUrl: 'foca-modal-nota-pedido.html', |
227 | controller: 'focaModalNotaPedidoController', | 230 | controller: 'focaModalNotaPedidoController', |
228 | size: 'lg', | 231 | size: 'lg', |
229 | resolve: { | 232 | resolve: { |
230 | usadoPor: function() {return 'notaPedido';}, | 233 | usadoPor: function() {return 'notaPedido';}, |
231 | idVendedor: function() { | 234 | idVendedor: function() { |
232 | if(APP === 'distribuidor') | 235 | if(APP === 'distribuidor') |
233 | return $scope.notaPedido.vendedor.id; | 236 | return $scope.notaPedido.vendedor.id; |
234 | else | 237 | else |
235 | return null; | 238 | return null; |
236 | } | 239 | } |
237 | } | 240 | } |
238 | } | 241 | } |
239 | ); | 242 | ); |
240 | modalInstance.result.then( | 243 | modalInstance.result.then( |
241 | function(notaPedido) { | 244 | function(notaPedido) { |
242 | $scope.now = new Date(notaPedido.fechaCarga); | 245 | $scope.now = new Date(notaPedido.fechaCarga); |
243 | //añado cabeceras | 246 | //añado cabeceras |
244 | $scope.notaPedido.id = notaPedido.id; | 247 | $scope.notaPedido.id = notaPedido.id; |
245 | $scope.$broadcast('removeCabecera', 'Bomba:'); | 248 | $scope.$broadcast('removeCabecera', 'Bomba:'); |
246 | $scope.$broadcast('removeCabecera', 'Kilometros:'); | 249 | $scope.$broadcast('removeCabecera', 'Kilometros:'); |
247 | var cabeceras = [ | 250 | var cabeceras = [ |
248 | { | 251 | { |
249 | label: 'Moneda:', | 252 | label: 'Moneda:', |
250 | valor: notaPedido.cotizacion.moneda.DETALLE | 253 | valor: notaPedido.cotizacion.moneda.DETALLE |
251 | }, | 254 | }, |
252 | { | 255 | { |
253 | label: 'Fecha cotizacion:', | 256 | label: 'Fecha cotizacion:', |
254 | valor: $filter('date')(notaPedido.cotizacion.FECHA, | 257 | valor: $filter('date')(notaPedido.cotizacion.FECHA, |
255 | 'dd/MM/yyyy') | 258 | 'dd/MM/yyyy') |
256 | }, | 259 | }, |
257 | { | 260 | { |
258 | label: 'Cotizacion:', | 261 | label: 'Cotizacion:', |
259 | valor: $filter('number')(notaPedido.cotizacion.VENDEDOR, | 262 | valor: $filter('number')(notaPedido.cotizacion.VENDEDOR, |
260 | '2') | 263 | '2') |
261 | }, | 264 | }, |
262 | { | 265 | { |
263 | label: 'Cliente:', | 266 | label: 'Cliente:', |
264 | valor: notaPedido.cliente.NOM | 267 | valor: notaPedido.cliente.NOM |
265 | }, | 268 | }, |
266 | { | 269 | { |
267 | label: 'Domicilio:', | 270 | label: 'Domicilio:', |
268 | valor: notaPedido.domicilioStamp | 271 | valor: notaPedido.domicilioStamp |
269 | }, | 272 | }, |
270 | { | 273 | { |
271 | label: 'Vendedor:', | 274 | label: 'Vendedor:', |
272 | valor: $filter('rellenarDigitos')(notaPedido.vendedor.NUM, 3) + | 275 | valor: $filter('rellenarDigitos')(notaPedido.vendedor.NUM, 3) + |
273 | ' - ' + notaPedido.vendedor.NOM | 276 | ' - ' + notaPedido.vendedor.NOM |
274 | }, | 277 | }, |
275 | { | 278 | { |
276 | label: 'Proveedor:', | 279 | label: 'Proveedor:', |
277 | valor: $filter('rellenarDigitos')(notaPedido.proveedor.COD, 5) + | 280 | valor: $filter('rellenarDigitos')(notaPedido.proveedor.COD, 5) + |
278 | ' - ' + notaPedido.proveedor.NOM | 281 | ' - ' + notaPedido.proveedor.NOM |
279 | }, | 282 | }, |
280 | { | 283 | { |
281 | label: 'Precios y condiciones:', | 284 | label: 'Precios y condiciones:', |
282 | valor: valorPrecioCondicion() + ' ' + | 285 | valor: valorPrecioCondicion() + ' ' + |
283 | notaPedidoBusinessService | 286 | notaPedidoBusinessService |
284 | .plazoToString(notaPedido.notaPedidoPlazo) | 287 | .plazoToString(notaPedido.notaPedidoPlazo) |
285 | }, | 288 | }, |
286 | { | 289 | { |
287 | label: 'Flete:', | 290 | label: 'Flete:', |
288 | valor: notaPedido.fob === 1 ? 'FOB' : ( | 291 | valor: notaPedido.fob === 1 ? 'FOB' : ( |
289 | notaPedido.flete === 1 ? 'Si' : 'No') | 292 | notaPedido.flete === 1 ? 'Si' : 'No') |
290 | } | 293 | } |
291 | ]; | 294 | ]; |
292 | 295 | ||
293 | function valorPrecioCondicion() { | 296 | function valorPrecioCondicion() { |
294 | if(notaPedido.idPrecioCondicion > 0) { | 297 | if(notaPedido.idPrecioCondicion > 0) { |
295 | return notaPedido.precioCondicion.nombre; | 298 | return notaPedido.precioCondicion.nombre; |
296 | } else { | 299 | } else { |
297 | return 'Ingreso Manual'; | 300 | return 'Ingreso Manual'; |
298 | } | 301 | } |
299 | } | 302 | } |
300 | 303 | ||
301 | if(notaPedido.flete === 1) { | 304 | if(notaPedido.flete === 1) { |
302 | var cabeceraBomba = { | 305 | var cabeceraBomba = { |
303 | label: 'Bomba:', | 306 | label: 'Bomba:', |
304 | valor: notaPedido.bomba === 1 ? 'Si' : 'No' | 307 | valor: notaPedido.bomba === 1 ? 'Si' : 'No' |
305 | }; | 308 | }; |
306 | if(notaPedido.kilometros) { | 309 | if(notaPedido.kilometros) { |
307 | var cabeceraKilometros = { | 310 | var cabeceraKilometros = { |
308 | label: 'Kilometros:', | 311 | label: 'Kilometros:', |
309 | valor: notaPedido.kilometros | 312 | valor: notaPedido.kilometros |
310 | }; | 313 | }; |
311 | cabeceras.push(cabeceraKilometros); | 314 | cabeceras.push(cabeceraKilometros); |
312 | } | 315 | } |
313 | cabeceras.push(cabeceraBomba); | 316 | cabeceras.push(cabeceraBomba); |
314 | } | 317 | } |
315 | 318 | ||
316 | $scope.articulosTabla = notaPedido.articulosNotaPedido; | 319 | $scope.articulosTabla = notaPedido.articulosNotaPedido; |
317 | notaPedidoBusinessService.calcularArticulos($scope.articulosTabla, | 320 | notaPedidoBusinessService.calcularArticulos($scope.articulosTabla, |
318 | notaPedido.cotizacion.VENDEDOR); | 321 | notaPedido.cotizacion.VENDEDOR); |
319 | 322 | ||
320 | if(notaPedido.idPrecioCondicion > 0) { | 323 | if(notaPedido.idPrecioCondicion > 0) { |
321 | $scope.idLista = notaPedido.precioCondicion.idListaPrecio; | 324 | $scope.idLista = notaPedido.precioCondicion.idListaPrecio; |
322 | } else { | 325 | } else { |
323 | $scope.idLista = -1; | 326 | $scope.idLista = -1; |
324 | } | 327 | } |
325 | 328 | ||
326 | $scope.puntoVenta = $filter('rellenarDigitos')( | 329 | $scope.puntoVenta = $filter('rellenarDigitos')( |
327 | notaPedido.sucursal, 4 | 330 | notaPedido.sucursal, 4 |
328 | ); | 331 | ); |
329 | 332 | ||
330 | $scope.comprobante = $filter('rellenarDigitos')( | 333 | $scope.comprobante = $filter('rellenarDigitos')( |
331 | notaPedido.numeroNotaPedido, 8 | 334 | notaPedido.numeroNotaPedido, 8 |
332 | ); | 335 | ); |
333 | 336 | ||
334 | $scope.notaPedido = notaPedido; | 337 | $scope.notaPedido = notaPedido; |
335 | $scope.notaPedido.moneda = notaPedido.cotizacion.moneda; | 338 | $scope.notaPedido.moneda = notaPedido.cotizacion.moneda; |
336 | $scope.plazosPagos = notaPedido.notaPedidoPlazo; | 339 | $scope.plazosPagos = notaPedido.notaPedidoPlazo; |
337 | $scope.notaPedido.puntosDescarga = | 340 | $scope.notaPedido.puntosDescarga = |
338 | formatearPuntosDescarga(notaPedido.notaPedidoPuntoDescarga); | 341 | formatearPuntosDescarga(notaPedido.notaPedidoPuntoDescarga); |
339 | addArrayCabecera(cabeceras); | 342 | addArrayCabecera(cabeceras); |
340 | 343 | ||
341 | }, function() { | 344 | }, function() { |
342 | // funcion ejecutada cuando se cancela el modal | 345 | // funcion ejecutada cuando se cancela el modal |
343 | } | 346 | } |
344 | ); | 347 | ); |
345 | }; | 348 | }; |
346 | 349 | ||
347 | $scope.seleccionarProductos = function() { | 350 | $scope.seleccionarProductos = function() { |
348 | if ($scope.idLista === undefined) { | 351 | if ($scope.idLista === undefined) { |
349 | focaModalService.alert( | 352 | focaModalService.alert( |
350 | 'Primero seleccione una lista de precio y condicion'); | 353 | 'Primero seleccione una lista de precio y condicion'); |
351 | return; | 354 | return; |
352 | } | 355 | } |
353 | var modalInstance = $uibModal.open( | 356 | var modalInstance = $uibModal.open( |
354 | { | 357 | { |
355 | ariaLabelledBy: 'Busqueda de Productos', | 358 | ariaLabelledBy: 'Busqueda de Productos', |
356 | templateUrl: 'modal-busqueda-productos.html', | 359 | templateUrl: 'modal-busqueda-productos.html', |
357 | controller: 'modalBusquedaProductosCtrl', | 360 | controller: 'modalBusquedaProductosCtrl', |
358 | resolve: { | 361 | resolve: { |
359 | parametroProducto: { | 362 | parametroProducto: { |
360 | idLista: $scope.idLista, | 363 | idLista: $scope.idLista, |
361 | cotizacion: $scope.notaPedido.cotizacion.VENDEDOR, | 364 | cotizacion: $scope.notaPedido.cotizacion.VENDEDOR, |
362 | simbolo: $scope.notaPedido.moneda.SIMBOLO | 365 | simbolo: $scope.notaPedido.moneda.SIMBOLO |
363 | } | 366 | } |
364 | }, | 367 | }, |
365 | size: 'lg' | 368 | size: 'lg' |
366 | } | 369 | } |
367 | ); | 370 | ); |
368 | modalInstance.result.then( | 371 | modalInstance.result.then( |
369 | function(producto) { | 372 | function(producto) { |
370 | var newArt = | 373 | var newArt = |
371 | { | 374 | { |
372 | id: 0, | 375 | id: 0, |
373 | codigo: producto.codigo, | 376 | codigo: producto.codigo, |
374 | sector: producto.sector, | 377 | sector: producto.sector, |
375 | sectorCodigo: producto.sector + '-' + producto.codigo, | 378 | sectorCodigo: producto.sector + '-' + producto.codigo, |
376 | descripcion: producto.descripcion, | 379 | descripcion: producto.descripcion, |
377 | item: $scope.articulosTabla.length + 1, | 380 | item: $scope.articulosTabla.length + 1, |
378 | nombre: producto.descripcion, | 381 | nombre: producto.descripcion, |
379 | precio: parseFloat(producto.precio.toFixed(4)), | 382 | precio: parseFloat(producto.precio.toFixed(4)), |
380 | costoUnitario: producto.costo, | 383 | costoUnitario: producto.costo, |
381 | editCantidad: false, | 384 | editCantidad: false, |
382 | editPrecio: false, | 385 | editPrecio: false, |
383 | rubro: producto.CodRub, | 386 | rubro: producto.CodRub, |
384 | exentoUnitario: producto.precio, | 387 | exentoUnitario: producto.precio, |
385 | ivaUnitario: producto.IMPIVA, | 388 | ivaUnitario: producto.IMPIVA, |
386 | impuestoInternoUnitario: producto.ImpInt, | 389 | impuestoInternoUnitario: producto.ImpInt, |
387 | impuestoInterno1Unitario: producto.ImpInt2, | 390 | impuestoInterno1Unitario: producto.ImpInt2, |
388 | impuestoInterno2Unitario: producto.ImpInt3, | 391 | impuestoInterno2Unitario: producto.ImpInt3, |
389 | precioLista: producto.precio, | 392 | precioLista: producto.precio, |
390 | combustible: 1, | 393 | combustible: 1, |
391 | facturado: 0, | 394 | facturado: 0, |
392 | idArticulo: producto.id | 395 | idArticulo: producto.id |
393 | }; | 396 | }; |
394 | $scope.articuloACargar = newArt; | 397 | $scope.articuloACargar = newArt; |
395 | $scope.cargando = false; | 398 | $scope.cargando = false; |
396 | }, function() { | 399 | }, function() { |
397 | // funcion ejecutada cuando se cancela el modal | 400 | // funcion ejecutada cuando se cancela el modal |
398 | } | 401 | } |
399 | ); | 402 | ); |
400 | }; | 403 | }; |
401 | 404 | ||
402 | $scope.seleccionarPuntosDeDescarga = function() { | 405 | $scope.seleccionarPuntosDeDescarga = function() { |
403 | if(!$scope.notaPedido.cliente.COD || !$scope.notaPedido.domicilio.id) { | 406 | if(!$scope.notaPedido.cliente.COD || !$scope.notaPedido.domicilio.id) { |
404 | focaModalService.alert('Primero seleccione un cliente y un domicilio'); | 407 | focaModalService.alert('Primero seleccione un cliente y un domicilio'); |
405 | return; | 408 | return; |
406 | }else { | 409 | }else { |
407 | var modalInstance = $uibModal.open( | 410 | var modalInstance = $uibModal.open( |
408 | { | 411 | { |
409 | ariaLabelledBy: 'Búsqueda de Puntos de descarga', | 412 | ariaLabelledBy: 'Búsqueda de Puntos de descarga', |
410 | templateUrl: 'modal-punto-descarga.html', | 413 | templateUrl: 'modal-punto-descarga.html', |
411 | controller: 'focaModalPuntoDescargaController', | 414 | controller: 'focaModalPuntoDescargaController', |
412 | size: 'lg', | 415 | size: 'lg', |
413 | resolve: { | 416 | resolve: { |
414 | filters: { | 417 | filters: { |
415 | idDomicilio: $scope.notaPedido.idDomicilio, | 418 | idDomicilio: $scope.notaPedido.idDomicilio, |
416 | idCliente: $scope.notaPedido.cliente.COD, | 419 | idCliente: $scope.notaPedido.cliente.COD, |
417 | articulos: $scope.articulosTabla, | 420 | articulos: $scope.articulosTabla, |
418 | puntosDescarga: $scope.notaPedido.puntosDescarga | 421 | puntosDescarga: $scope.notaPedido.puntosDescarga |
419 | } | 422 | } |
420 | } | 423 | } |
421 | } | 424 | } |
422 | ); | 425 | ); |
423 | modalInstance.result.then( | 426 | modalInstance.result.then( |
424 | function(puntosDescarga) { | 427 | function(puntosDescarga) { |
425 | $scope.notaPedido.puntosDescarga = puntosDescarga; | 428 | $scope.notaPedido.puntosDescarga = puntosDescarga; |
426 | 429 | ||
427 | //AGREGO PUNTOS DE DESCARGA A CABECERA | 430 | //AGREGO PUNTOS DE DESCARGA A CABECERA |
428 | var puntosStamp = ''; | 431 | var puntosStamp = ''; |
429 | puntosDescarga.forEach(function(punto, idx, arr) { | 432 | puntosDescarga.forEach(function(punto, idx, arr) { |
430 | puntosStamp += punto.descripcion; | 433 | puntosStamp += punto.descripcion; |
431 | if((idx + 1) !== arr.length) puntosStamp += ', '; | 434 | if((idx + 1) !== arr.length) puntosStamp += ', '; |
432 | }); | 435 | }); |
433 | 436 | ||
434 | $scope.$broadcast('addCabecera', { | 437 | $scope.$broadcast('addCabecera', { |
435 | label: 'Puntos de descarga:', | 438 | label: 'Puntos de descarga:', |
436 | valor: puntosStamp | 439 | valor: puntosStamp |
437 | }); | 440 | }); |
438 | }, function() { | 441 | }, function() { |
439 | $scope.abrirModalDomicilios($scope.cliente); | 442 | $scope.abrirModalDomicilios($scope.cliente); |
440 | } | 443 | } |
441 | ); | 444 | ); |
442 | } | 445 | } |
443 | }; | 446 | }; |
444 | 447 | ||
445 | $scope.seleccionarVendedor = function() { | 448 | $scope.seleccionarVendedor = function() { |
446 | if(validarNotaRemitada()) { | 449 | if(validarNotaRemitada()) { |
447 | var parametrosModal = { | 450 | var parametrosModal = { |
448 | titulo: 'Búsqueda vendedores', | 451 | titulo: 'Búsqueda vendedores', |
449 | query: '/vendedor', | 452 | query: '/vendedor', |
450 | columnas: [ | 453 | columnas: [ |
451 | { | 454 | { |
452 | propiedad: 'NUM', | 455 | propiedad: 'NUM', |
453 | nombre: 'Código', | 456 | nombre: 'Código', |
454 | filtro: { | 457 | filtro: { |
455 | nombre: 'rellenarDigitos', | 458 | nombre: 'rellenarDigitos', |
456 | parametro: 3 | 459 | parametro: 3 |
457 | } | 460 | } |
458 | }, | 461 | }, |
459 | { | 462 | { |
460 | propiedad: 'NOM', | 463 | propiedad: 'NOM', |
461 | nombre: 'Nombre' | 464 | nombre: 'Nombre' |
462 | } | 465 | } |
463 | ], | 466 | ], |
464 | size: 'md' | 467 | size: 'md' |
465 | }; | 468 | }; |
466 | focaModalService.modal(parametrosModal).then( | 469 | focaModalService.modal(parametrosModal).then( |
467 | function(vendedor) { | 470 | function(vendedor) { |
468 | $scope.$broadcast('addCabecera', { | 471 | $scope.$broadcast('addCabecera', { |
469 | label: 'Vendedor:', | 472 | label: 'Vendedor:', |
470 | valor: $filter('rellenarDigitos')(vendedor.NUM, 3) + ' - ' + | 473 | valor: $filter('rellenarDigitos')(vendedor.NUM, 3) + ' - ' + |
471 | vendedor.NOM | 474 | vendedor.NOM |
472 | }); | 475 | }); |
473 | $scope.notaPedido.vendedor = vendedor; | 476 | $scope.notaPedido.vendedor = vendedor; |
474 | }, function() { | 477 | }, function() { |
475 | 478 | ||
476 | } | 479 | } |
477 | ); | 480 | ); |
478 | } | 481 | } |
479 | }; | 482 | }; |
480 | 483 | ||
481 | $scope.seleccionarProveedor = function() { | 484 | $scope.seleccionarProveedor = function() { |
482 | if(validarNotaRemitada()) { | 485 | if(validarNotaRemitada()) { |
483 | var parametrosModal = { | 486 | var parametrosModal = { |
484 | titulo: 'Búsqueda de Proveedor', | 487 | titulo: 'Búsqueda de Proveedor', |
485 | query: '/proveedor', | 488 | query: '/proveedor', |
486 | columnas: [ | 489 | columnas: [ |
487 | { | 490 | { |
488 | nombre: 'Código', | 491 | nombre: 'Código', |
489 | propiedad: 'COD', | 492 | propiedad: 'COD', |
490 | filtro: { | 493 | filtro: { |
491 | nombre: 'rellenarDigitos', | 494 | nombre: 'rellenarDigitos', |
492 | parametro: 5 | 495 | parametro: 5 |
493 | } | 496 | } |
494 | }, | 497 | }, |
495 | { | 498 | { |
496 | nombre: 'Nombre', | 499 | nombre: 'Nombre', |
497 | propiedad: 'NOM' | 500 | propiedad: 'NOM' |
498 | }, | 501 | }, |
499 | { | 502 | { |
500 | nombre: 'CUIT', | 503 | nombre: 'CUIT', |
501 | propiedad: 'CUIT' | 504 | propiedad: 'CUIT' |
502 | } | 505 | } |
503 | ], | 506 | ], |
504 | tipo: 'POST', | 507 | tipo: 'POST', |
505 | json: {razonCuitCod: ''} | 508 | json: {razonCuitCod: ''} |
506 | }; | 509 | }; |
507 | focaModalService.modal(parametrosModal).then( | 510 | focaModalService.modal(parametrosModal).then( |
508 | function(proveedor) { | 511 | function(proveedor) { |
509 | $scope.notaPedido.proveedor = proveedor; | 512 | $scope.notaPedido.proveedor = proveedor; |
510 | $scope.$broadcast('addCabecera', { | 513 | $scope.$broadcast('addCabecera', { |
511 | label: 'Proveedor:', | 514 | label: 'Proveedor:', |
512 | valor: $filter('rellenarDigitos')(proveedor.COD, 5) + ' - ' + | 515 | valor: $filter('rellenarDigitos')(proveedor.COD, 5) + ' - ' + |
513 | proveedor.NOM | 516 | proveedor.NOM |
514 | }); | 517 | }); |
515 | }, function() { | 518 | }, function() { |
516 | 519 | ||
517 | } | 520 | } |
518 | ); | 521 | ); |
519 | } | 522 | } |
520 | }; | 523 | }; |
521 | 524 | ||
522 | $scope.seleccionarCliente = function() { | 525 | $scope.seleccionarCliente = function() { |
523 | if(!$scope.notaPedido.vendedor.NUM) { | 526 | if(!$scope.notaPedido.vendedor.NUM) { |
524 | focaModalService.alert('Primero seleccione un vendedor'); | 527 | focaModalService.alert('Primero seleccione un vendedor'); |
525 | return; | 528 | return; |
526 | } | 529 | } |
527 | if(validarNotaRemitada()) { | 530 | if(validarNotaRemitada()) { |
528 | var modalInstance = $uibModal.open( | 531 | var modalInstance = $uibModal.open( |
529 | { | 532 | { |
530 | ariaLabelledBy: 'Busqueda de Cliente', | 533 | ariaLabelledBy: 'Busqueda de Cliente', |
531 | templateUrl: 'foca-busqueda-cliente-modal.html', | 534 | templateUrl: 'foca-busqueda-cliente-modal.html', |
532 | controller: 'focaBusquedaClienteModalController', | 535 | controller: 'focaBusquedaClienteModalController', |
533 | resolve: { | 536 | resolve: { |
534 | vendedor: function() { return $scope.notaPedido.vendedor; } | 537 | vendedor: function() { return $scope.notaPedido.vendedor; } |
535 | }, | 538 | }, |
536 | size: 'lg' | 539 | size: 'lg' |
537 | } | 540 | } |
538 | ); | 541 | ); |
539 | modalInstance.result.then( | 542 | modalInstance.result.then( |
540 | function(cliente) { | 543 | function(cliente) { |
541 | $scope.abrirModalDomicilios(cliente); | 544 | $scope.abrirModalDomicilios(cliente); |
542 | $scope.cliente = cliente; | 545 | $scope.cliente = cliente; |
543 | }, function() {} | 546 | }, function() {} |
544 | ); | 547 | ); |
545 | } | 548 | } |
546 | }; | 549 | }; |
547 | 550 | ||
548 | $scope.abrirModalDomicilios = function(cliente) { | 551 | $scope.abrirModalDomicilios = function(cliente) { |
549 | var modalInstanceDomicilio = $uibModal.open( | 552 | var modalInstanceDomicilio = $uibModal.open( |
550 | { | 553 | { |
551 | ariaLabelledBy: 'Busqueda de Domicilios', | 554 | ariaLabelledBy: 'Busqueda de Domicilios', |
552 | templateUrl: 'modal-domicilio.html', | 555 | templateUrl: 'modal-domicilio.html', |
553 | controller: 'focaModalDomicilioController', | 556 | controller: 'focaModalDomicilioController', |
554 | resolve: { | 557 | resolve: { |
555 | idCliente: function() { return cliente.cod; }, | 558 | idCliente: function() { return cliente.cod; }, |
556 | esNuevo: function() { return cliente.esNuevo; } | 559 | esNuevo: function() { return cliente.esNuevo; } |
557 | }, | 560 | }, |
558 | size: 'lg', | 561 | size: 'lg', |
559 | } | 562 | } |
560 | ); | 563 | ); |
561 | modalInstanceDomicilio.result.then( | 564 | modalInstanceDomicilio.result.then( |
562 | function(domicilio) { | 565 | function(domicilio) { |
563 | $scope.notaPedido.domicilio = domicilio; | 566 | $scope.notaPedido.domicilio = domicilio; |
564 | $scope.notaPedido.cliente = { | 567 | $scope.notaPedido.cliente = { |
565 | COD: cliente.cod, | 568 | COD: cliente.cod, |
566 | CUIT: cliente.cuit, | 569 | CUIT: cliente.cuit, |
567 | NOM: cliente.nom | 570 | NOM: cliente.nom |
568 | }; | 571 | }; |
569 | var domicilioStamp = | 572 | var domicilioStamp = |
570 | domicilio.Calle + ' ' + domicilio.Numero + ', ' + | 573 | domicilio.Calle + ' ' + domicilio.Numero + ', ' + |
571 | domicilio.Localidad + ', ' + domicilio.Provincia; | 574 | domicilio.Localidad + ', ' + domicilio.Provincia; |
572 | $scope.notaPedido.domicilioStamp = domicilioStamp; | 575 | $scope.notaPedido.domicilioStamp = domicilioStamp; |
573 | 576 | ||
574 | $scope.notaPedido.puntosDescarga = domicilio.puntosDescarga; | 577 | $scope.notaPedido.puntosDescarga = domicilio.puntosDescarga; |
575 | 578 | ||
576 | $scope.$broadcast('addCabecera', { | 579 | $scope.$broadcast('addCabecera', { |
577 | label: 'Cliente:', | 580 | label: 'Cliente:', |
578 | valor: $filter('rellenarDigitos')(cliente.cod, 5) + ' - ' + cliente.nom | 581 | valor: $filter('rellenarDigitos')(cliente.cod, 5) + ' - ' + cliente.nom |
579 | }); | 582 | }); |
580 | $scope.$broadcast('addCabecera', { | 583 | $scope.$broadcast('addCabecera', { |
581 | label: 'Domicilio:', | 584 | label: 'Domicilio:', |
582 | valor: domicilioStamp | 585 | valor: domicilioStamp |
583 | }); | 586 | }); |
584 | if(domicilio.verPuntos) { | 587 | if(domicilio.verPuntos) { |
585 | delete $scope.notaPedido.domicilio.verPuntos; | 588 | delete $scope.notaPedido.domicilio.verPuntos; |
586 | $scope.seleccionarPuntosDeDescarga(); | 589 | $scope.seleccionarPuntosDeDescarga(); |
587 | }else { | 590 | }else { |
588 | crearNotaPedidoService | 591 | crearNotaPedidoService |
589 | .getPuntosDescargaByClienDom(domicilio.id, cliente.cod) | 592 | .getPuntosDescargaByClienDom(domicilio.id, cliente.cod) |
590 | .then(function(res) { | 593 | .then(function(res) { |
591 | if(res.data.length) $scope.seleccionarPuntosDeDescarga(); | 594 | if(res.data.length) $scope.seleccionarPuntosDeDescarga(); |
592 | }); | 595 | }); |
593 | } | 596 | } |
594 | }, function() { | 597 | }, function() { |
595 | $scope.seleccionarCliente(); | 598 | $scope.seleccionarCliente(); |
596 | return; | 599 | return; |
597 | } | 600 | } |
598 | ); | 601 | ); |
599 | }; | 602 | }; |
600 | 603 | ||
601 | $scope.getTotal = function() { | 604 | $scope.getTotal = function() { |
602 | var total = 0; | 605 | var total = 0; |
603 | var arrayTempArticulos = $scope.articulosTabla; | 606 | var arrayTempArticulos = $scope.articulosTabla; |
604 | for (var i = 0; i < arrayTempArticulos.length; i++) { | 607 | for (var i = 0; i < arrayTempArticulos.length; i++) { |
605 | total += arrayTempArticulos[i].precio * arrayTempArticulos[i].cantidad; | 608 | total += arrayTempArticulos[i].precio * arrayTempArticulos[i].cantidad; |
606 | } | 609 | } |
607 | return parseFloat(total.toFixed(2)); | 610 | return parseFloat(total.toFixed(2)); |
608 | }; | 611 | }; |
609 | 612 | ||
610 | $scope.getSubTotal = function() { | 613 | $scope.getSubTotal = function() { |
611 | if($scope.articuloACargar) { | 614 | if($scope.articuloACargar) { |
612 | return $scope.articuloACargar.precio * $scope.articuloACargar.cantidad; | 615 | return $scope.articuloACargar.precio * $scope.articuloACargar.cantidad; |
613 | } | 616 | } |
614 | }; | 617 | }; |
615 | 618 | ||
616 | $scope.seleccionarPreciosYCondiciones = function() { | 619 | $scope.seleccionarPreciosYCondiciones = function() { |
617 | if(validarNotaRemitada()) { | 620 | if(validarNotaRemitada()) { |
618 | var modalInstance = $uibModal.open( | 621 | var modalInstance = $uibModal.open( |
619 | { | 622 | { |
620 | ariaLabelledBy: 'Busqueda de Precio Condición', | 623 | ariaLabelledBy: 'Busqueda de Precio Condición', |
621 | templateUrl: 'modal-precio-condicion.html', | 624 | templateUrl: 'modal-precio-condicion.html', |
622 | controller: 'focaModalPrecioCondicionController', | 625 | controller: 'focaModalPrecioCondicionController', |
623 | size: 'lg' | 626 | size: 'lg' |
624 | } | 627 | } |
625 | ); | 628 | ); |
626 | modalInstance.result.then( | 629 | modalInstance.result.then( |
627 | function(precioCondicion) { | 630 | function(precioCondicion) { |
628 | var cabecera = ''; | 631 | var cabecera = ''; |
629 | var plazosConcat = ''; | 632 | var plazosConcat = ''; |
630 | if(!Array.isArray(precioCondicion)) { | 633 | if(!Array.isArray(precioCondicion)) { |
631 | $scope.notaPedido.idPrecioCondicion = precioCondicion.id; | 634 | $scope.notaPedido.idPrecioCondicion = precioCondicion.id; |
632 | $scope.plazosPagos = precioCondicion.plazoPago; | 635 | $scope.plazosPagos = precioCondicion.plazoPago; |
633 | $scope.idLista = precioCondicion.idListaPrecio; | 636 | $scope.idLista = precioCondicion.idListaPrecio; |
634 | for(var i = 0; i < precioCondicion.plazoPago.length; i++) { | 637 | for(var i = 0; i < precioCondicion.plazoPago.length; i++) { |
635 | plazosConcat += precioCondicion.plazoPago[i].dias + ' '; | 638 | plazosConcat += precioCondicion.plazoPago[i].dias + ' '; |
636 | } | 639 | } |
637 | cabecera = $filter('rellenarDigitos')(precioCondicion.id, 4) + | 640 | cabecera = $filter('rellenarDigitos')(precioCondicion.id, 4) + |
638 | ' - ' + precioCondicion.nombre + ' ' + plazosConcat.trim(); | 641 | ' - ' + precioCondicion.nombre + ' ' + plazosConcat.trim(); |
639 | } else { //Cuando se ingresan los plazos manualmente | 642 | } else { //Cuando se ingresan los plazos manualmente |
640 | $scope.notaPedido.idPrecioCondicion = 0; | 643 | $scope.notaPedido.idPrecioCondicion = 0; |
641 | //-1, el modal productos busca todos los productos | 644 | //-1, el modal productos busca todos los productos |
642 | $scope.idLista = -1; | 645 | $scope.idLista = -1; |
643 | $scope.plazosPagos = precioCondicion; | 646 | $scope.plazosPagos = precioCondicion; |
644 | for(var j = 0; j < precioCondicion.length; j++) { | 647 | for(var j = 0; j < precioCondicion.length; j++) { |
645 | plazosConcat += precioCondicion[j].dias + ' '; | 648 | plazosConcat += precioCondicion[j].dias + ' '; |
646 | } | 649 | } |
647 | cabecera = 'Ingreso manual ' + plazosConcat.trim(); | 650 | cabecera = 'Ingreso manual ' + plazosConcat.trim(); |
648 | } | 651 | } |
649 | $scope.articulosTabla = []; | 652 | $scope.articulosTabla = []; |
650 | $scope.$broadcast('addCabecera', { | 653 | $scope.$broadcast('addCabecera', { |
651 | label: 'Precios y condiciones:', | 654 | label: 'Precios y condiciones:', |
652 | valor: cabecera | 655 | valor: cabecera |
653 | }); | 656 | }); |
654 | }, function() { | 657 | }, function() { |
655 | 658 | ||
656 | } | 659 | } |
657 | ); | 660 | ); |
658 | } | 661 | } |
659 | }; | 662 | }; |
660 | 663 | ||
661 | $scope.seleccionarFlete = function() { | 664 | $scope.seleccionarFlete = function() { |
662 | if(validarNotaRemitada()) { | 665 | if(validarNotaRemitada()) { |
663 | var modalInstance = $uibModal.open( | 666 | var modalInstance = $uibModal.open( |
664 | { | 667 | { |
665 | ariaLabelledBy: 'Busqueda de Flete', | 668 | ariaLabelledBy: 'Busqueda de Flete', |
666 | templateUrl: 'modal-flete.html', | 669 | templateUrl: 'modal-flete.html', |
667 | controller: 'focaModalFleteController', | 670 | controller: 'focaModalFleteController', |
668 | size: 'lg', | 671 | size: 'lg', |
669 | resolve: { | 672 | resolve: { |
670 | parametrosFlete: | 673 | parametrosFlete: |
671 | function() { | 674 | function() { |
672 | return { | 675 | return { |
673 | flete: $scope.notaPedido.fob ? 'FOB' : | 676 | flete: $scope.notaPedido.fob ? 'FOB' : |
674 | ( $scope.notaPedido.flete ? '1' : | 677 | ( $scope.notaPedido.flete ? '1' : |
675 | ($scope.notaPedido.flete === undefined ? | 678 | ($scope.notaPedido.flete === undefined ? |
676 | null : '0')), | 679 | null : '0')), |
677 | bomba: $scope.notaPedido.bomba ? '1' : | 680 | bomba: $scope.notaPedido.bomba ? '1' : |
678 | ($scope.notaPedido.bomba === undefined ? | 681 | ($scope.notaPedido.bomba === undefined ? |
679 | null : '0'), | 682 | null : '0'), |
680 | kilometros: $scope.notaPedido.kilometros | 683 | kilometros: $scope.notaPedido.kilometros |
681 | }; | 684 | }; |
682 | } | 685 | } |
683 | } | 686 | } |
684 | } | 687 | } |
685 | ); | 688 | ); |
686 | modalInstance.result.then( | 689 | modalInstance.result.then( |
687 | function(datos) { | 690 | function(datos) { |
688 | $scope.notaPedido.flete = datos.flete; | 691 | $scope.notaPedido.flete = datos.flete; |
689 | $scope.notaPedido.fob = datos.FOB; | 692 | $scope.notaPedido.fob = datos.FOB; |
690 | $scope.notaPedido.bomba = datos.bomba; | 693 | $scope.notaPedido.bomba = datos.bomba; |
691 | $scope.notaPedido.kilometros = datos.kilometros; | 694 | $scope.notaPedido.kilometros = datos.kilometros; |
692 | $scope.$broadcast('addCabecera', { | 695 | $scope.$broadcast('addCabecera', { |
693 | label: 'Flete:', | 696 | label: 'Flete:', |
694 | valor: datos.FOB ? 'FOB' : (datos.flete ? 'Si' : 'No') | 697 | valor: datos.FOB ? 'FOB' : (datos.flete ? 'Si' : 'No') |
695 | }); | 698 | }); |
696 | if(datos.flete) { | 699 | if(datos.flete) { |
697 | $scope.$broadcast('addCabecera', { | 700 | $scope.$broadcast('addCabecera', { |
698 | label: 'Bomba:', | 701 | label: 'Bomba:', |
699 | valor: datos.bomba ? 'Si' : 'No' | 702 | valor: datos.bomba ? 'Si' : 'No' |
700 | }); | 703 | }); |
701 | $scope.$broadcast('addCabecera', { | 704 | $scope.$broadcast('addCabecera', { |
702 | label: 'Kilometros:', | 705 | label: 'Kilometros:', |
703 | valor: datos.kilometros | 706 | valor: datos.kilometros |
704 | }); | 707 | }); |
705 | } else { | 708 | } else { |
706 | $scope.$broadcast('removeCabecera', 'Bomba:'); | 709 | $scope.$broadcast('removeCabecera', 'Bomba:'); |
707 | $scope.$broadcast('removeCabecera', 'Kilometros:'); | 710 | $scope.$broadcast('removeCabecera', 'Kilometros:'); |
708 | $scope.notaPedido.bomba = false; | 711 | $scope.notaPedido.bomba = false; |
709 | $scope.notaPedido.kilometros = null; | 712 | $scope.notaPedido.kilometros = null; |
710 | } | 713 | } |
711 | }, function() { | 714 | }, function() { |
712 | 715 | ||
713 | } | 716 | } |
714 | ); | 717 | ); |
715 | } | 718 | } |
716 | }; | 719 | }; |
717 | 720 | ||
718 | $scope.seleccionarMoneda = function() { | 721 | $scope.seleccionarMoneda = function() { |
719 | if(validarNotaRemitada()) { | 722 | if(validarNotaRemitada()) { |
720 | var parametrosModal = { | 723 | var parametrosModal = { |
721 | titulo: 'Búsqueda de monedas', | 724 | titulo: 'Búsqueda de monedas', |
722 | query: '/moneda', | 725 | query: '/moneda', |
723 | columnas: [ | 726 | columnas: [ |
724 | { | 727 | { |
725 | propiedad: 'DETALLE', | 728 | propiedad: 'DETALLE', |
726 | nombre: 'Nombre' | 729 | nombre: 'Nombre' |
727 | }, | 730 | }, |
728 | { | 731 | { |
729 | propiedad: 'SIMBOLO', | 732 | propiedad: 'SIMBOLO', |
730 | nombre: 'Símbolo' | 733 | nombre: 'Símbolo' |
731 | } | 734 | } |
732 | ], | 735 | ], |
733 | size: 'md' | 736 | size: 'md' |
734 | }; | 737 | }; |
735 | focaModalService.modal(parametrosModal).then( | 738 | focaModalService.modal(parametrosModal).then( |
736 | function(moneda) { | 739 | function(moneda) { |
737 | $scope.abrirModalCotizacion(moneda); | 740 | $scope.abrirModalCotizacion(moneda); |
738 | }, function() { | 741 | }, function() { |
739 | 742 | ||
740 | } | 743 | } |
741 | ); | 744 | ); |
742 | } | 745 | } |
743 | }; | 746 | }; |
744 | 747 | ||
745 | $scope.seleccionarObservaciones = function() { | 748 | $scope.seleccionarObservaciones = function() { |
746 | focaModalService | 749 | focaModalService |
747 | .prompt('Ingrese observaciones', $scope.notaPedido.observaciones, true) | 750 | .prompt('Ingrese observaciones', $scope.notaPedido.observaciones, true) |
748 | .then(function(observaciones) { | 751 | .then(function(observaciones) { |
749 | $scope.notaPedido.observaciones = observaciones; | 752 | $scope.notaPedido.observaciones = observaciones; |
750 | }); | 753 | }); |
751 | }; | 754 | }; |
752 | 755 | ||
753 | $scope.abrirModalCotizacion = function(moneda) { | 756 | $scope.abrirModalCotizacion = function(moneda) { |
754 | var modalInstance = $uibModal.open( | 757 | var modalInstance = $uibModal.open( |
755 | { | 758 | { |
756 | ariaLabelledBy: 'Busqueda de Cotización', | 759 | ariaLabelledBy: 'Busqueda de Cotización', |
757 | templateUrl: 'modal-cotizacion.html', | 760 | templateUrl: 'modal-cotizacion.html', |
758 | controller: 'focaModalCotizacionController', | 761 | controller: 'focaModalCotizacionController', |
759 | size: 'lg', | 762 | size: 'lg', |
760 | resolve: {idMoneda: function() {return moneda.ID;}} | 763 | resolve: {idMoneda: function() {return moneda.ID;}} |
761 | } | 764 | } |
762 | ); | 765 | ); |
763 | modalInstance.result.then( | 766 | modalInstance.result.then( |
764 | function(cotizacion) { | 767 | function(cotizacion) { |
765 | var articulosTablaTemp = $scope.articulosTabla; | 768 | var articulosTablaTemp = $scope.articulosTabla; |
766 | for(var i = 0; i < articulosTablaTemp.length; i++) { | 769 | for(var i = 0; i < articulosTablaTemp.length; i++) { |
767 | articulosTablaTemp[i].precio = articulosTablaTemp[i].precio * | 770 | articulosTablaTemp[i].precio = articulosTablaTemp[i].precio * |
768 | $scope.notaPedido.cotizacion.VENDEDOR; | 771 | $scope.notaPedido.cotizacion.VENDEDOR; |
769 | articulosTablaTemp[i].precio = articulosTablaTemp[i].precio / | 772 | articulosTablaTemp[i].precio = articulosTablaTemp[i].precio / |
770 | cotizacion.VENDEDOR; | 773 | cotizacion.VENDEDOR; |
771 | } | 774 | } |
772 | $scope.articulosTabla = articulosTablaTemp; | 775 | $scope.articulosTabla = articulosTablaTemp; |
773 | $scope.notaPedido.moneda = moneda; | 776 | $scope.notaPedido.moneda = moneda; |
774 | $scope.notaPedido.cotizacion = cotizacion; | 777 | $scope.notaPedido.cotizacion = cotizacion; |
775 | if(moneda.DETALLE === 'PESOS ARGENTINOS') { | 778 | if(moneda.DETALLE === 'PESOS ARGENTINOS') { |
776 | $scope.$broadcast('removeCabecera', 'Moneda:'); | 779 | $scope.$broadcast('removeCabecera', 'Moneda:'); |
777 | $scope.$broadcast('removeCabecera', 'Fecha cotizacion:'); | 780 | $scope.$broadcast('removeCabecera', 'Fecha cotizacion:'); |
778 | $scope.$broadcast('removeCabecera', 'Cotizacion:'); | 781 | $scope.$broadcast('removeCabecera', 'Cotizacion:'); |
779 | }else { | 782 | }else { |
780 | $scope.$broadcast('addCabecera', { | 783 | $scope.$broadcast('addCabecera', { |
781 | label: 'Moneda:', | 784 | label: 'Moneda:', |
782 | valor: moneda.DETALLE | 785 | valor: moneda.DETALLE |
783 | }); | 786 | }); |
784 | $scope.$broadcast('addCabecera', { | 787 | $scope.$broadcast('addCabecera', { |
785 | label: 'Fecha cotizacion:', | 788 | label: 'Fecha cotizacion:', |
786 | valor: $filter('date')(cotizacion.FECHA, 'dd/MM/yyyy') | 789 | valor: $filter('date')(cotizacion.FECHA, 'dd/MM/yyyy') |
787 | }); | 790 | }); |
788 | $scope.$broadcast('addCabecera', { | 791 | $scope.$broadcast('addCabecera', { |
789 | label: 'Cotizacion:', | 792 | label: 'Cotizacion:', |
790 | valor: $filter('number')(cotizacion.VENDEDOR, '2') | 793 | valor: $filter('number')(cotizacion.VENDEDOR, '2') |
791 | }); | 794 | }); |
792 | } | 795 | } |
793 | }, function() { | 796 | }, function() { |
794 | 797 | ||
795 | } | 798 | } |
796 | ); | 799 | ); |
797 | }; | 800 | }; |
798 | 801 | ||
799 | $scope.agregarATabla = function(key) { | 802 | $scope.agregarATabla = function(key) { |
800 | if(key === 13) { | 803 | if(key === 13) { |
801 | if($scope.articuloACargar.cantidad === undefined || | 804 | if($scope.articuloACargar.cantidad === undefined || |
802 | $scope.articuloACargar.cantidad === 0 || | 805 | $scope.articuloACargar.cantidad === 0 || |
803 | $scope.articuloACargar.cantidad === null ) { | 806 | $scope.articuloACargar.cantidad === null ) { |
804 | focaModalService.alert('El valor debe ser al menos 1'); | 807 | focaModalService.alert('El valor debe ser al menos 1'); |
805 | return; | 808 | return; |
806 | } | 809 | } |
807 | delete $scope.articuloACargar.sectorCodigo; | 810 | delete $scope.articuloACargar.sectorCodigo; |
808 | $scope.articulosTabla.push($scope.articuloACargar); | 811 | $scope.articulosTabla.push($scope.articuloACargar); |
809 | $scope.cargando = true; | 812 | $scope.cargando = true; |
810 | } | 813 | } |
811 | }; | 814 | }; |
812 | 815 | ||
813 | $scope.quitarArticulo = function(key) { | 816 | $scope.quitarArticulo = function(key) { |
814 | $scope.articulosTabla.splice(key, 1); | 817 | $scope.articulosTabla.splice(key, 1); |
815 | }; | 818 | }; |
816 | 819 | ||
817 | $scope.editarArticulo = function(key, articulo) { | 820 | $scope.editarArticulo = function(key, articulo) { |
818 | if(key === 13) { | 821 | if(key === 13) { |
819 | if(articulo.cantidad === null || articulo.cantidad === 0 || | 822 | if(articulo.cantidad === null || articulo.cantidad === 0 || |
820 | articulo.cantidad === undefined) { | 823 | articulo.cantidad === undefined) { |
821 | focaModalService.alert('El valor debe ser al menos 1'); | 824 | focaModalService.alert('El valor debe ser al menos 1'); |
822 | return; | 825 | return; |
823 | } | 826 | } |
824 | articulo.editCantidad = false; | 827 | articulo.editCantidad = false; |
825 | articulo.editPrecio = false; | 828 | articulo.editPrecio = false; |
826 | } | 829 | } |
827 | }; | 830 | }; |
828 | 831 | ||
829 | $scope.cambioEdit = function(articulo, propiedad) { | 832 | $scope.cambioEdit = function(articulo, propiedad) { |
830 | if(propiedad === 'cantidad') { | 833 | if(propiedad === 'cantidad') { |
831 | articulo.editCantidad = true; | 834 | articulo.editCantidad = true; |
832 | } else if(propiedad === 'precio') { | 835 | } else if(propiedad === 'precio') { |
833 | articulo.editPrecio = true; | 836 | articulo.editPrecio = true; |
834 | } | 837 | } |
835 | }; | 838 | }; |
836 | 839 | ||
837 | $scope.resetFilter = function() { | 840 | $scope.resetFilter = function() { |
838 | $scope.articuloACargar = {}; | 841 | $scope.articuloACargar = {}; |
839 | $scope.cargando = true; | 842 | $scope.cargando = true; |
840 | }; | 843 | }; |
841 | //Recibe aviso si el teclado está en uso | 844 | //Recibe aviso si el teclado está en uso |
842 | $rootScope.$on('usarTeclado', function(event, data) { | 845 | $rootScope.$on('usarTeclado', function(event, data) { |
843 | if(data) { | 846 | if(data) { |
844 | $scope.mostrarTeclado = true; | 847 | $scope.mostrarTeclado = true; |
845 | return; | 848 | return; |
846 | } | 849 | } |
847 | $scope.mostrarTeclado = false; | 850 | $scope.mostrarTeclado = false; |
848 | }); | 851 | }); |
849 | 852 | ||
850 | $scope.selectFocus = function($event) { | 853 | $scope.selectFocus = function($event) { |
851 | // Si el teclado esta en uso no selecciona el valor | 854 | // Si el teclado esta en uso no selecciona el valor |
852 | if($scope.mostrarTeclado) { | 855 | if($scope.mostrarTeclado) { |
853 | return; | 856 | return; |
854 | } | 857 | } |
855 | $event.target.select(); | 858 | $event.target.select(); |
856 | }; | 859 | }; |
857 | 860 | ||
858 | $scope.salir = function() { | 861 | $scope.salir = function() { |
859 | $location.path('/'); | 862 | $location.path('/'); |
860 | }; | 863 | }; |
861 | 864 | ||
862 | $scope.parsearATexto = function(articulo) { | 865 | $scope.parsearATexto = function(articulo) { |
863 | articulo.cantidad = parseFloat(articulo.cantidad); | 866 | articulo.cantidad = parseFloat(articulo.cantidad); |
864 | articulo.precio = parseFloat(articulo.precio); | 867 | articulo.precio = parseFloat(articulo.precio); |
865 | }; | 868 | }; |
866 | 869 | ||
867 | function addArrayCabecera(array) { | 870 | function addArrayCabecera(array) { |
868 | for(var i = 0; i < array.length; i++) { | 871 | for(var i = 0; i < array.length; i++) { |
869 | $scope.$broadcast('addCabecera', { | 872 | $scope.$broadcast('addCabecera', { |
870 | label: array[i].label, | 873 | label: array[i].label, |
871 | valor: array[i].valor | 874 | valor: array[i].valor |
872 | }); | 875 | }); |
873 | } | 876 | } |
874 | } | 877 | } |
875 | 878 | ||
876 | function validarNotaRemitada() { | 879 | function validarNotaRemitada() { |
877 | if(!$scope.notaPedido.idRemito) { | 880 | if(!$scope.notaPedido.idRemito) { |
878 | return true; | 881 | return true; |
879 | }else{ | 882 | }else{ |
880 | focaModalService.alert('No se puede editar una nota de pedido remitada'); | 883 | focaModalService.alert('No se puede editar una nota de pedido remitada'); |
881 | return false; | 884 | return false; |
882 | } | 885 | } |
883 | } | 886 | } |
884 | 887 | ||
885 | function formatearPuntosDescarga(puntosDescarga) { | 888 | function formatearPuntosDescarga(puntosDescarga) { |
886 | var result = []; | 889 | var result = []; |
887 | 890 | ||
888 | puntosDescarga.forEach(function(el) { | 891 | puntosDescarga.forEach(function(el) { |
889 | var puntoDescarga = result.filter(function(resultPunto) { | 892 | var puntoDescarga = result.filter(function(resultPunto) { |
890 | return resultPunto.id === el.idPuntoDescarga; | 893 | return resultPunto.id === el.idPuntoDescarga; |
891 | }); | 894 | }); |
892 | 895 | ||
893 | if(puntoDescarga.length) { | 896 | if(puntoDescarga.length) { |
894 | puntoDescarga[0].articulosAgregados.push({ | 897 | puntoDescarga[0].articulosAgregados.push({ |
895 | cantidad: el.cantidad, | 898 | cantidad: el.cantidad, |
896 | descripcion: el.producto.descripcion, | 899 | descripcion: el.producto.descripcion, |
897 | id: el.producto.id | 900 | id: el.producto.id |
898 | }); | 901 | }); |
899 | }else { | 902 | }else { |
900 | result.push({ | 903 | result.push({ |
901 | id: el.puntoDescarga.id, | 904 | id: el.puntoDescarga.id, |
902 | id_cliente: el.puntoDescarga.id_cliente, | 905 | id_cliente: el.puntoDescarga.id_cliente, |
903 | id_da_config_0: el.puntoDescarga.id_da_config_0, | 906 | id_da_config_0: el.puntoDescarga.id_da_config_0, |
904 | latitud: el.puntoDescarga.latitud, | 907 | latitud: el.puntoDescarga.latitud, |
905 | longitud: el.puntoDescarga.longitud, | 908 | longitud: el.puntoDescarga.longitud, |
906 | descripcion: el.puntoDescarga.descripcion, | 909 | descripcion: el.puntoDescarga.descripcion, |
907 | articulosAgregados: [ | 910 | articulosAgregados: [ |
908 | { | 911 | { |
909 | cantidad: el.cantidad, | 912 | cantidad: el.cantidad, |
910 | descripcion: el.producto.descripcion, | 913 | descripcion: el.producto.descripcion, |
911 | id: el.producto.id | 914 | id: el.producto.id |
912 | } | 915 | } |
913 | ] | 916 | ] |
914 | }); | 917 | }); |
915 | } | 918 | } |
916 | }); | 919 | }); |
917 | return result; | 920 | return result; |
918 | } | 921 | } |
919 | 922 | ||
920 | function salir() { | 923 | function salir() { |
921 | var confirmacion = false; | 924 | var confirmacion = false; |
922 | 925 | ||
923 | angular.forEach($scope.inicial, function(valor, key) { | 926 | angular.forEach($scope.inicial, function(valor, key) { |
924 | if (!angular.equals($scope[key], $scope.inicial[key])) { | 927 | if (!angular.equals($scope[key], $scope.inicial[key])) { |
925 | confirmacion = true; | 928 | confirmacion = true; |
926 | } | 929 | } |
927 | }); | 930 | }); |
928 | 931 | ||
929 | if (confirmacion) { | 932 | if (confirmacion) { |
930 | focaModalService.confirm( | 933 | focaModalService.confirm( |
931 | '¿Está seguro de que desea salir? Se perderán todos los datos cargados.' | 934 | '¿Está seguro de que desea salir? Se perderán todos los datos cargados.' |
932 | ).then(function(data) { | 935 | ).then(function(data) { |
933 | if (data) { | 936 | if (data) { |
934 | $location.path('/'); | 937 | $location.path('/'); |
935 | } | 938 | } |
936 | }); | 939 | }); |
937 | } else { | 940 | } else { |
938 | $location.path('/'); | 941 | $location.path('/'); |
939 | } | 942 | } |
940 | } | 943 | } |
941 | } | 944 | } |
-
mentioned in commit ce0ef7