Commit 8f1fb1d3cd836d39fbbd45a7a53d660ca8e0c4b0

Authored by Eric Fernandez
Exists in master

Merge branch 'master' into 'master'

Master

See merge request !7
src/js/controller.js
... ... @@ -4,14 +4,6 @@ angular.module('focaAbmPreciosCondiciones')
4 4 'focaModalService', 'focaBotoneraLateralService', '$timeout',
5 5 function($scope, focaAbmPreciosCondicionesService, $location,
6 6 focaModalService, focaBotoneraLateralService, $timeout) {
7   - focaAbmPreciosCondicionesService.obtenerPreciosCondiciones().then(function(datos) {
8   - $scope.preciosCondiciones = datos.data;
9   - $scope.preciosCondiciones.forEach(function(precioCondicion) {
10   - precioCondicion.plazoPago.sort(function(a, b) {
11   - return a.dias- b.dias;
12   - });
13   - });
14   - });
15 7  
16 8 $timeout(function() {
17 9 focaBotoneraLateralService.showSalir(true);
... ... @@ -19,7 +11,7 @@ angular.module('focaAbmPreciosCondiciones')
19 11 focaBotoneraLateralService.showCancelar(false);
20 12 focaBotoneraLateralService.showGuardar(false);
21 13 });
22   -
  14 + $scope.filters = '';
23 15 $scope.now = new Date();
24 16 $scope.editar = function(id) {
25 17 $location.path('/precio-condicion/' + id);
... ... @@ -38,6 +30,21 @@ angular.module('focaAbmPreciosCondiciones')
38 30 }
39 31 );
40 32 };
  33 +
  34 + $scope.buscar = function(key) {
  35 + if(key === 13){
  36 + focaAbmPreciosCondicionesService
  37 + .obtenerPreciosCondiciones($scope.filters)
  38 + .then(function(datos) {
  39 + $scope.preciosCondiciones = datos.data;
  40 + $scope.preciosCondiciones.forEach(function(precioCondicion) {
  41 + precioCondicion.plazoPago.sort(function(a, b) {
  42 + return a.dias- b.dias;
  43 + });
  44 + });
  45 + });
  46 + }
  47 + };
41 48 }
42 49 ])
43 50 .controller('focaAbmPrecioCondicionController', [
... ... @@ -47,6 +54,7 @@ angular.module('focaAbmPreciosCondiciones')
47 54 $scope, focaAbmPreciosCondicionesService, focaBotoneraLateralService,
48 55 $routeParams, $location, focaModalService, $timeout, $uibModal, $window
49 56 ) {
  57 + $scope.focused = 1;
50 58 $scope.plazosAEliminar = [];
51 59 $scope.mostrarPlazos = $routeParams.id > 0;
52 60 $scope.now = new Date();
... ... @@ -168,19 +176,26 @@ angular.module('focaAbmPreciosCondiciones')
168 176 );
169 177 };
170 178  
171   - $scope.seleccionarListaPrecio = function() {
172   - var modalInstance = $uibModal.open(
173   - {
174   - ariaLabelledBy: 'Busqueda de Listas de precio',
175   - templateUrl: 'modal-lista-precio.html',
176   - controller: 'focaModalListaPrecioCtrl',
177   - size: 'lg'
178   - }
179   - );
180   - modalInstance.result.then(function(listaPrecio) {
181   - $scope.precioCondicion.listaPrecio = listaPrecio;
182   - $scope.listaPrecioLabel = listaPrecio.ID + ' - ' + listaPrecio.DES;
183   - });
  179 + $scope.seleccionarListaPrecio = function(key) {
  180 + if(key === 13){
  181 + var modalInstance = $uibModal.open(
  182 + {
  183 + ariaLabelledBy: 'Busqueda de Listas de precio',
  184 + templateUrl: 'modal-lista-precio.html',
  185 + controller: 'focaModalListaPrecioCtrl',
  186 + size: 'lg'
  187 + }
  188 + );
  189 + modalInstance.result.then(function(listaPrecio) {
  190 + $scope.precioCondicion.listaPrecio = listaPrecio;
  191 + $scope.listaPrecioLabel = listaPrecio.ID + ' - ' + listaPrecio.DES;
  192 + $scope.focused = 4;
  193 + });
  194 + }
  195 + };
  196 +
  197 + $scope.next = function(key) {
  198 + if(key === 13) $scope.focused++;
184 199 };
185 200 }
186 201 ]);
... ... @@ -3,8 +3,8 @@ angular.module('focaAbmPreciosCondiciones')
3 3 '$http', 'API_ENDPOINT',
4 4 function($http, API_ENDPOINT) {
5 5 return {
6   - obtenerPreciosCondiciones: function() {
7   - return $http.get(API_ENDPOINT.URL + '/precio-condicion');
  6 + obtenerPreciosCondiciones: function(nombre) {
  7 + return $http.post(API_ENDPOINT.URL + '/precios-condiciones', {nombre: nombre});
8 8 },
9 9 obtenerPrecioCondicion: function(id) {
10 10 return $http.get(API_ENDPOINT.URL + '/precio-condicion/' + id);
src/views/foca-abm-precios-condiciones-item.html
... ... @@ -25,6 +25,9 @@
25 25 name="nombre"
26 26 ng-model="precioCondicion.nombre"
27 27 autocomplete="off"
  28 + foca-focus="focused == 1"
  29 + ng-focus="focused = 1"
  30 + ng-keypress="next($event.keyCode)"
28 31 teclado-virtual
29 32 />
30 33 </div>
... ... @@ -36,6 +39,9 @@
36 39 name="nombre"
37 40 ng-model="precioCondicion.descripcion"
38 41 autocomplete="off"
  42 + foca-focus="focused == 2"
  43 + ng-focus="focused = 2"
  44 + ng-keypress="next($event.keyCode)"
39 45 teclado-virtual
40 46 />
41 47 </div>
... ... @@ -45,6 +51,9 @@
45 51 <input
46 52 ng-model="listaPrecioLabel"
47 53 class="form-control"
  54 + foca-focus="focused == 3"
  55 + ng-focus="focused = 3"
  56 + ng-keypress="seleccionarListaPrecio($event.keyCode)"
48 57 readonly
49 58 />
50 59 <div class="input-group-append">
... ... @@ -53,8 +62,7 @@
53 62 class="btn btn-outline-secondary form-control"
54 63 title="Buscar"
55 64 type="button"
56   - ng-click="seleccionarListaPrecio()"
57   - foca-focus="focused == 3"
  65 + ng-click="seleccionarListaPrecio(13)"
58 66 >
59 67 <i class="fa fa-search" aria-hidden="true"></i>
60 68 </button>
... ... @@ -69,7 +77,8 @@
69 77 min="0"
70 78 ng-model="plazoACargar.dias"
71 79 ng-keypress="agregarPlazo($event.keyCode)"
72   - foca-focus="ingreso"
  80 + foca-focus="focused == 4"
  81 + ng-focus="focused = 4"
73 82 placeholder="Días"
74 83 />
75 84 <div class="input-group-append">
... ... @@ -78,7 +87,6 @@
78 87 title="Agregar"
79 88 type="button"
80 89 ng-click="agregarPlazo(13)"
81   - foca-focus="focused == 3"
82 90 >
83 91 <i class="fa fa-save" aria-hidden="true"></i>
84 92 </button>
src/views/foca-abm-precios-condiciones-listado.html
... ... @@ -14,7 +14,7 @@
14 14 id="search"
15 15 placeholder="Búsqueda"
16 16 teclado-virtual
17   - ng-keypress="busquedaPress($event.keyCode)"
  17 + ng-keypress="buscar($event.keyCode)"
18 18 ng-model="filters"
19 19 />
20 20 <div class="input-group-append">
... ... @@ -22,7 +22,7 @@
22 22 ladda="searchLoading"
23 23 class="btn btn-outline-secondary"
24 24 type="button"
25   - ng-click="busquedaPress(13)"
  25 + ng-click="buscar(13)"
26 26 >
27 27 <i class="fa fa-search" aria-hidden="true"></i>
28 28 </button>
... ... @@ -46,7 +46,7 @@
46 46 </tr>
47 47 </thead>
48 48 <tbody>
49   - <tr ng-repeat="precioCondicion in preciosCondiciones | filter: filters">
  49 + <tr ng-repeat="precioCondicion in preciosCondiciones">
50 50 <td ng-bind="precioCondicion.id | rellenarDigitos: 4: 0"></td>
51 51 <td ng-bind="precioCondicion.nombre"></td>
52 52 <td ng-bind="precioCondicion.listaPrecio.ID + ' - ' + precioCondicion.listaPrecio.DES + ' - ' + precioCondicion.listaPrecio.moneda.DETALLE"></td>