Commit 7575179418ed2b460be41eef5e8de0a493250da1
Exists in
master
Merge branch 'develop' into 'master'
Develop See merge request !31
Showing
2 changed files
Show diff stats
src/js/controller.js
| 1 | 1 | angular.module('focaAdminSeguimiento').controller('focaAdminSeguimientoController', [ |
| 2 | 2 | '$scope', '$timeout', 'focaAdminSeguimientoService', '$uibModal', |
| 3 | - 'focaBotoneraLateralService','$location', '$routeParams', | |
| 4 | - function($scope, $timeout, focaAdminSeguimientoService, $uibModal, | |
| 5 | - focaBotoneraLateralService, $location, $routeParams) { | |
| 3 | + 'focaBotoneraLateralService', '$location', '$routeParams', 'focaModalService', | |
| 4 | + function ($scope, $timeout, focaAdminSeguimientoService, $uibModal, | |
| 5 | + focaBotoneraLateralService, $location, $routeParams, focaModalService) { | |
| 6 | 6 | $scope.actividad = ''; |
| 7 | 7 | $scope.titulo = ''; |
| 8 | 8 | var cabecera = ''; |
| ... | ... | @@ -43,27 +43,27 @@ angular.module('focaAdminSeguimiento').controller('focaAdminSeguimientoControlle |
| 43 | 43 | focaBotoneraLateralService.showPausar(false); |
| 44 | 44 | focaBotoneraLateralService.showGuardar(false); |
| 45 | 45 | |
| 46 | - $scope.general = function() { | |
| 46 | + $scope.general = function () { | |
| 47 | 47 | $scope.idUsuario = 0; |
| 48 | 48 | getSeguimiento(); |
| 49 | 49 | }; |
| 50 | 50 | |
| 51 | - $scope.individual = function() { | |
| 51 | + $scope.individual = function () { | |
| 52 | 52 | $scope.idUsuario = -1; |
| 53 | 53 | }; |
| 54 | 54 | |
| 55 | - $scope.salir = function() { | |
| 55 | + $scope.salir = function () { | |
| 56 | 56 | $location.path('/'); |
| 57 | 57 | }; |
| 58 | 58 | |
| 59 | - $scope.search = function(key) { | |
| 59 | + $scope.search = function (key) { | |
| 60 | 60 | if (key === 13) { |
| 61 | 61 | $scope.idUsuario = $scope.idUsuarioInput; |
| 62 | - | |
| 62 | + | |
| 63 | 63 | getSeguimiento(); |
| 64 | 64 | if ($scope.actividad === 'Entrega de producto' && $scope.idUsuario !== 0) { |
| 65 | 65 | focaAdminSeguimientoService.obtenerRemitosVehiculo($scope.idUsuario) |
| 66 | - .then(function(res) { | |
| 66 | + .then(function (res) { | |
| 67 | 67 | var remitos = []; |
| 68 | 68 | for (var i = 0; i < res.data.length; i++) { |
| 69 | 69 | remitos = remitos.concat(res.data[i].remitos); |
| ... | ... | @@ -74,11 +74,11 @@ angular.module('focaAdminSeguimiento').controller('focaAdminSeguimientoControlle |
| 74 | 74 | } |
| 75 | 75 | }; |
| 76 | 76 | |
| 77 | - $scope.fecha = function() { | |
| 77 | + $scope.fecha = function () { | |
| 78 | 78 | getSeguimiento(); |
| 79 | 79 | }; |
| 80 | 80 | |
| 81 | - $scope.showMarcadores = function() { | |
| 81 | + $scope.showMarcadores = function () { | |
| 82 | 82 | var texto = ''; |
| 83 | 83 | |
| 84 | 84 | if ($scope.actividad === 'Nota de pedido') { |
| ... | ... | @@ -101,7 +101,7 @@ angular.module('focaAdminSeguimiento').controller('focaAdminSeguimientoControlle |
| 101 | 101 | controller: 'focaModalMarcadoresController', |
| 102 | 102 | size: 'lg', |
| 103 | 103 | resolve: { |
| 104 | - parametros: function() { | |
| 104 | + parametros: function () { | |
| 105 | 105 | var parametros = { |
| 106 | 106 | marcadores: $scope.marcadores, |
| 107 | 107 | actividad: $scope.actividad |
| ... | ... | @@ -114,13 +114,13 @@ angular.module('focaAdminSeguimiento').controller('focaAdminSeguimientoControlle |
| 114 | 114 | ); |
| 115 | 115 | |
| 116 | 116 | modalInstance.result.then( |
| 117 | - function(localizacion) { | |
| 117 | + function (localizacion) { | |
| 118 | 118 | $scope.$broadcast('moveMap', { |
| 119 | 119 | latitud: localizacion.latitud, |
| 120 | 120 | longitud: localizacion.longitud, |
| 121 | 121 | indice: localizacion.indice |
| 122 | 122 | }); |
| 123 | - }, function() { | |
| 123 | + }, function () { | |
| 124 | 124 | // funcion ejecutada cuando se cancela el modal |
| 125 | 125 | } |
| 126 | 126 | ); |
| ... | ... | @@ -130,7 +130,7 @@ angular.module('focaAdminSeguimiento').controller('focaAdminSeguimientoControlle |
| 130 | 130 | var now = $scope.now; |
| 131 | 131 | var hasta = angular.copy(now); |
| 132 | 132 | hasta.setDate(hasta.getDate() + 1); |
| 133 | - | |
| 133 | + | |
| 134 | 134 | var datos = { |
| 135 | 135 | actividad: $scope.actividad, |
| 136 | 136 | idUsuario: $scope.idUsuario, |
| ... | ... | @@ -147,10 +147,10 @@ angular.module('focaAdminSeguimiento').controller('focaAdminSeguimientoControlle |
| 147 | 147 | |
| 148 | 148 | focaAdminSeguimientoService |
| 149 | 149 | .obtenerActividad(datos) |
| 150 | - .then(function(datos) { | |
| 150 | + .then(function (datos) { | |
| 151 | 151 | $scope.marcadores = datos.data; |
| 152 | 152 | $scope.$broadcast('cleanCabecera'); |
| 153 | - | |
| 153 | + | |
| 154 | 154 | if ($scope.idUsuario !== 0) { |
| 155 | 155 | $scope.$broadcast('addCabecera', { |
| 156 | 156 | label: 'Individual', |
| ... | ... | @@ -171,11 +171,11 @@ angular.module('focaAdminSeguimiento').controller('focaAdminSeguimientoControlle |
| 171 | 171 | if (datos.data.length) { |
| 172 | 172 | valor = datos.data[0].hojaRutaMovimiento.remito.hojaRuta |
| 173 | 173 | .vehiculo.codigo + ' - ' + datos.data[0] |
| 174 | - .hojaRutaMovimiento.remito.hojaRuta.vehiculo.tractor.trim(); | |
| 174 | + .hojaRutaMovimiento.remito.hojaRuta.vehiculo.tractor.trim(); | |
| 175 | 175 | } else { |
| 176 | 176 | valor = $scope.idUsuario; |
| 177 | 177 | } |
| 178 | - | |
| 178 | + | |
| 179 | 179 | break; |
| 180 | 180 | case 'cobranza': |
| 181 | 181 | if (datos.data.length) { |
| ... | ... | @@ -186,24 +186,112 @@ angular.module('focaAdminSeguimiento').controller('focaAdminSeguimientoControlle |
| 186 | 186 | } |
| 187 | 187 | break; |
| 188 | 188 | } |
| 189 | - | |
| 189 | + | |
| 190 | 190 | $scope.$broadcast('addCabecera', { |
| 191 | 191 | label: cabecera, |
| 192 | 192 | valor: valor |
| 193 | 193 | }); |
| 194 | 194 | |
| 195 | 195 | } else { |
| 196 | - $scope.$broadcast('addCabecera',{ | |
| 196 | + $scope.$broadcast('addCabecera', { | |
| 197 | 197 | label: 'General', |
| 198 | 198 | valor: '' |
| 199 | 199 | }); |
| 200 | 200 | } |
| 201 | - | |
| 201 | + | |
| 202 | 202 | $scope.$broadcast('addCabecera', { |
| 203 | 203 | label: 'Cantidad: ', |
| 204 | 204 | valor: datos.data.length + ' Marcadores' |
| 205 | 205 | }); |
| 206 | 206 | }); |
| 207 | 207 | } |
| 208 | + $scope.openModal = function () { | |
| 209 | + var parametrosModal = {}; | |
| 210 | + switch ($routeParams.parametro) { | |
| 211 | + case 'nota-pedido': | |
| 212 | + parametrosModal = { | |
| 213 | + titulo: 'Bรบsqueda vendedores', | |
| 214 | + query: '/vendedor', | |
| 215 | + columnas: [ | |
| 216 | + { | |
| 217 | + propiedad: 'NUM', | |
| 218 | + nombre: 'Cรณdigo', | |
| 219 | + filtro: { | |
| 220 | + nombre: 'rellenarDigitos', | |
| 221 | + parametro: 3 | |
| 222 | + } | |
| 223 | + }, | |
| 224 | + { | |
| 225 | + propiedad: 'NOM', | |
| 226 | + nombre: 'Nombre' | |
| 227 | + } | |
| 228 | + ], | |
| 229 | + size: 'md' | |
| 230 | + }; | |
| 231 | + break; | |
| 232 | + case 'hoja-ruta': | |
| 233 | + parametrosModal = { | |
| 234 | + titulo: 'Bรบsqueda de Transportista', | |
| 235 | + query: '/transportista', | |
| 236 | + columnas: [ | |
| 237 | + { | |
| 238 | + nombre: 'Cรณdigo', | |
| 239 | + propiedad: 'COD' | |
| 240 | + }, | |
| 241 | + { | |
| 242 | + nombre: 'Nombre', | |
| 243 | + propiedad: 'NOM' | |
| 244 | + }, | |
| 245 | + { | |
| 246 | + nombre: 'CUIT', | |
| 247 | + propiedad: 'CUIT' | |
| 248 | + } | |
| 249 | + ], | |
| 250 | + size: 'md' | |
| 251 | + }; | |
| 252 | + break; | |
| 253 | + case 'cobranza': | |
| 254 | + parametrosModal = { | |
| 255 | + titulo: 'Bรบsqueda de cobradores', | |
| 256 | + query: '/cobrador', | |
| 257 | + columnas: [ | |
| 258 | + { | |
| 259 | + propiedad: 'NUM', | |
| 260 | + nombre: 'Codigo', | |
| 261 | + filtro: { | |
| 262 | + nombre: 'rellenarDigitos', | |
| 263 | + parametro: 3 | |
| 264 | + } | |
| 265 | + }, | |
| 266 | + { | |
| 267 | + propiedad: 'NOM', | |
| 268 | + nombre: 'Nombre' | |
| 269 | + } | |
| 270 | + ], | |
| 271 | + size: 'md' | |
| 272 | + }; | |
| 273 | + break; | |
| 274 | + default: | |
| 275 | + break; | |
| 276 | + } | |
| 277 | + focaModalService.modal(parametrosModal) | |
| 278 | + .then( | |
| 279 | + function (data) { | |
| 280 | + $scope.idUsuario = $scope.idUsuarioInput = data.NUM; | |
| 281 | + getSeguimiento(); | |
| 282 | + if ($scope.actividad === 'Entrega de producto' && $scope.idUsuario !== 0) { | |
| 283 | + focaAdminSeguimientoService.obtenerRemitosVehiculo($scope.idUsuario) | |
| 284 | + .then(function (res) { | |
| 285 | + var remitos = []; | |
| 286 | + for (var i = 0; i < res.data.length; i++) { | |
| 287 | + remitos = remitos.concat(res.data[i].remitos); | |
| 288 | + } | |
| 289 | + $scope.remitosVehiculo = remitos; | |
| 290 | + }); | |
| 291 | + } | |
| 292 | + } | |
| 293 | + ) | |
| 294 | + .catch(function (e) { console.log(e) }); | |
| 295 | + } | |
| 208 | 296 | } |
| 209 | 297 | ]); |
src/views/foca-admin-seguimiento.html
| ... | ... | @@ -17,69 +17,73 @@ |
| 17 | 17 | /> |
| 18 | 18 | </div> |
| 19 | 19 | <div class="col-2 pl-0"> |
| 20 | - <input | |
| 21 | - type="text" | |
| 22 | - ng-model="now" | |
| 23 | - class="btn col-12 my-1" | |
| 24 | - ng-blur="fecha()" | |
| 25 | - uib-datepicker-popup="dd/MM/yyyy" | |
| 26 | - show-button-bar="false" | |
| 27 | - is-open="datepickerOpen" | |
| 28 | - on-open-focus="false" | |
| 29 | - ng-focus="datepickerOpen = true" | |
| 30 | - datepicker-options="dateOptions" | |
| 31 | - /> | |
| 32 | - <button | |
| 33 | - type="button" | |
| 34 | - ng-class="{'active': idUsuario == 0}" | |
| 35 | - class="btn col-12 my-1" | |
| 20 | + <div class="input-group mb-3"> | |
| 21 | + <div class="input-group-prepend my-2"> | |
| 22 | + <button | |
| 23 | + class="input-group-text" | |
| 24 | + ng-click="datepickerOpen = true" | |
| 25 | + > | |
| 26 | + <i class="fa fa-calendar" aria-hidden="true"></i> | |
| 27 | + </button> | |
| 28 | + </div> | |
| 29 | + <input | |
| 30 | + type="text" | |
| 31 | + ng-model="now" | |
| 32 | + class="form-control col-12 my-2" | |
| 33 | + ng-blur="fecha()" | |
| 34 | + uib-datepicker-popup="dd/MM/yyyy" | |
| 35 | + show-button-bar="false" | |
| 36 | + is-open="datepickerOpen" | |
| 37 | + on-open-focus="false" | |
| 38 | + ng-focus="datepickerOpen = true" | |
| 39 | + datepicker-options="dateOptions" | |
| 40 | + /> | |
| 41 | + </div> | |
| 42 | + <button | |
| 43 | + type="button" | |
| 44 | + ng-class="{'active': idUsuario == 0}" | |
| 45 | + class="btn btn-outline-debo col-12 my-1" | |
| 36 | 46 | ng-click="general()" |
| 37 | 47 | >General</button> |
| 38 | 48 | <button |
| 39 | - type="button" | |
| 40 | - ng-class="{'active': idUsuario != 0}" | |
| 41 | - class="btn col-12 my-1" | |
| 49 | + type="button" | |
| 50 | + ng-class="{'active': idUsuario != 0}" | |
| 51 | + class="btn btn-outline-debo col-12 my-1" | |
| 42 | 52 | ng-click="individual()" |
| 43 | 53 | >Individual</button> |
| 44 | 54 | <div class="form-group my-1" ng-show="idUsuario != 0"> |
| 45 | - <input | |
| 46 | - type="text" | |
| 47 | - placeholder="Vendedor" | |
| 48 | - class="form-control" | |
| 49 | - ng-model="idUsuarioInput" | |
| 50 | - ng-keypress="search($event.keyCode)" | |
| 55 | + <button | |
| 56 | + class="btn btn-default" | |
| 51 | 57 | foca-focus="idUsuario == -1" |
| 52 | 58 | ng-show="actividad == 'Nota de pedido'" |
| 53 | - teclado-virtual | |
| 54 | - > | |
| 55 | - <input | |
| 56 | - type="text" | |
| 57 | - placeholder="Vehiculo" | |
| 58 | - class="form-control" | |
| 59 | - ng-model="idUsuarioInput" | |
| 60 | - ng-keypress="search($event.keyCode)" | |
| 59 | + ng-click="openModal()"> | |
| 60 | + <i class="fa fa-hand-pointer-o" aria-hidden="true"></i> | |
| 61 | + Vendedor | |
| 62 | + </button> | |
| 63 | + <button | |
| 64 | + class="btn btn-default" | |
| 61 | 65 | foca-focus="idUsuario == -1" |
| 62 | 66 | ng-show="actividad == 'Entrega de producto'" |
| 63 | - teclado-virtual | |
| 64 | - > | |
| 65 | - <input | |
| 66 | - type="text" | |
| 67 | - placeholder="Cobrador" | |
| 68 | - class="form-control" | |
| 69 | - ng-model="idUsuarioInput" | |
| 70 | - ng-keypress="search($event.keyCode)" | |
| 67 | + ng-click="openModal()"> | |
| 68 | + <i class="fa fa-hand-pointer-o" aria-hidden="true"></i> | |
| 69 | + Transportista | |
| 70 | + </button> | |
| 71 | + <button | |
| 72 | + class="btn btn-default" | |
| 71 | 73 | foca-focus="idUsuario == -1" |
| 72 | 74 | ng-show="actividad == 'Cobranza'" |
| 73 | - teclado-virtual | |
| 74 | - > | |
| 75 | + ng-click="openModal()"> | |
| 76 | + <i class="fa fa-hand-pointer-o" aria-hidden="true"></i> | |
| 77 | + Cobrador | |
| 78 | + </button> | |
| 75 | 79 | </div> |
| 76 | 80 | <button |
| 77 | - type="button" | |
| 78 | - class="btn col-12 my-1" | |
| 81 | + type="button" | |
| 82 | + class="btn btn-danger col-12 my-1" | |
| 79 | 83 | ng-show="marcadores.length > 0 && idUsuario > 0" |
| 80 | 84 | ng-click="showMarcadores()" |
| 81 | 85 | >Listar marcadores</button> |
| 82 | - <div ng-show="actividad === 'Entrega de producto' && idUsuario != 0"> | |
| 86 | + <div ng-show="actividad === 'Entrega de producto' && idUsuario !== 0"> | |
| 83 | 87 | <div class="custom-control custom-radio"> |
| 84 | 88 | <input |
| 85 | 89 | type="radio" |