Commit dccee8a6d61ca5ad7a64834942d68df3b4721fbf
Exists in
master
and in
2 other branches
Merge branch 'master' into 'develop'
Master(benjamin) See merge request !53
Showing
3 changed files
Show diff stats
src/js/controller.js
1 | angular.module('focaLogisticaPedidoRuta') .controller('focaLogisticaPedidoRutaController', [ | 1 | angular.module('focaLogisticaPedidoRuta') .controller('focaLogisticaPedidoRutaController', [ |
2 | '$scope', 'focaLogisticaPedidoRutaService', '$location', '$uibModal', '$filter', | 2 | '$scope', 'focaLogisticaPedidoRutaService', '$location', '$uibModal', '$filter', |
3 | 'focaModalService', 'focaBotoneraLateralService', '$interval', | 3 | 'focaModalService', 'focaBotoneraLateralService', '$interval', |
4 | function($scope, focaLogisticaPedidoRutaService, $location, $uibModal, $filter, | 4 | function($scope, focaLogisticaPedidoRutaService, $location, $uibModal, $filter, |
5 | focaModalService, focaBotoneraLateralService, $interval | 5 | focaModalService, focaBotoneraLateralService, $interval |
6 | ) { | 6 | ) { |
7 | $scope.actividad = 'Logistica'; | 7 | $scope.actividad = 'Logistica'; |
8 | //Datos Pantalla | 8 | //Datos Pantalla |
9 | $scope.titulo = 'Logistica de Pedidos'; | 9 | $scope.titulo = 'Logistica de Pedidos'; |
10 | 10 | ||
11 | var transportista = { | 11 | var transportista = { |
12 | label: 'Vehículo', | 12 | label: 'Vehículo', |
13 | image: 'abmChofer.png' | 13 | image: 'abmChofer.png' |
14 | }; | 14 | }; |
15 | var fecha = { | 15 | var fecha = { |
16 | label: 'Fecha Reparto', | 16 | label: 'Fecha Reparto', |
17 | image: 'FechaEntrega.png' | 17 | image: 'FechaEntrega.png' |
18 | }; | 18 | }; |
19 | $scope.botonera = [fecha, transportista]; | 19 | $scope.botonera = [fecha, transportista]; |
20 | var cabecera = ''; | 20 | var cabecera = ''; |
21 | $scope.now = new Date(); | 21 | $scope.now = new Date(); |
22 | $scope.idVendedor = 0; | 22 | $scope.idVendedor = 0; |
23 | $scope.marcadores = []; | 23 | $scope.marcadores = []; |
24 | $scope.vehiculos = []; | 24 | $scope.vehiculos = []; |
25 | getSeguimiento(); | 25 | getSeguimiento(); |
26 | $scope.arrastrando = false; | 26 | $scope.arrastrando = false; |
27 | $scope.general = function() { | 27 | $scope.general = function() { |
28 | $scope.idVendedor = 0; | 28 | $scope.idVendedor = 0; |
29 | getSeguimiento(); | 29 | getSeguimiento(); |
30 | }; | 30 | }; |
31 | 31 | ||
32 | setearFecha(new Date()); | 32 | setearFecha(new Date()); |
33 | 33 | ||
34 | //SETEO BOTONERA LATERAL | 34 | //SETEO BOTONERA LATERAL |
35 | focaBotoneraLateralService.showSalir(true); | 35 | focaBotoneraLateralService.showSalir(true); |
36 | focaBotoneraLateralService.showPausar(false); | 36 | focaBotoneraLateralService.showPausar(false); |
37 | focaBotoneraLateralService.showGuardar(false); | 37 | focaBotoneraLateralService.showGuardar(false); |
38 | 38 | ||
39 | $scope.general = function() { | 39 | $scope.general = function() { |
40 | $scope.idVendedor = 0; | 40 | $scope.idVendedor = 0; |
41 | getSeguimiento(); | 41 | getSeguimiento(); |
42 | $scope.$broadcast('removeCabecera', cabecera); | 42 | $scope.$broadcast('removeCabecera', cabecera); |
43 | $scope.$broadcast('addCabecera', { | 43 | $scope.$broadcast('addCabecera', { |
44 | label: 'General', | 44 | label: 'General', |
45 | valor: '' | 45 | valor: '' |
46 | }); | 46 | }); |
47 | }; | 47 | }; |
48 | 48 | ||
49 | $scope.cargar = function(idVehiculo, punto) { | 49 | $scope.cargar = function(idVehiculo, punto) { |
50 | if (!eligioFecha()) return; | 50 | if (!eligioFecha()) return; |
51 | var idRemito; | 51 | var idRemito; |
52 | if (punto === -1) { | 52 | if (punto === -1) { |
53 | idRemito = -1; | 53 | idRemito = -1; |
54 | } else { | 54 | } else { |
55 | idRemito = JSON.parse(punto).notaPedido.remito.id; | 55 | idRemito = JSON.parse(punto).notaPedido.remito.id; |
56 | } | 56 | } |
57 | $uibModal.open( | 57 | $uibModal.open( |
58 | { | 58 | { |
59 | ariaLabelledBy: 'Busqueda de Vehiculo', | 59 | ariaLabelledBy: 'Busqueda de Vehiculo', |
60 | templateUrl: 'foca-detalle-vehiculo.html', | 60 | templateUrl: 'foca-detalle-vehiculo.html', |
61 | controller: 'focaDetalleVehiculo', | 61 | controller: 'focaDetalleVehiculo', |
62 | size: 'lg', | 62 | size: 'lg', |
63 | resolve: { | 63 | resolve: { |
64 | idVehiculo: function() {return idVehiculo;}, | 64 | idVehiculo: function() {return idVehiculo;}, |
65 | idRemito: function() {return idRemito;}, | 65 | idRemito: function() {return idRemito;}, |
66 | fechaReparto: function() {return $scope.fechaReparto;} | 66 | fechaReparto: function() {return $scope.fechaReparto;} |
67 | } | 67 | } |
68 | } | 68 | } |
69 | ); | 69 | ); |
70 | }; | 70 | }; |
71 | 71 | ||
72 | $scope.quitarVehiculo = function(vehiculo) { | 72 | $scope.quitarVehiculo = function(vehiculo) { |
73 | if (!eligioFecha() || vehiculoEnUso(vehiculo)) return; | 73 | if (!eligioFecha() || vehiculoEnUso(vehiculo)) return; |
74 | 74 | ||
75 | focaModalService.confirm('Esta seguro que desea eliminar el vehículo ' + | 75 | focaModalService.confirm('Esta seguro que desea eliminar el vehículo ' + |
76 | vehiculo.codigo + ' de ' + vehiculo.transportista.NOM + '?').then(function() { | 76 | vehiculo.codigo + ' de ' + vehiculo.transportista.NOM + '?').then(function() { |
77 | eliminarVehiculo(vehiculo); | 77 | eliminarVehiculo(vehiculo); |
78 | }); | 78 | }); |
79 | }; | 79 | }; |
80 | 80 | ||
81 | $scope.hacerHojaRuta = function(vehiculo, cerrar) { | 81 | $scope.hacerHojaRuta = function(vehiculo, cerrar) { |
82 | if (!eligioFecha() || vehiculoEnUso(vehiculo)) return; | 82 | if (!eligioFecha() || vehiculoEnUso(vehiculo)) return; |
83 | var modalInstance = $uibModal.open( | 83 | var modalInstance = $uibModal.open( |
84 | { | 84 | { |
85 | ariaLabelledBy: 'Creación hoja ruta', | 85 | ariaLabelledBy: 'Creación hoja ruta', |
86 | templateUrl: 'foca-modal-cerrar-vehiculo.html', | 86 | templateUrl: 'foca-modal-cerrar-vehiculo.html', |
87 | controller: 'focaModalCerrarVehiculo', | 87 | controller: 'focaModalCerrarVehiculo', |
88 | size: 'lg', | 88 | size: 'lg', |
89 | resolve: { | 89 | resolve: { |
90 | idVehiculo: function() {return vehiculo.id;}, | 90 | idVehiculo: function() {return vehiculo.id;}, |
91 | fechaReparto: function() {return $scope.fechaReparto;}, | 91 | fechaReparto: function() {return $scope.fechaReparto;}, |
92 | cerrar: function() {return cerrar;} | 92 | cerrar: function() {return cerrar;} |
93 | } | 93 | } |
94 | } | 94 | } |
95 | ); | 95 | ); |
96 | modalInstance.result.then(function() { | 96 | modalInstance.result.then(function() { |
97 | 97 | ||
98 | }, function() { | 98 | }, function() { |
99 | //usar cuando se cancela el modal | 99 | //usar cuando se cancela el modal |
100 | }); | 100 | }); |
101 | }; | 101 | }; |
102 | 102 | ||
103 | $scope.arrastra = function() { | 103 | $scope.arrastra = function() { |
104 | $scope.arrastrando = true; | 104 | $scope.arrastrando = true; |
105 | $scope.$digest(); | 105 | $scope.$digest(); |
106 | }; | 106 | }; |
107 | 107 | ||
108 | $scope.noArrastra = function() { | 108 | $scope.noArrastra = function() { |
109 | $scope.arrastrando = false; | 109 | $scope.arrastrando = false; |
110 | $scope.$digest(); | 110 | $scope.$digest(); |
111 | }; | 111 | }; |
112 | 112 | ||
113 | $scope.individual = function() { | 113 | $scope.individual = function() { |
114 | $scope.idVendedor = -1; | 114 | $scope.idVendedor = -1; |
115 | }; | 115 | }; |
116 | 116 | ||
117 | $scope.mostrarDetalle = function() { | 117 | $scope.mostrarDetalle = function() { |
118 | $scope.detalle = true; | 118 | $scope.detalle = true; |
119 | }; | 119 | }; |
120 | 120 | ||
121 | $scope.salir = function() { | 121 | $scope.salir = function() { |
122 | $location.path('/'); | 122 | $location.path('/'); |
123 | }; | 123 | }; |
124 | 124 | ||
125 | $scope.search = function() { | 125 | $scope.search = function() { |
126 | getSeguimiento(); | 126 | getSeguimiento(); |
127 | }; | 127 | }; |
128 | 128 | ||
129 | $scope.fecha = function() { | 129 | $scope.fecha = function() { |
130 | getSeguimiento(); | 130 | getSeguimiento(); |
131 | }; | 131 | }; |
132 | 132 | ||
133 | $scope.seleccionarVehículo = function() { | 133 | $scope.seleccionarVehículo = function() { |
134 | var parametrosModal = { | 134 | var parametrosModal = { |
135 | titulo: 'Búsqueda de Transportista', | 135 | titulo: 'Búsqueda de Transportista', |
136 | query: '/transportista', | 136 | query: '/transportista', |
137 | columnas: [ | 137 | columnas: [ |
138 | { | 138 | { |
139 | nombre: 'Código', | 139 | nombre: 'Código', |
140 | propiedad: 'COD' | 140 | propiedad: 'COD' |
141 | }, | 141 | }, |
142 | { | 142 | { |
143 | nombre: 'Nombre', | 143 | nombre: 'Nombre', |
144 | propiedad: 'NOM' | 144 | propiedad: 'NOM' |
145 | }, | 145 | }, |
146 | { | 146 | { |
147 | nombre: 'CUIT', | 147 | nombre: 'CUIT', |
148 | propiedad: 'CUIT' | 148 | propiedad: 'CUIT' |
149 | } | 149 | } |
150 | ] | 150 | ] |
151 | }; | 151 | }; |
152 | focaModalService.modal(parametrosModal).then(function(transportista) { | 152 | focaModalService.modal(parametrosModal).then(function(transportista) { |
153 | $scope.selectVehiculo(transportista.COD, transportista.NOM); | 153 | $scope.selectVehiculo(transportista.COD, transportista.NOM); |
154 | }); | 154 | }); |
155 | }; | 155 | }; |
156 | 156 | ||
157 | $scope.busquedaAvanzada = function () { | 157 | $scope.seleccionarRemito = function () { |
158 | var modalInstance = $uibModal.open( | 158 | var modalInstance = $uibModal.open( |
159 | { | 159 | { |
160 | ariaLabelledBy: 'Busqueda Avanzada', | 160 | ariaLabelledBy: 'Busqueda de Remito', |
161 | templateUrl: 'foca-modal-busqueda-avanzada.html', | 161 | templateUrl: 'foca-modal-remito.html', |
162 | controller: 'focaModalBusquedaAvanzadaController', | 162 | controller: 'focaModalRemitoController', |
163 | resolve: { | 163 | size: 'lg', |
164 | parametrosModal: function () { | 164 | resolve: { usadoPor: function () { return 'remito'; } } |
165 | return { | ||
166 | remitos: $scope.marcadores | ||
167 | }; | ||
168 | } | ||
169 | } | ||
170 | } | 165 | } |
171 | ); | 166 | ); |
172 | modalInstance.result.then(function(data) { | 167 | modalInstance.result.then(function(remito) { |
173 | actualizarMarcadores(data); | 168 | $scope.remito = remito; |
169 | $scope.remito.numero = $filter('rellenarDigitos')(remito.lugar, 4) + '-' + | ||
170 | $filter('rellenarDigitos')(remito.numeroRemito, 6); | ||
171 | $scope.cliente = remito.cliente.NOM; | ||
174 | }, function () { | 172 | }, function () { |
175 | // funcion ejecutada cuando se cancela el modal | 173 | // funcion ejecutada cuando se cancela el modal |
176 | } | 174 | } |
177 | ); | 175 | ); |
178 | }; | 176 | }; |
179 | 177 | ||
180 | $scope.selectVehiculo = function(idTransportista, nombreTransportista) { | 178 | $scope.selectVehiculo = function(idTransportista, nombreTransportista) { |
181 | var parametrosModal = { | 179 | var parametrosModal = { |
182 | columnas: [ | 180 | columnas: [ |
183 | { | 181 | { |
184 | propiedad: 'codigo', | 182 | propiedad: 'codigo', |
185 | nombre: 'Código' | 183 | nombre: 'Código' |
186 | }, | 184 | }, |
187 | { | 185 | { |
188 | propiedad: 'tractor', | 186 | propiedad: 'tractor', |
189 | nombre: 'tractor' | 187 | nombre: 'tractor' |
190 | }, | 188 | }, |
191 | { | 189 | { |
192 | propiedad: 'semi', | 190 | propiedad: 'semi', |
193 | nombre: 'Semi' | 191 | nombre: 'Semi' |
194 | }, | 192 | }, |
195 | { | 193 | { |
196 | propiedad: 'capacidadTotalCisternas', | 194 | propiedad: 'capacidadTotalCisternas', |
197 | nombre: 'Capacidad' | 195 | nombre: 'Capacidad' |
198 | } | 196 | } |
199 | ], | 197 | ], |
200 | query: '/vehiculo/transportista/' + idTransportista, | 198 | query: '/vehiculo/transportista/' + idTransportista, |
201 | titulo: 'Búsqueda de vehiculos', | 199 | titulo: 'Búsqueda de vehiculos', |
202 | subTitulo: idTransportista + '-' + nombreTransportista | 200 | subTitulo: idTransportista + '-' + nombreTransportista |
203 | }; | 201 | }; |
204 | focaModalService.modal(parametrosModal).then( | 202 | focaModalService.modal(parametrosModal).then( |
205 | function(vehiculo) { | 203 | function(vehiculo) { |
206 | var existe = $filter('filter')($scope.vehiculos, {id: vehiculo.id}); | 204 | var existe = $filter('filter')($scope.vehiculos, {id: vehiculo.id}); |
207 | if (existe.length) { | 205 | if (existe.length) { |
208 | focaModalService.alert('El vehiculo ya ha sido cargado'); | 206 | focaModalService.alert('El vehiculo ya ha sido cargado'); |
209 | return; | 207 | return; |
210 | } | 208 | } |
211 | if (!vehiculo.cisternas.length) { | 209 | if (!vehiculo.cisternas.length) { |
212 | focaModalService.alert('El vehiculo no tiene cisternas'); | 210 | focaModalService.alert('El vehiculo no tiene cisternas'); |
213 | return; | 211 | return; |
214 | } | 212 | } |
215 | $scope.vehiculos.push(vehiculo); | 213 | $scope.vehiculos.push(vehiculo); |
216 | }, function() { | 214 | }, function() { |
217 | // funcion ejecutada cuando se cancela el modal | 215 | // funcion ejecutada cuando se cancela el modal |
218 | }); | 216 | }); |
219 | }; | 217 | }; |
220 | $scope.seleccionarFechaReparto = function() { | 218 | $scope.seleccionarFechaReparto = function() { |
221 | focaModalService.modalFecha('Fecha de reparto').then(function(fecha) { | 219 | focaModalService.modalFecha('Fecha de reparto').then(function(fecha) { |
222 | setearFecha(fecha); | 220 | setearFecha(fecha); |
223 | }); | 221 | }); |
224 | }; | 222 | }; |
225 | 223 | ||
226 | function actualizarMarcadores (filtros) { | 224 | function actualizarMarcadores (filtros) { |
227 | var marcadores = []; | 225 | var marcadores = []; |
228 | if (filtros.cliente && filtros.remito === undefined) { | 226 | if (filtros.cliente && filtros.remito === undefined) { |
229 | 227 | ||
230 | $scope.marcadores.forEach( function (marcador) { | 228 | $scope.marcadores.forEach( function (marcador) { |
231 | if (marcador.notaPedido.cliente.NOM === filtros.cliente) { | 229 | if (marcador.notaPedido.cliente.NOM === filtros.cliente) { |
232 | marcadores.push(marcador); | 230 | marcadores.push(marcador); |
233 | } | 231 | } |
234 | }); | 232 | }); |
235 | 233 | ||
236 | if (marcadores.length === 0) { | 234 | if (marcadores.length === 0) { |
237 | focaModalService.alert('No se encontraron coincidencias en la busqueda') | 235 | focaModalService.alert('No se encontraron coincidencias en la busqueda') |
238 | .then(function (data) { | 236 | .then(function (data) { |
239 | if (data) { | 237 | if (data) { |
240 | $scope.marcadoresFiltro = marcadores; | 238 | $scope.marcadoresFiltro = marcadores; |
241 | } | 239 | } |
242 | }); | 240 | }); |
243 | $scope.$broadcast('cleanCabecera'); | 241 | $scope.$broadcast('cleanCabecera'); |
244 | setearFecha(new Date()); | 242 | setearFecha(new Date()); |
245 | return; | 243 | return; |
246 | } else { | 244 | } else { |
247 | $scope.marcadoresFiltro = marcadores; | 245 | $scope.marcadoresFiltro = marcadores; |
248 | $scope.$broadcast('addCabecera', { | 246 | $scope.$broadcast('addCabecera', { |
249 | label: 'Cliente:', | 247 | label: 'Cliente:', |
250 | valor: filtros.cliente | 248 | valor: filtros.cliente |
251 | }); | 249 | }); |
252 | } | 250 | } |
253 | } else { | 251 | } else { |
254 | $scope.marcadores.forEach( function (marcador) { | 252 | $scope.marcadores.forEach( function (marcador) { |
255 | if (filtros.remito.id === marcador.notaPedido.remito.id) { | 253 | if (filtros.remito.id === marcador.notaPedido.remito.id) { |
256 | marcadores.push(marcador); | 254 | marcadores.push(marcador); |
257 | } | 255 | } |
258 | }); | 256 | }); |
259 | if (marcadores.length === 0) { | 257 | if (marcadores.length === 0) { |
260 | focaModalService.alert('No se encontraron coincidencias en la busqueda') | 258 | focaModalService.alert('No se encontraron coincidencias en la busqueda') |
261 | .then(function (data) { | 259 | .then(function (data) { |
262 | if (data) { | 260 | if (data) { |
263 | $scope.marcadoresFiltro = marcadores; | 261 | $scope.marcadoresFiltro = marcadores; |
264 | } | 262 | } |
265 | }); | 263 | }); |
266 | $scope.$broadcast('cleanCabecera'); | 264 | $scope.$broadcast('cleanCabecera'); |
267 | setearFecha(new Date()); | 265 | setearFecha(new Date()); |
268 | return; | 266 | return; |
269 | } else { | 267 | } else { |
270 | $scope.marcadoresFiltro = marcadores; | 268 | $scope.marcadoresFiltro = marcadores; |
271 | $scope.$broadcast('addCabecera', { | 269 | $scope.$broadcast('addCabecera', { |
272 | label: 'Cliente:', | 270 | label: 'Cliente:', |
273 | valor: filtros.cliente | 271 | valor: filtros.cliente |
274 | }); | 272 | }); |
275 | } | 273 | } |
276 | } | 274 | } |
277 | } | 275 | } |
278 | 276 | ||
279 | function setearFecha(fecha) { | 277 | function setearFecha(fecha) { |
280 | $scope.fechaReparto = fecha; | 278 | $scope.fechaReparto = fecha; |
281 | focaLogisticaPedidoRutaService.setFechaReparto(fecha); | 279 | focaLogisticaPedidoRutaService.setFechaReparto(fecha); |
282 | focaLogisticaPedidoRutaService.getUnidadesByFecha(fecha).then(function(res){ | 280 | focaLogisticaPedidoRutaService.getUnidadesByFecha(fecha).then(function(res){ |
283 | $scope.vehiculos = res.data; | 281 | $scope.vehiculos = res.data; |
284 | $scope.$broadcast('addCabecera', { | 282 | $scope.$broadcast('addCabecera', { |
285 | label: 'Fecha:', | 283 | label: 'Fecha:', |
286 | valor: fecha.toLocaleDateString() | 284 | valor: fecha.toLocaleDateString() |
287 | }); | 285 | }); |
288 | }); | 286 | }); |
289 | } | 287 | } |
290 | 288 | ||
291 | function getSeguimiento() { | 289 | function getSeguimiento() { |
292 | var desde = new Date('1900/01/01'); | 290 | var desde = new Date('1900/01/01'); |
293 | var hasta = new Date('2099/01/01'); | 291 | var hasta = new Date('2099/01/01'); |
294 | if ($scope.fechaDesde) { | 292 | if ($scope.fechaDesde) { |
295 | var fechaDesde = $scope.fechaDesde; | 293 | var fechaDesde = $scope.fechaDesde; |
296 | desde = new Date(new Date(fechaDesde.setHours(0)).setMinutes(0)); | 294 | desde = new Date(new Date(fechaDesde.setHours(0)).setMinutes(0)); |
297 | desde = new Date(desde); | 295 | desde = new Date(desde); |
298 | } | 296 | } |
299 | if ($scope.fechaHasta) { | 297 | if ($scope.fechaHasta) { |
300 | var fechaHasta = $scope.fechaHasta; | 298 | var fechaHasta = $scope.fechaHasta; |
301 | hasta = new Date(new Date(fechaHasta.setHours(0)).setMinutes(0)); | 299 | hasta = new Date(new Date(fechaHasta.setHours(0)).setMinutes(0)); |
302 | hasta = hasta.setDate(hasta.getDate() + 1); | 300 | hasta = hasta.setDate(hasta.getDate() + 1); |
303 | hasta = new Date(hasta); | 301 | hasta = new Date(hasta); |
304 | } | 302 | } |
305 | var datos = { | 303 | var datos = { |
306 | actividad: $scope.actividad, | 304 | actividad: $scope.actividad, |
307 | idUsuario: $scope.idVendedor, | 305 | idUsuario: $scope.idVendedor, |
308 | fechaDesde: desde, | 306 | fechaDesde: desde, |
309 | fechaHasta: hasta, | 307 | fechaHasta: hasta, |
310 | asignacion: $scope.filtroEstado ? true : ($scope.filtroEstado !== undefined ? | 308 | asignacion: $scope.filtroEstado ? true : ($scope.filtroEstado !== undefined ? |
311 | false : undefined) | 309 | false : undefined) |
312 | }; | 310 | }; |
313 | 311 | ||
314 | $scope.datosBuscados = { | 312 | $scope.datosBuscados = { |
315 | actividad: $scope.actividad, | 313 | actividad: $scope.actividad, |
316 | individual: $scope.idVendedor ? true : false | 314 | individual: $scope.idVendedor ? true : false |
317 | }; | 315 | }; |
318 | 316 | ||
319 | focaLogisticaPedidoRutaService.obtenerActividad(datos).then(function(datos) { | 317 | focaLogisticaPedidoRutaService.obtenerActividad(datos).then(function(datos) { |
320 | if (!angular.equals($scope.marcadores, datos.data)) { | 318 | if (!angular.equals($scope.marcadores, datos.data)) { |
321 | $scope.marcadores = datos.data; | 319 | $scope.marcadores = datos.data; |
322 | $scope.marcadoresFiltro = $scope.marcadores; | 320 | $scope.marcadoresFiltro = $scope.marcadores; |
323 | } | 321 | } |
324 | }); | 322 | }); |
325 | } | 323 | } |
326 | 324 | ||
327 | function eliminarVehiculo(vehiculo) { | 325 | function eliminarVehiculo(vehiculo) { |
328 | focaLogisticaPedidoRutaService.getRemitosByIdVehiculo(vehiculo.id).then(function(res) { | 326 | focaLogisticaPedidoRutaService.getRemitosByIdVehiculo(vehiculo.id).then(function(res) { |
329 | if (!res.data.length) { | 327 | if (!res.data.length) { |
330 | $scope.vehiculos.splice($scope.vehiculos.indexOf(vehiculo), 1); | 328 | $scope.vehiculos.splice($scope.vehiculos.indexOf(vehiculo), 1); |
331 | } else { | 329 | } else { |
332 | focaModalService.alert('No ha sido posible eliminar el vehiculo porque ' + | 330 | focaModalService.alert('No ha sido posible eliminar el vehiculo porque ' + |
333 | 'tiene remitos asociados').then(function() { | 331 | 'tiene remitos asociados').then(function() { |
334 | $scope.hacerHojaRuta(vehiculo, true); | 332 | $scope.hacerHojaRuta(vehiculo, true); |
335 | }); | 333 | }); |
336 | } | 334 | } |
337 | }); | 335 | }); |
338 | } | 336 | } |
339 | 337 | ||
340 | function eligioFecha() { | 338 | function eligioFecha() { |
341 | if (!$scope.fechaReparto) { | 339 | if (!$scope.fechaReparto) { |
342 | focaModalService.alert('Primero seleccione fecha de reparto'); | 340 | focaModalService.alert('Primero seleccione fecha de reparto'); |
343 | return false; | 341 | return false; |
344 | } | 342 | } |
345 | return true; | 343 | return true; |
346 | } | 344 | } |
347 | 345 | ||
348 | function vehiculoEnUso(vehiculo) { | 346 | function vehiculoEnUso(vehiculo) { |
349 | var idUsuario = focaLogisticaPedidoRutaService.idUsuario; | 347 | var idUsuario = focaLogisticaPedidoRutaService.idUsuario; |
350 | for(var i = 0; i < vehiculo.cisternas.length; i++) { | 348 | for(var i = 0; i < vehiculo.cisternas.length; i++) { |
351 | for(var j = 0; j < vehiculo.cisternas[i].cisternasCarga.length; j++) { | 349 | for(var j = 0; j < vehiculo.cisternas[i].cisternasCarga.length; j++) { |
352 | var cisternaCarga = vehiculo.cisternas[i].cisternasCarga[j]; | 350 | var cisternaCarga = vehiculo.cisternas[i].cisternasCarga[j]; |
353 | if (cisternaCarga.fechaReparto.substring(0, 10) === $scope.fechaReparto | 351 | if (cisternaCarga.fechaReparto.substring(0, 10) === $scope.fechaReparto |
354 | .toISOString().substring(0, 10) && cisternaCarga.idUsuarioProceso && | 352 | .toISOString().substring(0, 10) && cisternaCarga.idUsuarioProceso && |
355 | cisternaCarga.idUsuarioProceso !== idUsuario) | 353 | cisternaCarga.idUsuarioProceso !== idUsuario) |
356 | { | 354 | { |
357 | focaModalService.alert('El vehículo está siendo usado por otro usuario'); | 355 | focaModalService.alert('El vehículo está siendo usado por otro usuario'); |
358 | return true; | 356 | return true; |
359 | } | 357 | } |
360 | } | 358 | } |
361 | } | 359 | } |
362 | return false; | 360 | return false; |
363 | } | 361 | } |
364 | // $interval(function() { | 362 | // $interval(function() { |
365 | // getSeguimiento(); | 363 | // getSeguimiento(); |
366 | // }, 5000); | 364 | // }, 5000); |
src/views/foca-logistica-pedido-ruta.html
1 | <div class="foca-logistica-pedido-ruta" id="scope"> | 1 | <div class="foca-logistica-pedido-ruta" id="scope"> |
2 | <div class="row"> | 2 | <div class="row"> |
3 | <foca-cabecera-facturador | 3 | <foca-cabecera-facturador |
4 | titulo="titulo" | 4 | titulo="titulo" |
5 | fecha="now" | 5 | fecha="now" |
6 | class="mb-0 col-lg-12" | 6 | class="mb-0 col-lg-12" |
7 | ></foca-cabecera-facturador> | 7 | ></foca-cabecera-facturador> |
8 | </div> | 8 | </div> |
9 | <div class="row px-5 py-2 botonera-secundaria position-relative"> | 9 | <div class="row px-5 py-2 botonera-secundaria position-relative"> |
10 | <div class="col-10"> | 10 | <div class="col-10"> |
11 | <foca-botonera-facturador botones="botonera" max="6" class="row"></foca-botonera-facturador> | 11 | <foca-botonera-facturador botones="botonera" max="6" class="row"></foca-botonera-facturador> |
12 | </div> | 12 | </div> |
13 | <div class="col-2 px-0 position-absolute right-0"> | 13 | <div class="col-2 px-0 position-absolute right-0"> |
14 | <strong>Ver Remitos</strong> | 14 | <strong>Ver Remitos</strong> |
15 | <br> | 15 | <br> |
16 | <span>Fecha Desde</span> | 16 | <span>Fecha Desde</span> |
17 | <input | 17 | <input |
18 | type="text" | 18 | type="text" |
19 | readonly | 19 | readonly |
20 | ng-model="fechaDesde" | 20 | ng-model="fechaDesde" |
21 | class="form-control form-control-sm" | 21 | class="form-control form-control-sm" |
22 | uib-datepicker-popup="dd/MM/yyyy" | 22 | uib-datepicker-popup="dd/MM/yyyy" |
23 | show-button-bar="false" | 23 | show-button-bar="false" |
24 | is-open="fechaDesdeOpen" | 24 | is-open="fechaDesdeOpen" |
25 | on-open-focus="false" | 25 | on-open-focus="false" |
26 | ng-focus="fechaDesdeOpen = true" | 26 | ng-focus="fechaDesdeOpen = true" |
27 | ng-change="search()" | 27 | ng-change="search()" |
28 | /> | 28 | /> |
29 | <span>Fecha Hasta</span> | 29 | <span>Fecha Hasta</span> |
30 | <input | 30 | <input |
31 | type="text" | 31 | type="text" |
32 | readonly | 32 | readonly |
33 | ng-model="fechaHasta" | 33 | ng-model="fechaHasta" |
34 | class="form-control form-control-sm" | 34 | class="form-control form-control-sm" |
35 | uib-datepicker-popup="dd/MM/yyyy" | 35 | uib-datepicker-popup="dd/MM/yyyy" |
36 | show-button-bar="false" | 36 | show-button-bar="false" |
37 | is-open="fechaHastaOpen" | 37 | is-open="fechaHastaOpen" |
38 | on-open-focus="false" | 38 | on-open-focus="false" |
39 | ng-focus="fechaHastaOpen = true" | 39 | ng-focus="fechaHastaOpen = true" |
40 | ng-change="search()" | 40 | ng-change="search()" |
41 | /> | 41 | /> |
42 | <div class="custom-control custom-radio pt-4"> | 42 | <div class="custom-control custom-radio pt-4"> |
43 | <input | 43 | <input |
44 | type="radio" | 44 | type="radio" |
45 | class="custom-control-input" | 45 | class="custom-control-input" |
46 | id="idTodos" | 46 | id="idTodos" |
47 | name="filtro" | 47 | name="filtro" |
48 | ng-model="filtroEstado" | 48 | ng-model="filtroEstado" |
49 | ng-change="search()" | 49 | ng-change="search()" |
50 | checked> | 50 | checked> |
51 | <label class="custom-control-label pb-3" for="idTodos"></label> | 51 | <label class="custom-control-label pb-3" for="idTodos"></label> |
52 | <img src="img/marker-icon-grey.png"> | 52 | <img src="img/marker-icon-grey.png"> |
53 | <strong>Todos</strong> | 53 | <strong>Todos</strong> |
54 | </div> | 54 | </div> |
55 | <div class="custom-control custom-radio"> | 55 | <div class="custom-control custom-radio"> |
56 | <input | 56 | <input |
57 | type="radio" | 57 | type="radio" |
58 | class="custom-control-input" | 58 | class="custom-control-input" |
59 | id="idSinAsignar" | 59 | id="idSinAsignar" |
60 | name="filtro" | 60 | name="filtro" |
61 | ng-model="filtroEstado" | 61 | ng-model="filtroEstado" |
62 | ng-change="search()" | 62 | ng-change="search()" |
63 | ng-value="false"> | 63 | ng-value="false"> |
64 | <label class="custom-control-label pb-3" for="idSinAsignar"></label> | 64 | <label class="custom-control-label pb-3" for="idSinAsignar"></label> |
65 | <img src="img/marker-icon-green.png"> | 65 | <img src="img/marker-icon-green.png"> |
66 | <strong>Sin asignar</strong> | 66 | <strong>Sin asignar</strong> |
67 | </div> | 67 | </div> |
68 | <div class="custom-control custom-radio"> | 68 | <div class="custom-control custom-radio"> |
69 | <input | 69 | <input |
70 | type="radio" | 70 | type="radio" |
71 | class="custom-control-input" | 71 | class="custom-control-input" |
72 | id="idAsignado" | 72 | id="idAsignado" |
73 | name="filtro" | 73 | name="filtro" |
74 | ng-model="filtroEstado" | 74 | ng-model="filtroEstado" |
75 | ng-change="search()" | 75 | ng-change="search()" |
76 | ng-value="true"> | 76 | ng-value="true"> |
77 | <label class="custom-control-label pb-3" for="idAsignado"></label> | 77 | <label class="custom-control-label pb-3" for="idAsignado"></label> |
78 | <img src="img/marker-icon-red.png"> | 78 | <img src="img/marker-icon-red.png"> |
79 | <strong>Asignado</strong> | 79 | <strong>Asignado</strong> |
80 | </div> | 80 | </div> |
81 | <div class="pt-4"> | 81 | <div class="pt-4"> |
82 | <button | 82 | <button |
83 | ladda="searchLoading" | 83 | ladda="searchLoading" |
84 | class="btn btn-outline-light" | 84 | class="btn btn-outline-secondary form-control" |
85 | type="button" | 85 | type="button" |
86 | ng-click="busquedaAvanzada()" | 86 | ng-click="seleccionarRemito()"> |
87 | > | ||
88 | <span class="text-dark text-truncate"> | 87 | <span class="text-dark text-truncate"> |
89 | Búsqueda Avanzada | 88 | Búsqueda Avanzada |
90 | <i class="fa fa-search" aria-hidden="true"></i> | 89 | <i class="fa fa-search" aria-hidden="true"></i> |
91 | </span> | 90 | </span> |
92 | </button> | 91 | </button> |
93 | </div> | 92 | </div> |
94 | </div> | 93 | </div> |
95 | </div> | 94 | </div> |
96 | <div class="row px-5"> | 95 | <div class="row px-5"> |
97 | <div class="col-10"> | 96 | <div class="col-10"> |
98 | <foca-logistica | 97 | <foca-logistica |
99 | latitud="-34.7152975" | 98 | latitud="-34.7152975" |
100 | longitud="-65.9053867" | 99 | longitud="-65.9053867" |
101 | zoom="5" | 100 | zoom="5" |
102 | marcadores="marcadoresFiltro" | 101 | marcadores="marcadoresFiltro" |
103 | parametros= "datosBuscados" | 102 | parametros= "datosBuscados" |
104 | /> | 103 | /> |
105 | </div> | 104 | </div> |
106 | <div class="col-12 p-0"> | 105 | <div class="col-12 p-0"> |
107 | <div class="py-2 row"> | 106 | <div class="py-2 row"> |
108 | <div class="col-sm-3" ng-repeat="vehiculo in vehiculos"> | 107 | <div class="col-sm-3" ng-repeat="vehiculo in vehiculos"> |
109 | <div | 108 | <div |
110 | style="width: 15rem;" | 109 | style="width: 15rem;" |
111 | class="card bg-secondary text-white m-2"> | 110 | class="card bg-secondary text-white m-2"> |
112 | <div class="card-body text-center"> | 111 | <div class="card-body text-center"> |
113 | <p class="card-text">{{vehiculo.transportista.NOM.trim()}}</p> | 112 | <p class="card-text">{{vehiculo.transportista.NOM.trim()}}</p> |
114 | <p class="card-text"></p> | 113 | <p class="card-text"></p> |
115 | <p class="card-text">{{vehiculo.codigo}}</p> | 114 | <p class="card-text">{{vehiculo.codigo}}</p> |
116 | </div> | 115 | </div> |
117 | <div class="card-footer" ng-hide="arrastrando"> | 116 | <div class="card-footer" ng-hide="arrastrando"> |
118 | <div class="row justify-content-around"> | 117 | <div class="row justify-content-around"> |
119 | <div class="col-3 ml-2"> | 118 | <div class="col-3 ml-2"> |
120 | <i | 119 | <i |
121 | class="fa fa-trash fa-lg" | 120 | class="fa fa-trash fa-lg" |
122 | uib-tooltip="Eliminar vehiculo" | 121 | uib-tooltip="Eliminar vehiculo" |
123 | ng-click="quitarVehiculo(vehiculo)"> | 122 | ng-click="quitarVehiculo(vehiculo)"> |
124 | </i> | 123 | </i> |
125 | </div> | 124 | </div> |
126 | <div class="col-3"> | 125 | <div class="col-3"> |
127 | <i | 126 | <i |
128 | class="fa fa-eye fa-lg" | 127 | class="fa fa-eye fa-lg" |
129 | uib-tooltip="Ver cisternas" | 128 | uib-tooltip="Ver cisternas" |
130 | ng-click="cargar(vehiculo.id, -1)"> | 129 | ng-click="cargar(vehiculo.id, -1)"> |
131 | </i> | 130 | </i> |
132 | </div> | 131 | </div> |
133 | <div class="col-3"> | 132 | <div class="col-3"> |
134 | <i | 133 | <i |
135 | class="fa fa-save fa-lg" | 134 | class="fa fa-save fa-lg" |
136 | uib-tooltip="Confirmar distribuición" | 135 | uib-tooltip="Confirmar distribuición" |
137 | ng-click="hacerHojaRuta(vehiculo)"> | 136 | ng-click="hacerHojaRuta(vehiculo)"> |
138 | </i> | 137 | </i> |
139 | </div> | 138 | </div> |
140 | </div> | 139 | </div> |
141 | </div> | 140 | </div> |
142 | <div class="card-footer text-center" ng-show="arrastrando"> | 141 | <div class="card-footer text-center" ng-show="arrastrando"> |
143 | <button | 142 | <button |
144 | class="btn flashit btn-block btn-dashed text-dark" | 143 | class="btn flashit btn-block btn-dashed text-dark" |
145 | id="{{vehiculo.id}}" | 144 | id="{{vehiculo.id}}" |
146 | ondrop="drop(event)" | 145 | ondrop="drop(event)" |
147 | ondragover="allowDrop(event)"> | 146 | ondragover="allowDrop(event)"> |
148 | Arrastrar aquí | 147 | Arrastrar aquí |
149 | </button> | 148 | </button> |
150 | </div> | 149 | </div> |
151 | </div> | 150 | </div> |
152 | </div> | 151 | </div> |
153 | </div> | 152 | </div> |
154 | </div> | 153 | </div> |
155 | </div> | 154 | </div> |
156 | </div> | 155 | </div> |
157 | 156 |
src/views/foca-modal-busqueda-avanzada.html
1 | <div class="modal-header"> | 1 | <div class="modal-header"> |
2 | <div class="row"> | 2 | <div class="row"> |
3 | <div class="col-12"> | 3 | <div class="col-12"> |
4 | <h5>Búsqueda avanzada:</h5> | 4 | <h5>Búsqueda avanzada:</h5> |
5 | <button | ||
6 | ladda="searchLoading" | ||
7 | class="btn btn-outline-secondary form-control" | ||
8 | type="button" | ||
9 | ng-click="seleccionarRemito()"> | ||
10 | <i class="fa fa-search" aria-hidden="true"></i> | ||
11 | </button> | ||
5 | </div> | 12 | </div> |
6 | </div> | 13 | </div> |
7 | </div> | 14 | </div> |
8 | <div class="modal-body"> | 15 | <div class="modal-body"> --> |
9 | <div class="row"> | 16 | <div class="row"> |
10 | <div class="col-12"> | 17 | <div class="col-12"> |
11 | <h6>Remitos del cliente:</h6> | 18 | <h6>Remitos del cliente:</h6> |
12 | </div> | 19 | </div> |
13 | <div class="col-12"> | 20 | <div class="col-12"> |
14 | <div class="input-group"> | 21 | <div class="input-group"> |
15 | <input | 22 | <input |
16 | class="form-control" | 23 | class="form-control" |
17 | ng-model="cliente" | 24 | ng-model="cliente" |
18 | ng-keypress="seleccionarCliente($event.keyCode)" | 25 | ng-keypress="seleccionarCliente($event.keyCode)" |
19 | placeholder="Ingrese un cliente" | 26 | placeholder="Ingrese un cliente" |
20 | /> | 27 | /> |
21 | <button | 28 | <button |
22 | ng-show="cliente !== ''" | 29 | ng-show="cliente !== ''" |
23 | type="button" | 30 | type="button" |
24 | class="clear-input" | 31 | class="clear-input" |
25 | ng-click="cliente = '';" | 32 | ng-click="cliente = '';" |
26 | ><i class="fa fa-times"></i> | 33 | ><i class="fa fa-times"></i> |
27 | </button> | 34 | </button> |
28 | <div class="input-group-append"> | 35 | <div class="input-group-append"> |
29 | <button | 36 | <button |
30 | ladda="searchLoading" | 37 | ladda="searchLoading" |
31 | class="btn btn-outline-secondary form-control" | 38 | class="btn btn-outline-secondary form-control" |
32 | type="button" | 39 | type="button" |
33 | ng-click="seleccionarCliente(13)"> | 40 | ng-click="seleccionarCliente()"> |
34 | <i class="fa fa-search" aria-hidden="true"></i> | 41 | <i class="fa fa-search" aria-hidden="true"></i> |
35 | </button> | 42 | </button> |
36 | </div> | 43 | </div> |
37 | </div> | 44 | </div> |
38 | </div> | 45 | </div> |
39 | </div> | 46 | </div> |
40 | <div class="row pt-3"> | 47 | <div class="row pt-3"> |
41 | <div class="col-12"> | 48 | <div class="col-12"> |
42 | <h6>Remito Nº</h6> | 49 | <h6>Remito Nº</h6> |
43 | </div> | 50 | </div> |
44 | <div class="col-12"> | 51 | <div class="col-12"> |
45 | <div class="input-group"> | 52 | <div class="input-group"> |
46 | <input | 53 | <input |
47 | class="form-control" | 54 | class="form-control" |
48 | ng-model="remito.numero" | 55 | ng-model="remito.numero" |
49 | ng-click="seleccionarRemito()" | 56 | ng-click="seleccionarRemito()" |
50 | readonly/> | 57 | readonly/> |
51 | <div class="input-group-append"> | 58 | <div class="input-group-append"> |
52 | <button | 59 | <button |
53 | ladda="searchLoading" | 60 | ladda="searchLoading" |
54 | class="btn btn-outline-secondary form-control" | 61 | class="btn btn-outline-secondary form-control" |
55 | type="button" | 62 | type="button" |
56 | ng-click="seleccionarRemito()"> | 63 | ng-click="seleccionarRemito()"> |
57 | <i class="fa fa-search" aria-hidden="true"></i> | 64 | <i class="fa fa-search" aria-hidden="true"></i> |
58 | </button> | 65 | </button> |
59 | </div> | 66 | </div> |
60 | </div> | 67 | </div> |
61 | </div> | 68 | </div> |
62 | </div> | 69 | </div> |
63 | </div> | 70 | </div> |
64 | <div class="modal-footer py-1"> | 71 | <div class="modal-footer py-1"> |
65 | <button | 72 | <button |
66 | class="btn btn-sm btn-secondary" | 73 | class="btn btn-sm btn-secondary" |
67 | type="button" | 74 | type="button" |
68 | data-dismiss="modal" | 75 | data-dismiss="modal" |
69 | ng-click="cancel()">Cancelar | 76 | ng-click="cancel()">Cancelar |
70 | </button> | 77 | </button> |
71 | <button | 78 | <button |
72 | class="btn btn-sm btn-primary" | 79 | class="btn btn-sm btn-primary" |
73 | type="button" | 80 | type="button" |
74 | ng-click="buscar()">Buscar | 81 | ng-click="buscar()">Buscar |
75 | </button> | 82 | </button> |
76 | </div> | 83 | </div> |
77 | 84 |