Commit 8a632ac2c9bcb898643cc331c1964906fdd7ebda
1 parent
216006b8ce
Exists in
master
arreglo formato de tabla
Showing
1 changed file
with
1 additions
and
2 deletions
Show diff stats
src/js/controller.js
1 | angular.module('focaOrdenCarga') | 1 | angular.module('focaOrdenCarga') |
2 | .controller('focaOrdenCargaController', [ | 2 | .controller('focaOrdenCargaController', [ |
3 | '$scope', | 3 | '$scope', |
4 | '$location', | 4 | '$location', |
5 | '$filter', | 5 | '$filter', |
6 | '$timeout', | 6 | '$timeout', |
7 | 'focaOrdenCargaService', | 7 | 'focaOrdenCargaService', |
8 | 'focaBotoneraLateralService', | 8 | 'focaBotoneraLateralService', |
9 | 'focaModalService', | 9 | 'focaModalService', |
10 | '$uibModal', | 10 | '$uibModal', |
11 | function ( | 11 | function ( |
12 | $scope, $location, $filter, $timeout, focaOrdenCargaService, | 12 | $scope, $location, $filter, $timeout, focaOrdenCargaService, |
13 | focaBotoneraLateralService, focaModalService, $uibModal) { | 13 | focaBotoneraLateralService, focaModalService, $uibModal) { |
14 | 14 | ||
15 | init(); | 15 | init(); |
16 | 16 | ||
17 | function init() { | 17 | function init() { |
18 | // PARAMETROS INICIALES PARA FUNCIONAMIENTO DEL PROGRAMA | 18 | // PARAMETROS INICIALES PARA FUNCIONAMIENTO DEL PROGRAMA |
19 | $scope.fecha = new Date(); | 19 | $scope.fecha = new Date(); |
20 | $scope.isNumber = angular.isNumber; | 20 | $scope.isNumber = angular.isNumber; |
21 | $scope.show = false; | 21 | $scope.show = false; |
22 | $scope.cargando = true; | 22 | $scope.cargando = true; |
23 | $scope.cabeceras = []; | 23 | $scope.cabeceras = []; |
24 | $scope.botonera = focaOrdenCargaService.getBotonera(); | 24 | $scope.botonera = focaOrdenCargaService.getBotonera(); |
25 | $scope.dateOptions = { | 25 | $scope.dateOptions = { |
26 | maxDate: new Date(), | 26 | maxDate: new Date(), |
27 | minDate: new Date(2010, 0, 1) | 27 | minDate: new Date(2010, 0, 1) |
28 | }; | 28 | }; |
29 | $scope.ordenCarga = { | 29 | $scope.ordenCarga = { |
30 | id: 0, | 30 | id: 0, |
31 | cliente: {}, | 31 | cliente: {}, |
32 | proveedor: {}, | 32 | proveedor: {}, |
33 | domicilio: { dom: '' }, | 33 | domicilio: { dom: '' }, |
34 | vendedor: {}, | 34 | vendedor: {}, |
35 | fechaCarga: new Date(), | 35 | fechaCarga: new Date(), |
36 | cotizacion: {}, | 36 | cotizacion: {}, |
37 | articulosNotaPedido: [], | 37 | articulosNotaPedido: [], |
38 | notaPedidoPlazo: [], | 38 | notaPedidoPlazo: [], |
39 | notaPedidoPuntoDescarga: [] | 39 | notaPedidoPuntoDescarga: [] |
40 | }; | 40 | }; |
41 | $scope.hojaRuta = { | 41 | $scope.hojaRuta = { |
42 | fecha: new Date(), | 42 | fecha: new Date(), |
43 | litros: 0, | 43 | litros: 0, |
44 | chofer: {}, | 44 | chofer: {}, |
45 | vehiculo: { | 45 | vehiculo: { |
46 | capacidad: 0, | 46 | capacidad: 0, |
47 | cisternas: [] | 47 | cisternas: [] |
48 | }, | 48 | }, |
49 | transportista: {}, | 49 | transportista: {}, |
50 | remitosTabla: [] | 50 | remitosTabla: [] |
51 | }; | 51 | }; |
52 | } | 52 | } |
53 | 53 | ||
54 | //SETEO BOTONERA LATERAL | 54 | //SETEO BOTONERA LATERAL |
55 | $timeout(function () { | 55 | $timeout(function () { |
56 | focaBotoneraLateralService.showSalir(false); | 56 | focaBotoneraLateralService.showSalir(false); |
57 | focaBotoneraLateralService.showPausar(true); | 57 | focaBotoneraLateralService.showPausar(true); |
58 | focaBotoneraLateralService.showGuardar(true, $scope.crearNotaPedido); | 58 | focaBotoneraLateralService.showGuardar(true, $scope.crearNotaPedido); |
59 | focaBotoneraLateralService.addCustomButton('Salir', salir); | 59 | focaBotoneraLateralService.addCustomButton('Salir', salir); |
60 | }); | 60 | }); |
61 | 61 | ||
62 | $scope.seleccionarVehiculo = function () { | 62 | $scope.seleccionarVehiculo = function () { |
63 | 63 | ||
64 | seleccionarTransportista().then( | 64 | seleccionarTransportista().then( |
65 | 65 | ||
66 | function (transportista) { | 66 | function (transportista) { |
67 | elegirTransportista(transportista); | 67 | elegirTransportista(transportista); |
68 | 68 | ||
69 | var parametrosModal = { | 69 | var parametrosModal = { |
70 | columnas: [ | 70 | columnas: [ |
71 | { | 71 | { |
72 | propiedad: 'codigo', | 72 | propiedad: 'codigo', |
73 | nombre: 'Código' | 73 | nombre: 'Código' |
74 | }, | 74 | }, |
75 | { | 75 | { |
76 | propiedad: 'tractor', | 76 | propiedad: 'tractor', |
77 | nombre: 'tractor' | 77 | nombre: 'tractor' |
78 | }, | 78 | }, |
79 | { | 79 | { |
80 | propiedad: 'semi', | 80 | propiedad: 'semi', |
81 | nombre: 'Semi' | 81 | nombre: 'Semi' |
82 | }, | 82 | }, |
83 | { | 83 | { |
84 | propiedad: 'capacidadTotalCisternas', | 84 | propiedad: 'capacidadTotalCisternas', |
85 | nombre: 'Capacidad' | 85 | nombre: 'Capacidad' |
86 | }, | 86 | }, |
87 | // { | 87 | // { |
88 | // propiedad: 'cantidad', | 88 | // propiedad: 'cantidad', |
89 | // nombre: 'carga' | 89 | // nombre: 'carga' |
90 | // } | 90 | // } |
91 | ], | 91 | ], |
92 | query: '/vehiculo/transportista/' + transportista.COD, | 92 | query: '/vehiculo/transportista/' + transportista.COD, |
93 | // query: '/cisterna_carga/cisterna/vehiculo/transportista/' + transportista.COD, | 93 | // query: '/cisterna_carga/cisterna/vehiculo/transportista/' + transportista.COD, |
94 | titulo: 'Búsqueda de vehiculos', | 94 | titulo: 'Búsqueda de vehiculos', |
95 | subTitulo: transportista.COD + '-' + transportista.NOM | 95 | subTitulo: transportista.COD + '-' + transportista.NOM |
96 | }; | 96 | }; |
97 | 97 | ||
98 | focaModalService.modal(parametrosModal).then( | 98 | focaModalService.modal(parametrosModal).then( |
99 | function (vehiculo) { | 99 | function (vehiculo) { |
100 | $scope.$broadcast('addCabecera', { | 100 | $scope.$broadcast('addCabecera', { |
101 | label: 'Vehículo:', | 101 | label: 'Vehículo:', |
102 | valor: vehiculo.codigo | 102 | valor: vehiculo.codigo |
103 | }); | 103 | }); |
104 | $scope.hojaRuta.vehiculo = vehiculo; | 104 | $scope.hojaRuta.vehiculo = vehiculo; |
105 | $scope.hojaRuta.transportista = transportista; | 105 | $scope.hojaRuta.transportista = transportista; |
106 | $scope.hojaRuta.vehiculo.cisternas = vehiculo.cisternas; | 106 | $scope.hojaRuta.vehiculo.cisternas = vehiculo.cisternas; |
107 | getEstadosCisternas($scope.hojaRuta.vehiculo.cisternas); | 107 | getEstadosCisternas($scope.hojaRuta.vehiculo.cisternas); |
108 | console.log($scope.hojaRuta.vehiculo.cisternas); | ||
109 | }, function () { | 108 | }, function () { |
110 | seleccionarTransportista(); | 109 | seleccionarTransportista(); |
111 | }); | 110 | }); |
112 | }); | 111 | }); |
113 | }; | 112 | }; |
114 | 113 | ||
115 | function seleccionarTransportista() { | 114 | function seleccionarTransportista() { |
116 | var parametrosModal = { | 115 | var parametrosModal = { |
117 | titulo: 'Búsqueda de Transportista', | 116 | titulo: 'Búsqueda de Transportista', |
118 | query: '/transportista', | 117 | query: '/transportista', |
119 | columnas: [ | 118 | columnas: [ |
120 | { | 119 | { |
121 | nombre: 'Código', | 120 | nombre: 'Código', |
122 | propiedad: 'COD' | 121 | propiedad: 'COD' |
123 | }, | 122 | }, |
124 | { | 123 | { |
125 | nombre: 'Nombre', | 124 | nombre: 'Nombre', |
126 | propiedad: 'NOM' | 125 | propiedad: 'NOM' |
127 | }, | 126 | }, |
128 | { | 127 | { |
129 | nombre: 'CUIT', | 128 | nombre: 'CUIT', |
130 | propiedad: 'CUIT' | 129 | propiedad: 'CUIT' |
131 | } | 130 | } |
132 | ] | 131 | ] |
133 | }; | 132 | }; |
134 | return focaModalService.modal(parametrosModal); | 133 | return focaModalService.modal(parametrosModal); |
135 | }; | 134 | }; |
136 | 135 | ||
137 | $scope.seleccionarFechaDeReparto = function () { | 136 | $scope.seleccionarFechaDeReparto = function () { |
138 | focaModalService.modalFecha('Fecha').then(function (fecha) { | 137 | focaModalService.modalFecha('Fecha').then(function (fecha) { |
139 | $scope.$broadcast('addCabecera', { | 138 | $scope.$broadcast('addCabecera', { |
140 | label: 'Fecha:', | 139 | label: 'Fecha:', |
141 | valor: fecha.toLocaleDateString() | 140 | valor: fecha.toLocaleDateString() |
142 | }); | 141 | }); |
143 | 142 | ||
144 | $scope.fecha = fecha; | 143 | $scope.fecha = fecha; |
145 | if ($scope.hojaRuta.vehiculo.cisternas) | 144 | if ($scope.hojaRuta.vehiculo.cisternas) |
146 | getEstadosCisternas($scope.hojaRuta.vehiculo.cisternas); | 145 | getEstadosCisternas($scope.hojaRuta.vehiculo.cisternas); |
147 | }); | 146 | }); |
148 | }; | 147 | }; |
149 | 148 | ||
150 | $scope.seleccionarHojasDeRuta = function () { | 149 | $scope.seleccionarHojasDeRuta = function () { |
151 | if (!$scope.hojaRuta.vehiculo.cisternas.length) { | 150 | if (!$scope.hojaRuta.vehiculo.cisternas.length) { |
152 | focaModalService.alert('Primero seleccione un vehículo con cisternas'); | 151 | focaModalService.alert('Primero seleccione un vehículo con cisternas'); |
153 | return; | 152 | return; |
154 | } | 153 | } |
155 | $uibModal.open( | 154 | $uibModal.open( |
156 | { | 155 | { |
157 | ariaLabelledBy: 'Hojas de Ruta', | 156 | ariaLabelledBy: 'Hojas de Ruta', |
158 | templateUrl: 'modal-hojas-ruta.html', | 157 | templateUrl: 'modal-hojas-ruta.html', |
159 | controller: 'focaOrdenCargaController', | 158 | controller: 'focaOrdenCargaController', |
160 | size: 'md', | 159 | size: 'md', |
161 | resolve: { | 160 | resolve: { |
162 | filters: { | 161 | filters: { |
163 | cisternas: $scope.hojaRuta.vehiculo.id | 162 | cisternas: $scope.hojaRuta.vehiculo.id |
164 | } | 163 | } |
165 | } | 164 | } |
166 | } | 165 | } |
167 | ); | 166 | ); |
168 | var idVehiculo = $scope.hojaRuta.vehiculo.id | 167 | var idVehiculo = $scope.hojaRuta.vehiculo.id |
169 | focaOrdenCargaService.getHojasRuta(idVehiculo) | 168 | focaOrdenCargaService.getHojasRuta(idVehiculo) |
170 | .then(function (res) { | 169 | .then(function (res) { |
171 | console.log(res); | 170 | console.log(res); |
172 | }) | 171 | }) |
173 | .catch(function (err) { | 172 | .catch(function (err) { |
174 | console.error(err) | 173 | console.error(err) |
175 | }) | 174 | }) |
176 | } | 175 | } |
177 | 176 | ||
178 | $scope.seleccionarRemitoAbierto = function () { | 177 | $scope.seleccionarRemitoAbierto = function () { |
179 | if ($scope.hojaRuta.vehiculo.capacidad === 0) { | 178 | if ($scope.hojaRuta.vehiculo.capacidad === 0) { |
180 | focaModalService.alert('Debe ingresar vehiculo'); | 179 | focaModalService.alert('Debe ingresar vehiculo'); |
181 | return; | 180 | return; |
182 | } else { | 181 | } else { |
183 | mostrarDetalle($scope.hojaRuta); | 182 | mostrarDetalle($scope.hojaRuta); |
184 | } | 183 | } |
185 | }; | 184 | }; |
186 | 185 | ||
187 | $scope.seleccionarChofer = function () { | 186 | $scope.seleccionarChofer = function () { |
188 | var parametrosModal = { | 187 | var parametrosModal = { |
189 | titulo: 'Búsqueda de Chofer', | 188 | titulo: 'Búsqueda de Chofer', |
190 | query: '/chofer', | 189 | query: '/chofer', |
191 | columnas: [ | 190 | columnas: [ |
192 | { | 191 | { |
193 | propiedad: 'id', | 192 | propiedad: 'id', |
194 | nombre: 'Código', | 193 | nombre: 'Código', |
195 | filtro: { | 194 | filtro: { |
196 | nombre: 'rellenarDigitos', | 195 | nombre: 'rellenarDigitos', |
197 | parametro: 3 | 196 | parametro: 3 |
198 | } | 197 | } |
199 | }, | 198 | }, |
200 | { | 199 | { |
201 | propiedad: 'nombre', | 200 | propiedad: 'nombre', |
202 | nombre: 'Nombre' | 201 | nombre: 'Nombre' |
203 | }, | 202 | }, |
204 | { | 203 | { |
205 | propiedad: 'dni', | 204 | propiedad: 'dni', |
206 | nombre: 'DNI' | 205 | nombre: 'DNI' |
207 | }, | 206 | }, |
208 | { | 207 | { |
209 | propiedad: 'telefono', | 208 | propiedad: 'telefono', |
210 | nombre: 'Teléfono' | 209 | nombre: 'Teléfono' |
211 | } | 210 | } |
212 | ] | 211 | ] |
213 | }; | 212 | }; |
214 | focaModalService.modal(parametrosModal).then( | 213 | focaModalService.modal(parametrosModal).then( |
215 | function (chofer) { | 214 | function (chofer) { |
216 | $scope.ordenCarga.chofer = chofer; | 215 | $scope.ordenCarga.chofer = chofer; |
217 | $scope.$broadcast('addCabecera', { | 216 | $scope.$broadcast('addCabecera', { |
218 | label: 'Chofer:', | 217 | label: 'Chofer:', |
219 | valor: $filter('rellenarDigitos')(chofer.id, 3) + ' - ' + chofer.nombre | 218 | valor: $filter('rellenarDigitos')(chofer.id, 3) + ' - ' + chofer.nombre |
220 | }); | 219 | }); |
221 | 220 | ||
222 | $filter('filter')($scope.botonera, { | 221 | $filter('filter')($scope.botonera, { |
223 | label: 'Chofer', | 222 | label: 'Chofer', |
224 | })[0].checked = true; | 223 | })[0].checked = true; |
225 | }, function () { | 224 | }, function () { |
226 | // funcion ejecutada cuando se cancela el modal | 225 | // funcion ejecutada cuando se cancela el modal |
227 | } | 226 | } |
228 | ); | 227 | ); |
229 | }; | 228 | }; |
230 | 229 | ||
231 | $scope.seleccionarGraficar = function () { | 230 | $scope.seleccionarGraficar = function () { |
232 | if (!$scope.hojaRuta.vehiculo.cisternas.length) { | 231 | if (!$scope.hojaRuta.vehiculo.cisternas.length) { |
233 | focaModalService.alert('Primero seleccione un vehículo con cisternas'); | 232 | focaModalService.alert('Primero seleccione un vehículo con cisternas'); |
234 | return; | 233 | return; |
235 | } | 234 | } |
236 | $uibModal.open( | 235 | $uibModal.open( |
237 | { | 236 | { |
238 | ariaLabelledBy: 'Grafico de cisternas', | 237 | ariaLabelledBy: 'Grafico de cisternas', |
239 | templateUrl: 'modal-grafico-cisternas.html', | 238 | templateUrl: 'modal-grafico-cisternas.html', |
240 | controller: 'focaModalGraficoCisternasController', | 239 | controller: 'focaModalGraficoCisternasController', |
241 | size: 'md', | 240 | size: 'md', |
242 | resolve: { | 241 | resolve: { |
243 | filters: { | 242 | filters: { |
244 | cisternas: $scope.hojaRuta.vehiculo.cisternas | 243 | cisternas: $scope.hojaRuta.vehiculo.cisternas |
245 | } | 244 | } |
246 | } | 245 | } |
247 | } | 246 | } |
248 | ); | 247 | ); |
249 | }; | 248 | }; |
250 | 249 | ||
251 | function elegirTransportista(transportista) { | 250 | function elegirTransportista(transportista) { |
252 | var codigo = ('00000' + transportista.COD).slice(-5); | 251 | var codigo = ('00000' + transportista.COD).slice(-5); |
253 | $scope.idTransportista = transportista.COD; | 252 | $scope.idTransportista = transportista.COD; |
254 | $scope.filtros = transportista.NOM.trim(); | 253 | $scope.filtros = transportista.NOM.trim(); |
255 | $scope.$broadcast('addCabecera', { | 254 | $scope.$broadcast('addCabecera', { |
256 | label: 'Transportista:', | 255 | label: 'Transportista:', |
257 | valor: codigo + ' - ' + transportista.NOM | 256 | valor: codigo + ' - ' + transportista.NOM |
258 | }); | 257 | }); |
259 | } | 258 | } |
260 | 259 | ||
261 | function getEstadosCisternas(cisternas) { | 260 | function getEstadosCisternas(cisternas) { |
262 | cisternas.forEach(function (cisterna) { | 261 | cisternas.forEach(function (cisterna) { |
263 | focaOrdenCargaService | 262 | focaOrdenCargaService |
264 | .getEstadoCisterna(cisterna.id, $scope.fecha) | 263 | .getEstadoCisterna(cisterna.id, $scope.fecha) |
265 | .then(function (res) { | 264 | .then(function (res) { |
266 | cisterna.estado = res.data; | 265 | cisterna.estado = res.data; |
267 | }) | 266 | }) |
268 | .catch(function (err) { console.error(err) }); | 267 | .catch(function (err) { console.error(err) }); |
269 | }); | 268 | }); |
270 | } | 269 | } |
271 | 270 | ||
272 | function mostrarDetalle(hojasRutas) { | 271 | function mostrarDetalle(hojasRutas) { |
273 | var modalInstance = $uibModal.open( | 272 | var modalInstance = $uibModal.open( |
274 | { | 273 | { |
275 | ariaLabelledBy: '', | 274 | ariaLabelledBy: '', |
276 | templateUrl: 'modal-detalle-carga.html', | 275 | templateUrl: 'modal-detalle-carga.html', |
277 | controller: 'focaModalDetalleController', | 276 | controller: 'focaModalDetalleController', |
278 | resolve: { | 277 | resolve: { |
279 | parametrosModal: function () { | 278 | parametrosModal: function () { |
280 | return { | 279 | return { |
281 | hojasRutas: hojasRutas, | 280 | hojasRutas: hojasRutas, |
282 | orden: $scope.hojaRuta.orden | 281 | orden: $scope.hojaRuta.orden |
283 | }; | 282 | }; |
284 | } | 283 | } |
285 | }, | 284 | }, |
286 | size: 'lg', | 285 | size: 'lg', |
287 | backdrop: false | 286 | backdrop: false |
288 | } | 287 | } |
289 | ); | 288 | ); |
290 | return modalInstance.result | 289 | return modalInstance.result |
291 | .then(function (res) { | 290 | .then(function (res) { |
292 | res.cisternas.forEach(function (cisterna) { | 291 | res.cisternas.forEach(function (cisterna) { |
293 | $scope.cisternaCargas.push(cisterna.cisternaCarga); | 292 | $scope.cisternaCargas.push(cisterna.cisternaCarga); |
294 | }); | 293 | }); |
295 | $scope.cisternaMovimientos = res.movimientos; | 294 | $scope.cisternaMovimientos = res.movimientos; |
296 | $scope.articulosRecibidos = res.articulos; | 295 | $scope.articulosRecibidos = res.articulos; |
297 | $scope.articulos = res.articulos; | 296 | $scope.articulos = res.articulos; |
298 | $filter('filter')($scope.botonera, { | 297 | $filter('filter')($scope.botonera, { |
299 | label: 'Detalle de Carga', | 298 | label: 'Detalle de Carga', |
300 | })[0].checked = true; | 299 | })[0].checked = true; |
301 | }) | 300 | }) |
302 | .catch(function (e) { console.error(e); }); | 301 | .catch(function (e) { console.error(e); }); |
303 | }; | 302 | }; |
304 | 303 | ||
305 | function crearOrdenCarga() { | 304 | function crearOrdenCarga() { |
306 | if (!$scope.hojaRuta.vehiculo) { | 305 | if (!$scope.hojaRuta.vehiculo) { |
307 | focaModalService.alert('Ingrese Vehículo'); | 306 | focaModalService.alert('Ingrese Vehículo'); |
308 | return; | 307 | return; |
309 | } else if (!$scope.hojaRuta.chofer) { | 308 | } else if (!$scope.hojaRuta.chofer) { |
310 | focaBotoneraLateralService.alert('Ingrese Chofer'); | 309 | focaBotoneraLateralService.alert('Ingrese Chofer'); |
311 | return; | 310 | return; |
312 | } | 311 | } |
313 | 312 | ||
314 | focaBotoneraLateralService.startGuardar(); | 313 | focaBotoneraLateralService.startGuardar(); |
315 | $scope.saveLoading = true; | 314 | $scope.saveLoading = true; |
316 | 315 | ||
317 | } | 316 | } |
318 | 317 | ||
319 | $scope.$watch('ordenCarga', function (newValue) { | 318 | $scope.$watch('ordenCarga', function (newValue) { |
320 | focaBotoneraLateralService.setPausarData({ | 319 | focaBotoneraLateralService.setPausarData({ |
321 | label: 'ordenCarga', | 320 | label: 'ordenCarga', |
322 | val: newValue | 321 | val: newValue |
323 | }); | 322 | }); |
324 | }, true); | 323 | }, true); |
325 | 324 | ||
326 | $scope.$watch('ordenCarga', function (newValue) { | 325 | $scope.$watch('ordenCarga', function (newValue) { |
327 | focaBotoneraLateralService.setPausarData({ | 326 | focaBotoneraLateralService.setPausarData({ |
328 | label: 'ordenCarga', | 327 | label: 'ordenCarga', |
329 | val: newValue | 328 | val: newValue |
330 | }); | 329 | }); |
331 | focaBotoneraLateralService.setRutasPausadas({ | 330 | focaBotoneraLateralService.setRutasPausadas({ |
332 | label: 'rutas', | 331 | label: 'rutas', |
333 | val: 'orden-carga' | 332 | val: 'orden-carga' |
334 | }); | 333 | }); |
335 | }, true); | 334 | }, true); |
336 | 335 | ||
337 | $scope.salir = function () { | 336 | $scope.salir = function () { |
338 | $location.path('/'); | 337 | $location.path('/'); |
339 | }; | 338 | }; |
340 | 339 | ||
341 | function salir() { | 340 | function salir() { |
342 | var confirmacion = false; | 341 | var confirmacion = false; |
343 | 342 | ||
344 | if (!angular.equals($scope.ordenCarga, $scope.inicial)) { | 343 | if (!angular.equals($scope.ordenCarga, $scope.inicial)) { |
345 | confirmacion = true; | 344 | confirmacion = true; |
346 | } | 345 | } |
347 | 346 | ||
348 | if (confirmacion) { | 347 | if (confirmacion) { |
349 | focaModalService.confirm( | 348 | focaModalService.confirm( |
350 | '¿Está seguro de que desea salir? Se perderán todos los datos cargados.' | 349 | '¿Está seguro de que desea salir? Se perderán todos los datos cargados.' |
351 | ).then(function (data) { | 350 | ).then(function (data) { |
352 | if (data) { | 351 | if (data) { |
353 | $location.path('/'); | 352 | $location.path('/'); |
354 | } | 353 | } |
355 | }); | 354 | }); |
356 | } else { | 355 | } else { |
357 | $location.path('/'); | 356 | $location.path('/'); |
358 | } | 357 | } |
359 | } | 358 | } |
360 | }]); | 359 | }]); |
361 | 360 |