Commit 356f488379d16aafb2b1a81cb3cd13884bf7ac01

Authored by Benjamin Rodriguez
Exists in master and in 2 other branches develop, lab

Merge remote-tracking branch 'upstream/develop'

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/osm-directive.js
... ... @@ -86,11 +86,11 @@ angular.module('focaLogisticaPedidoRuta').directive('focaLogistica', function()
86 86 });
87 87 } else {
88 88 observacion += '<br/>';
89   - observacion += '<i class="fa fa-map-marker fa-3x" aria-hidden="true"'+
  89 + observacion += '<i class="fa fa-map-marker marcador fa-4x" aria-hidden="true"'+
90 90 'class="form-control" ondragend="dropEnd()" ondragstart=\'drag(event, '+
91   - JSON.stringify(marcador)+')\' draggable="true"></i>(Arrastrar icono)';
  91 + JSON.stringify(marcador)+')\' draggable="true"></i><br><b>(Arrastrar icono)</b>';
92 92 observacion += '<button title="Ver productos" class="btn btn-secondary' +
93   - ' float-right mt-2"'+
  93 + ' float-right informacion"'+
94 94 'ng-click="verProductos('+marcador.notaPedido.remito.id+')">' +
95 95 '<i class="fa fa-info" aria-hidden="true"></i>' +
96 96 '</button>';
... ... @@ -107,7 +107,7 @@ angular.module(&#39;focaLogisticaPedidoRuta&#39;).directive(&#39;focaLogistica&#39;, function()
107 107 }
108 108  
109 109 //COMPILO HTML PARA QUE FUNCIONE BOTON EN POPUP
110   - observacion = '<div>' + observacion + '</div>';
  110 + observacion = '<div class="disable-selection">' + observacion + '</div>';
111 111 var compiledHtml = $compile(angular.element(observacion))($scope);
112 112  
113 113 $scope.markers.push(
src/views/foca-logistica-pedido-ruta.html
... ... @@ -10,8 +10,8 @@
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">
14   - <strong>Filtros: </strong>
  13 + <div class="col-2 px-0 position-absolute right-0">
  14 + <strong>Ver Remitos</strong>
15 15 <br>
16 16 <span>Fecha Desde</span>
17 17 <input
... ... @@ -39,7 +39,7 @@
39 39 ng-focus="fechaHastaOpen = true"
40 40 ng-change="search()"
41 41 />
42   - <div class="custom-control custom-radio">
  42 + <div class="custom-control custom-radio pt-4">
43 43 <input
44 44 type="radio"
45 45 class="custom-control-input"
... ... @@ -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,69 +99,56 @@
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>
93   - <div class="row">
94   - <div
95   - class="container col-auto"
96   - ng-repeat="vehiculo in vehiculos"
97   - ng-click="mostrarDetalleVehiculo(vehiculo)"
98   - >
99   - <div>
100   - <div class="col-md-3 col-sm-6">
101   - <div class="progress-circle" ng-class="{'arrastrando': arrastrando}">
102   - <span class="progress-left">
103   - <span class="progress-bar"></span>
104   - </span>
105   - <span class="progress-right">
106   - <span class="progress-bar"></span>
107   - </span>
108   - <div class="progress-value py-4 px-3 d-flex align-content-between flex-wrap">
109   - <small class="w-100">
110   - <small>
111   - <small>
112   - {{vehiculo.transportista.NOM.trim()}}
113   - </small>
114   - </small>
115   - </small>
116   - <small class="w-100">
117   - {{vehiculo.codigo}}
118   - </small>
119   - </div>
  106 + <div class="col-12 p-0">
  107 + <div class="py-2 row">
  108 + <div class="col-sm-3" ng-repeat="vehiculo in vehiculos">
  109 + <div
  110 + style="width: 15rem;"
  111 + class="card bg-secondary text-white m-2">
  112 + <div class="card-body text-center">
  113 + <p class="card-text">{{vehiculo.transportista.NOM.trim()}}</p>
  114 + <p class="card-text"></p>
  115 + <p class="card-text">{{vehiculo.codigo}}</p>
120 116 </div>
121   - </div>
122   - <div class="row ml-2">
123   - <div class="col-3 position-absolute">
124   - <img
125   - src="img/hojaRutaVolante.png"
126   - width="100%">
127   - </div>
128   - <div class="col-3"
129   - uib-tooltip="Confirmar distribuición"
130   - ng-click="hacerHojaRuta(vehiculo)"></div>
131   - <div class="col-3">
132   - <i
133   - class="fa fa-eye fa-2x"
134   - uib-tooltip="Ver cisternas"
135   - ng-click="cargar(vehiculo.id, -1)">
136   - </i>
  117 + <div class="card-footer" ng-hide="arrastrando">
  118 + <div class="row justify-content-around">
  119 + <div class="col-3 ml-2">
  120 + <i
  121 + class="fa fa-trash fa-lg"
  122 + uib-tooltip="Eliminar vehiculo"
  123 + ng-click="quitarVehiculo(vehiculo)">
  124 + </i>
  125 + </div>
  126 + <div class="col-3">
  127 + <i
  128 + class="fa fa-eye fa-lg"
  129 + uib-tooltip="Ver cisternas"
  130 + ng-click="cargar(vehiculo.id, -1)">
  131 + </i>
  132 + </div>
  133 + <div class="col-3">
  134 + <i
  135 + class="fa fa-save fa-lg"
  136 + uib-tooltip="Confirmar distribuición"
  137 + ng-click="hacerHojaRuta(vehiculo)">
  138 + </i>
  139 + </div>
  140 + </div>
137 141 </div>
138   - <div class="col-3 ml-2">
139   - <i
140   - class="fa fa-trash fa-2x"
141   - uib-tooltip="Eliminar vehiculo"
142   - ng-click="quitarVehiculo(vehiculo)"></i>
  142 + <div class="card-footer text-center" ng-show="arrastrando">
  143 + <button
  144 + class="btn flashit btn-block btn-dashed text-dark"
  145 + id="{{vehiculo.id}}"
  146 + ondrop="drop(event)"
  147 + ondragover="allowDrop(event)">
  148 + Arrastrar aquí
  149 + </button>
143 150 </div>
144 151 </div>
145   - <div
146   - class="ml-1 border border-dark text-center w-100"
147   - ng-show="arrastrando"
148   - id="{{vehiculo.id}}"
149   - ondrop="drop(event)"
150   - ondragover="allowDrop(event)"
151   - >Soltar acá</div>
152 152 </div>
153 153 </div>
154 154 </div>
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>