Commit 170aba00647a8644303a300d3938c5f7c0ba5713

Authored by Mauricio Cattafi
Exists in develop

Merge branch 'develop' into 'master'

Develop

See merge request !54
... ... @@ -4,6 +4,7 @@
4 4 "description": "Logistica de pedidos",
5 5 "main": "index.js",
6 6 "scripts": {
  7 + "refresh": "gulp uglify && cp tmp/foca-logistica-pedido-ruta.js ../wrapper-demo/node_modules/foca-logistica-pedido-ruta/dist/foca-logistica-pedido-ruta.min.js",
7 8 "test": "echo \"Error: no test specified\" && exit 1",
8 9 "compile": "gulp uglify",
9 10 "gulp-pre-commit": "gulp pre-commit",
src/js/controller.js
... ... @@ -154,6 +154,27 @@ angular.module('focaLogisticaPedidoRuta') .controller('focaLogisticaPedidoRutaCo
154 154 });
155 155 };
156 156  
  157 + $scope.seleccionarRemito = function () {
  158 + var modalInstance = $uibModal.open(
  159 + {
  160 + ariaLabelledBy: 'Busqueda de Remito',
  161 + templateUrl: 'foca-modal-remito.html',
  162 + controller: 'focaModalRemitoController',
  163 + size: 'lg',
  164 + resolve: { usadoPor: function () { return 'remito'; } }
  165 + }
  166 + );
  167 + modalInstance.result.then(function(remito) {
  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;
  172 + }, function () {
  173 + // funcion ejecutada cuando se cancela el modal
  174 + }
  175 + );
  176 + };
  177 +
157 178 $scope.selectVehiculo = function(idTransportista, nombreTransportista) {
158 179 var parametrosModal = {
159 180 columnas: [
... ... @@ -194,13 +215,65 @@ angular.module('focaLogisticaPedidoRuta') .controller('focaLogisticaPedidoRutaCo
194 215 // funcion ejecutada cuando se cancela el modal
195 216 });
196 217 };
197   -
198 218 $scope.seleccionarFechaReparto = function() {
199 219 focaModalService.modalFecha('Fecha de reparto').then(function(fecha) {
200 220 setearFecha(fecha);
201 221 });
202 222 };
203 223  
  224 + function actualizarMarcadores (filtros) {
  225 + var marcadores = [];
  226 + if (filtros.cliente && filtros.remito === undefined) {
  227 +
  228 + $scope.marcadores.forEach( function (marcador) {
  229 + if (marcador.notaPedido.cliente.NOM === filtros.cliente) {
  230 + marcadores.push(marcador);
  231 + }
  232 + });
  233 +
  234 + if (marcadores.length === 0) {
  235 + focaModalService.alert('No se encontraron coincidencias en la busqueda')
  236 + .then(function (data) {
  237 + if (data) {
  238 + $scope.marcadoresFiltro = marcadores;
  239 + }
  240 + });
  241 + $scope.$broadcast('cleanCabecera');
  242 + setearFecha(new Date());
  243 + return;
  244 + } else {
  245 + $scope.marcadoresFiltro = marcadores;
  246 + $scope.$broadcast('addCabecera', {
  247 + label: 'Cliente:',
  248 + valor: filtros.cliente
  249 + });
  250 + }
  251 + } else {
  252 + $scope.marcadores.forEach( function (marcador) {
  253 + if (filtros.remito.id === marcador.notaPedido.remito.id) {
  254 + marcadores.push(marcador);
  255 + }
  256 + });
  257 + if (marcadores.length === 0) {
  258 + focaModalService.alert('No se encontraron coincidencias en la busqueda')
  259 + .then(function (data) {
  260 + if (data) {
  261 + $scope.marcadoresFiltro = marcadores;
  262 + }
  263 + });
  264 + $scope.$broadcast('cleanCabecera');
  265 + setearFecha(new Date());
  266 + return;
  267 + } else {
  268 + $scope.marcadoresFiltro = marcadores;
  269 + $scope.$broadcast('addCabecera', {
  270 + label: 'Cliente:',
  271 + valor: filtros.cliente
  272 + });
  273 + }
  274 + }
  275 + }
  276 +
204 277 function setearFecha(fecha) {
205 278 $scope.fechaReparto = fecha;
206 279 focaLogisticaPedidoRutaService.setFechaReparto(fecha);
... ... @@ -242,8 +315,9 @@ angular.module('focaLogisticaPedidoRuta') .controller('focaLogisticaPedidoRutaCo
242 315 };
243 316  
244 317 focaLogisticaPedidoRutaService.obtenerActividad(datos).then(function(datos) {
245   - if (JSON.stringify(datos.data) !== JSON.stringify($scope.marcadores)) {
  318 + if (!angular.equals($scope.marcadores, datos.data)) {
246 319 $scope.marcadores = datos.data;
  320 + $scope.marcadoresFiltro = $scope.marcadores;
247 321 }
248 322 });
249 323 }
... ... @@ -285,8 +359,8 @@ angular.module('focaLogisticaPedidoRuta') .controller('focaLogisticaPedidoRutaCo
285 359 }
286 360 return false;
287 361 }
288   - $interval(function() {
289   - getSeguimiento();
290   - }, 5000);
  362 + // $interval(function() {
  363 + // getSeguimiento();
  364 + // }, 5000);
291 365 }
292 366 ]);
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,18 @@
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-secondary form-control"
  85 + type="button"
  86 + ng-click="seleccionarRemito()">
  87 + <span class="text-dark text-truncate">
  88 + Búsqueda Avanzada
  89 + <i class="fa fa-search" aria-hidden="true"></i>
  90 + </span>
  91 + </button>
  92 + </div>
81 93 </div>
82 94 </div>
83 95 <div class="row px-5">
... ... @@ -86,69 +98,56 @@
86 98 latitud="-34.7152975"
87 99 longitud="-65.9053867"
88 100 zoom="5"
89   - marcadores="marcadores"
  101 + marcadores="marcadoresFiltro"
90 102 parametros= "datosBuscados"
91 103 />
92 104 </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>
  105 + <div class="col-12 p-0">
  106 + <div class="py-2 row">
  107 + <div class="col-sm-3" ng-repeat="vehiculo in vehiculos">
  108 + <div
  109 + style="width: 15rem;"
  110 + class="card bg-secondary text-white m-2">
  111 + <div class="card-body text-center">
  112 + <p class="card-text">{{vehiculo.transportista.NOM.trim()}}</p>
  113 + <p class="card-text"></p>
  114 + <p class="card-text">{{vehiculo.codigo}}</p>
120 115 </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>
  116 + <div class="card-footer" ng-hide="arrastrando">
  117 + <div class="row justify-content-around">
  118 + <div class="col-3 ml-2">
  119 + <i
  120 + class="fa fa-trash fa-lg"
  121 + uib-tooltip="Eliminar vehiculo"
  122 + ng-click="quitarVehiculo(vehiculo)">
  123 + </i>
  124 + </div>
  125 + <div class="col-3">
  126 + <i
  127 + class="fa fa-eye fa-lg"
  128 + uib-tooltip="Ver cisternas"
  129 + ng-click="cargar(vehiculo.id, -1)">
  130 + </i>
  131 + </div>
  132 + <div class="col-3">
  133 + <i
  134 + class="fa fa-save fa-lg"
  135 + uib-tooltip="Confirmar distribuición"
  136 + ng-click="hacerHojaRuta(vehiculo)">
  137 + </i>
  138 + </div>
  139 + </div>
137 140 </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>
  141 + <div class="card-footer text-center" ng-show="arrastrando">
  142 + <button
  143 + class="btn flashit btn-block btn-dashed text-dark"
  144 + id="{{vehiculo.id}}"
  145 + ondrop="drop(event)"
  146 + ondragover="allowDrop(event)">
  147 + Arrastrar aquí
  148 + </button>
143 149 </div>
144 150 </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 151 </div>
153 152 </div>
154 153 </div>
src/views/foca-modal-busqueda-avanzada.html
... ... @@ -0,0 +1,83 @@
  1 +<div class="modal-header">
  2 + <div class="row">
  3 + <div class="col-12">
  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>
  12 + </div>
  13 + </div>
  14 +</div>
  15 +<div class="modal-body"> -->
  16 + <div class="row">
  17 + <div class="col-12">
  18 + <h6>Remitos del cliente:</h6>
  19 + </div>
  20 + <div class="col-12">
  21 + <div class="input-group">
  22 + <input
  23 + class="form-control"
  24 + ng-model="cliente"
  25 + ng-keypress="seleccionarCliente($event.keyCode)"
  26 + placeholder="Ingrese un cliente"
  27 + />
  28 + <button
  29 + ng-show="cliente !== ''"
  30 + type="button"
  31 + class="clear-input"
  32 + ng-click="cliente = '';"
  33 + ><i class="fa fa-times"></i>
  34 + </button>
  35 + <div class="input-group-append">
  36 + <button
  37 + ladda="searchLoading"
  38 + class="btn btn-outline-secondary form-control"
  39 + type="button"
  40 + ng-click="seleccionarCliente()">
  41 + <i class="fa fa-search" aria-hidden="true"></i>
  42 + </button>
  43 + </div>
  44 + </div>
  45 + </div>
  46 + </div>
  47 + <div class="row pt-3">
  48 + <div class="col-12">
  49 + <h6>Remito Nº</h6>
  50 + </div>
  51 + <div class="col-12">
  52 + <div class="input-group">
  53 + <input
  54 + class="form-control"
  55 + ng-model="remito.numero"
  56 + ng-click="seleccionarRemito()"
  57 + readonly/>
  58 + <div class="input-group-append">
  59 + <button
  60 + ladda="searchLoading"
  61 + class="btn btn-outline-secondary form-control"
  62 + type="button"
  63 + ng-click="seleccionarRemito()">
  64 + <i class="fa fa-search" aria-hidden="true"></i>
  65 + </button>
  66 + </div>
  67 + </div>
  68 + </div>
  69 + </div>
  70 +</div>
  71 +<div class="modal-footer py-1">
  72 + <button
  73 + class="btn btn-sm btn-secondary"
  74 + type="button"
  75 + data-dismiss="modal"
  76 + ng-click="cancel()">Cancelar
  77 + </button>
  78 + <button
  79 + class="btn btn-sm btn-primary"
  80 + type="button"
  81 + ng-click="buscar()">Buscar
  82 + </button>
  83 +</div>