Commit aaecbd022e08c0a856bf45f674947332a479d735
1 parent
4aa8f26e93
Exists in
master
Mejora logistica de pedidos
Showing
5 changed files
with
256 additions
and
10 deletions
Show diff stats
src/js/controller.js
| ... | ... | @@ -154,6 +154,29 @@ angular.module('focaLogisticaPedidoRuta') .controller('focaLogisticaPedidoRutaCo |
| 154 | 154 | }); |
| 155 | 155 | }; |
| 156 | 156 | |
| 157 | + $scope.busquedaAvanzada = function () { | |
| 158 | + var modalInstance = $uibModal.open( | |
| 159 | + { | |
| 160 | + ariaLabelledBy: 'Busqueda Avanzada', | |
| 161 | + templateUrl: 'foca-modal-busqueda-avanzada.html', | |
| 162 | + controller: 'focaModalBusquedaAvanzadaController', | |
| 163 | + resolve: { | |
| 164 | + parametrosModal: function () { | |
| 165 | + return { | |
| 166 | + remitos: $scope.marcadores | |
| 167 | + }; | |
| 168 | + } | |
| 169 | + } | |
| 170 | + } | |
| 171 | + ); | |
| 172 | + modalInstance.result.then(function(data) { | |
| 173 | + actualizarMarcadores(data); | |
| 174 | + }, function () { | |
| 175 | + // funcion ejecutada cuando se cancela el modal | |
| 176 | + } | |
| 177 | + ); | |
| 178 | + }; | |
| 179 | + | |
| 157 | 180 | $scope.selectVehiculo = function(idTransportista, nombreTransportista) { |
| 158 | 181 | var parametrosModal = { |
| 159 | 182 | columnas: [ |
| ... | ... | @@ -194,13 +217,65 @@ angular.module('focaLogisticaPedidoRuta') .controller('focaLogisticaPedidoRutaCo |
| 194 | 217 | // funcion ejecutada cuando se cancela el modal |
| 195 | 218 | }); |
| 196 | 219 | }; |
| 197 | - | |
| 198 | 220 | $scope.seleccionarFechaReparto = function() { |
| 199 | 221 | focaModalService.modalFecha('Fecha de reparto').then(function(fecha) { |
| 200 | 222 | setearFecha(fecha); |
| 201 | 223 | }); |
| 202 | 224 | }; |
| 203 | 225 | |
| 226 | + function actualizarMarcadores (filtros) { | |
| 227 | + var marcadores = []; | |
| 228 | + if (filtros.cliente && filtros.remito === undefined) { | |
| 229 | + | |
| 230 | + $scope.marcadores.forEach( function (marcador) { | |
| 231 | + if (marcador.notaPedido.cliente.NOM === filtros.cliente) { | |
| 232 | + marcadores.push(marcador); | |
| 233 | + } | |
| 234 | + }); | |
| 235 | + | |
| 236 | + if (marcadores.length === 0) { | |
| 237 | + focaModalService.alert('No se encontraron coincidencias en la busqueda') | |
| 238 | + .then(function (data) { | |
| 239 | + if (data) { | |
| 240 | + $scope.marcadoresFiltro = marcadores; | |
| 241 | + } | |
| 242 | + }); | |
| 243 | + $scope.$broadcast('cleanCabecera'); | |
| 244 | + setearFecha(new Date()); | |
| 245 | + return; | |
| 246 | + } else { | |
| 247 | + $scope.marcadoresFiltro = marcadores; | |
| 248 | + $scope.$broadcast('addCabecera', { | |
| 249 | + label: 'Cliente:', | |
| 250 | + valor: filtros.cliente | |
| 251 | + }); | |
| 252 | + } | |
| 253 | + } else { | |
| 254 | + $scope.marcadores.forEach( function (marcador) { | |
| 255 | + if (filtros.remito.id === marcador.notaPedido.remito.id) { | |
| 256 | + marcadores.push(marcador); | |
| 257 | + } | |
| 258 | + }); | |
| 259 | + if (marcadores.length === 0) { | |
| 260 | + focaModalService.alert('No se encontraron coincidencias en la busqueda') | |
| 261 | + .then(function (data) { | |
| 262 | + if (data) { | |
| 263 | + $scope.marcadoresFiltro = marcadores; | |
| 264 | + } | |
| 265 | + }); | |
| 266 | + $scope.$broadcast('cleanCabecera'); | |
| 267 | + setearFecha(new Date()); | |
| 268 | + return; | |
| 269 | + } else { | |
| 270 | + $scope.marcadoresFiltro = marcadores; | |
| 271 | + $scope.$broadcast('addCabecera', { | |
| 272 | + label: 'Cliente:', | |
| 273 | + valor: filtros.cliente | |
| 274 | + }); | |
| 275 | + } | |
| 276 | + } | |
| 277 | + } | |
| 278 | + | |
| 204 | 279 | function setearFecha(fecha) { |
| 205 | 280 | $scope.fechaReparto = fecha; |
| 206 | 281 | focaLogisticaPedidoRutaService.setFechaReparto(fecha); |
| ... | ... | @@ -242,8 +317,9 @@ angular.module('focaLogisticaPedidoRuta') .controller('focaLogisticaPedidoRutaCo |
| 242 | 317 | }; |
| 243 | 318 | |
| 244 | 319 | focaLogisticaPedidoRutaService.obtenerActividad(datos).then(function(datos) { |
| 245 | - if (JSON.stringify(datos.data) !== JSON.stringify($scope.marcadores)) { | |
| 320 | + if (!angular.equals($scope.marcadores, datos.data)) { | |
| 246 | 321 | $scope.marcadores = datos.data; |
| 322 | + $scope.marcadoresFiltro = $scope.marcadores; | |
| 247 | 323 | } |
| 248 | 324 | }); |
| 249 | 325 | } |
| ... | ... | @@ -285,8 +361,8 @@ angular.module('focaLogisticaPedidoRuta') .controller('focaLogisticaPedidoRutaCo |
| 285 | 361 | } |
| 286 | 362 | return false; |
| 287 | 363 | } |
| 288 | - $interval(function() { | |
| 289 | - getSeguimiento(); | |
| 290 | - }, 5000); | |
| 364 | + // $interval(function() { | |
| 365 | + // getSeguimiento(); | |
| 366 | + // }, 5000); | |
| 291 | 367 | } |
| 292 | 368 | ]); |
src/js/controllerBusquedaAvanzada.js
| ... | ... | @@ -0,0 +1,75 @@ |
| 1 | +angular.module('focaLogisticaPedidoRuta') .controller('focaModalBusquedaAvanzadaController', [ | |
| 2 | + '$scope', 'focaLogisticaPedidoRutaService', '$uibModal', '$filter', | |
| 3 | + 'focaModalService', '$uibModalInstance', 'parametrosModal', | |
| 4 | + function($scope, focaLogisticaPedidoRutaService, $uibModal, $filter, | |
| 5 | + focaModalService, $uibModalInstance, parametrosModal | |
| 6 | + ) { | |
| 7 | + $scope.cliente = ''; | |
| 8 | + $scope.seleccionarCliente = function (key) { | |
| 9 | + if (key !== 13) { | |
| 10 | + return; | |
| 11 | + } | |
| 12 | + focaModalService.modal({ | |
| 13 | + titulo: 'Clientes', | |
| 14 | + searchText: $scope.cliente, | |
| 15 | + query: '/cliente', | |
| 16 | + size: 'md', | |
| 17 | + columnas: [ | |
| 18 | + { | |
| 19 | + propiedad: 'COD', | |
| 20 | + nombre: 'Codigo' | |
| 21 | + }, | |
| 22 | + { | |
| 23 | + propiedad: 'NOM', | |
| 24 | + nombre: 'Nombre' | |
| 25 | + }, | |
| 26 | + { | |
| 27 | + propiedad: 'CUIT', | |
| 28 | + nombre: 'CUIT' | |
| 29 | + } | |
| 30 | + ], | |
| 31 | + }).then(function (res) { | |
| 32 | + $scope.cliente = res.NOM; | |
| 33 | + }).catch(function (e) { | |
| 34 | + console.log(e); | |
| 35 | + }); | |
| 36 | + }; | |
| 37 | + | |
| 38 | + $scope.seleccionarRemito = function () { | |
| 39 | + var modalInstance = $uibModal.open( | |
| 40 | + { | |
| 41 | + ariaLabelledBy: 'Busqueda de Remito', | |
| 42 | + templateUrl: 'foca-modal-remito.html', | |
| 43 | + controller: 'focaModalRemitoController', | |
| 44 | + size: 'lg', | |
| 45 | + resolve: { usadoPor: function () { return 'remito'; } } | |
| 46 | + } | |
| 47 | + ); | |
| 48 | + modalInstance.result.then(function(remito) { | |
| 49 | + $scope.remito = remito; | |
| 50 | + $scope.remito.numero = $filter('rellenarDigitos')(remito.lugar, 4) + '-' + | |
| 51 | + $filter('rellenarDigitos')(remito.numeroRemito, 6); | |
| 52 | + $scope.cliente = remito.cliente.NOM; | |
| 53 | + }, function () { | |
| 54 | + // funcion ejecutada cuando se cancela el modal | |
| 55 | + } | |
| 56 | + ); | |
| 57 | + }; | |
| 58 | + | |
| 59 | + $scope.cancel = function () { | |
| 60 | + $uibModalInstance.dismiss('close'); | |
| 61 | + }; | |
| 62 | + | |
| 63 | + $scope.buscar = function () { | |
| 64 | + $uibModalInstance.close(datos()); | |
| 65 | + }; | |
| 66 | + | |
| 67 | + function datos () { | |
| 68 | + var datos = { | |
| 69 | + cliente: $scope.cliente, | |
| 70 | + remito: $scope.remito | |
| 71 | + }; | |
| 72 | + return datos; | |
| 73 | + } | |
| 74 | + } | |
| 75 | +]); |
src/js/service.js
| ... | ... | @@ -21,6 +21,12 @@ angular.module('focaLogisticaPedidoRuta') |
| 21 | 21 | cerrarDistribuicion: function(remitos) { |
| 22 | 22 | return $http.post(url + '/vehiculo/cierre-distribuicion', remitos); |
| 23 | 23 | }, |
| 24 | + getArticulos: function () { | |
| 25 | + return $http.get(url + '/articulos'); | |
| 26 | + }, | |
| 27 | + getAllClientes: function () { | |
| 28 | + return $http.get(url + '/cliente'); | |
| 29 | + }, | |
| 24 | 30 | desasociarRemitos: function(remitos, idVehiculo, sinRemitos) { |
| 25 | 31 | var idsRemitos = []; |
| 26 | 32 | for (var i = 0; i < remitos.length; i++) { |
src/views/foca-logistica-pedido-ruta.html
| ... | ... | @@ -10,7 +10,7 @@ |
| 10 | 10 | <div class="col-10"> |
| 11 | 11 | <foca-botonera-facturador botones="botonera" max="6" class="row"></foca-botonera-facturador> |
| 12 | 12 | </div> |
| 13 | - <div class="col-2 pl-0 position-absolute right-0"> | |
| 13 | + <div class="col-2 px-0 position-absolute right-0"> | |
| 14 | 14 | <strong>Ver Remitos</strong> |
| 15 | 15 | <br> |
| 16 | 16 | <span>Fecha Desde</span> |
| ... | ... | @@ -78,6 +78,19 @@ |
| 78 | 78 | <img src="img/marker-icon-red.png"> |
| 79 | 79 | <strong>Asignado</strong> |
| 80 | 80 | </div> |
| 81 | + <div class="pt-4"> | |
| 82 | + <button | |
| 83 | + ladda="searchLoading" | |
| 84 | + class="btn btn-outline-light" | |
| 85 | + type="button" | |
| 86 | + ng-click="busquedaAvanzada()" | |
| 87 | + > | |
| 88 | + <span class="text-dark text-truncate"> | |
| 89 | + Búsqueda Avanzada | |
| 90 | + <i class="fa fa-search" aria-hidden="true"></i> | |
| 91 | + </span> | |
| 92 | + </button> | |
| 93 | + </div> | |
| 81 | 94 | </div> |
| 82 | 95 | </div> |
| 83 | 96 | <div class="row px-5"> |
| ... | ... | @@ -86,7 +99,7 @@ |
| 86 | 99 | latitud="-34.7152975" |
| 87 | 100 | longitud="-65.9053867" |
| 88 | 101 | zoom="5" |
| 89 | - marcadores="marcadores" | |
| 102 | + marcadores="marcadoresFiltro" | |
| 90 | 103 | parametros= "datosBuscados" |
| 91 | 104 | /> |
| 92 | 105 | </div> |
| ... | ... | @@ -105,21 +118,21 @@ |
| 105 | 118 | <div class="row justify-content-around"> |
| 106 | 119 | <div class="col-3 ml-2"> |
| 107 | 120 | <i |
| 108 | - class="fa fa-trash fa-2x" | |
| 121 | + class="fa fa-trash fa-lg" | |
| 109 | 122 | uib-tooltip="Eliminar vehiculo" |
| 110 | 123 | ng-click="quitarVehiculo(vehiculo)"> |
| 111 | 124 | </i> |
| 112 | 125 | </div> |
| 113 | 126 | <div class="col-3"> |
| 114 | 127 | <i |
| 115 | - class="fa fa-eye fa-2x" | |
| 128 | + class="fa fa-eye fa-lg" | |
| 116 | 129 | uib-tooltip="Ver cisternas" |
| 117 | 130 | ng-click="cargar(vehiculo.id, -1)"> |
| 118 | 131 | </i> |
| 119 | 132 | </div> |
| 120 | 133 | <div class="col-3"> |
| 121 | 134 | <i |
| 122 | - class="fa fa-save fa-2x" | |
| 135 | + class="fa fa-save fa-lg" | |
| 123 | 136 | uib-tooltip="Confirmar distribuición" |
| 124 | 137 | ng-click="hacerHojaRuta(vehiculo)"> |
| 125 | 138 | </i> |
src/views/foca-modal-busqueda-avanzada.html
| ... | ... | @@ -0,0 +1,76 @@ |
| 1 | +<div class="modal-header"> | |
| 2 | + <div class="row"> | |
| 3 | + <div class="col-12"> | |
| 4 | + <h5>Búsqueda avanzada:</h5> | |
| 5 | + </div> | |
| 6 | + </div> | |
| 7 | +</div> | |
| 8 | +<div class="modal-body"> | |
| 9 | + <div class="row"> | |
| 10 | + <div class="col-12"> | |
| 11 | + <h6>Remitos del cliente:</h6> | |
| 12 | + </div> | |
| 13 | + <div class="col-12"> | |
| 14 | + <div class="input-group"> | |
| 15 | + <input | |
| 16 | + class="form-control" | |
| 17 | + ng-model="cliente" | |
| 18 | + ng-keypress="seleccionarCliente($event.keyCode)" | |
| 19 | + placeholder="Ingrese un cliente" | |
| 20 | + /> | |
| 21 | + <button | |
| 22 | + ng-show="cliente !== ''" | |
| 23 | + type="button" | |
| 24 | + class="clear-input" | |
| 25 | + ng-click="cliente = '';" | |
| 26 | + ><i class="fa fa-times"></i> | |
| 27 | + </button> | |
| 28 | + <div class="input-group-append"> | |
| 29 | + <button | |
| 30 | + ladda="searchLoading" | |
| 31 | + class="btn btn-outline-secondary form-control" | |
| 32 | + type="button" | |
| 33 | + ng-click="seleccionarCliente(13)"> | |
| 34 | + <i class="fa fa-search" aria-hidden="true"></i> | |
| 35 | + </button> | |
| 36 | + </div> | |
| 37 | + </div> | |
| 38 | + </div> | |
| 39 | + </div> | |
| 40 | + <div class="row pt-3"> | |
| 41 | + <div class="col-12"> | |
| 42 | + <h6>Remito Nº</h6> | |
| 43 | + </div> | |
| 44 | + <div class="col-12"> | |
| 45 | + <div class="input-group"> | |
| 46 | + <input | |
| 47 | + class="form-control" | |
| 48 | + ng-model="remito.numero" | |
| 49 | + ng-click="seleccionarRemito()" | |
| 50 | + readonly/> | |
| 51 | + <div class="input-group-append"> | |
| 52 | + <button | |
| 53 | + ladda="searchLoading" | |
| 54 | + class="btn btn-outline-secondary form-control" | |
| 55 | + type="button" | |
| 56 | + ng-click="seleccionarRemito()"> | |
| 57 | + <i class="fa fa-search" aria-hidden="true"></i> | |
| 58 | + </button> | |
| 59 | + </div> | |
| 60 | + </div> | |
| 61 | + </div> | |
| 62 | + </div> | |
| 63 | +</div> | |
| 64 | +<div class="modal-footer py-1"> | |
| 65 | + <button | |
| 66 | + class="btn btn-sm btn-secondary" | |
| 67 | + type="button" | |
| 68 | + data-dismiss="modal" | |
| 69 | + ng-click="cancel()">Cancelar | |
| 70 | + </button> | |
| 71 | + <button | |
| 72 | + class="btn btn-sm btn-primary" | |
| 73 | + type="button" | |
| 74 | + ng-click="buscar()">Buscar | |
| 75 | + </button> | |
| 76 | +</div> | |
| 0 | 77 | \ No newline at end of file |