Commit ea1df75ff64d4b745d4aaef95f3fafc8b670c35b

Authored by Jose Pinto
Exists in master

Merge branch 'master' into 'master'

Master(efernandez)

See merge request !1
... ... @@ -7,14 +7,14 @@
7 7 "gulp-pre-commit": "gulp pre-commit",
8 8 "compile": "gulp uglify",
9 9 "postinstall": "npm run compile && gulp clean-post-install",
10   - "install-dev": "npm install -D angular angular-ladda ladda@1.0.6 bootstrap font-awesome gulp gulp-angular-templatecache gulp-concat gulp-connect gulp-htmlmin gulp-jshint gulp-rename gulp-replace gulp-uglify gulp-clean jasmine-core jquery jshint pre-commit pump ui-bootstrap4 && npm i -D git+https://debo.suite.repo/modulos-npm/foca-directivas"
  10 + "install-dev": "npm install -D angular angular-ladda ladda@1.0.6 bootstrap font-awesome gulp gulp-angular-templatecache gulp-concat gulp-connect gulp-htmlmin gulp-jshint gulp-rename gulp-replace gulp-uglify gulp-clean jasmine-core jquery jshint pre-commit pump ui-bootstrap4 && npm i -D git+http://git.focasoftware.com/npm/foca-directivas"
11 11 },
12 12 "pre-commit": [
13 13 "gulp-pre-commit"
14 14 ],
15 15 "repository": {
16 16 "type": "git",
17   - "url": "https://debo.suite.repo/modulos-npm/foca-modal-busqueda-productos"
  17 + "url": "http://git.focasoftware.com/npm/foca-modal-busqueda-productos"
18 18 },
19 19 "author": "Nicolás Guarnieri",
20 20 "license": "ISC",
... ... @@ -33,13 +33,13 @@
33 33 "gulp-uglify": "^3.0.1",
34 34 "jquery": "^3.3.1",
35 35 "pump": "^3.0.0",
36   - "foca-directivas": "git+https://debo.suite.repo/modulos-npm/foca-directivas"
  36 + "foca-directivas": "git+http://git.focasoftware.com/npm/foca-directivas"
37 37 },
38 38 "devDependencies": {
39 39 "angular": "^1.7.5",
40 40 "angular-ladda": "^0.4.3",
41 41 "bootstrap": "^4.1.3",
42   - "foca-directivas": "git+https://debo.suite.repo/modulos-npm/foca-directivas",
  42 + "foca-directivas": "git+http://git.focasoftware.com/npm/foca-directivas",
43 43 "font-awesome": "^4.7.0",
44 44 "gulp": "^3.9.1",
45 45 "gulp-angular-templatecache": "^2.2.3",
src/js/controller.js
1 1 angular.module('focaBusquedaProductos')
2 2 .controller('modalBusquedaProductosCtrl',
3 3 [
  4 + '$timeout',
4 5 '$filter',
5 6 '$scope',
6 7 '$uibModalInstance',
7 8 'parametroProducto',
8 9 'focaBusquedaProductosService',
9   - function($filter, $scope, $uibModalInstance, parametroProducto,
  10 + function($timeout, $filter, $scope, $uibModalInstance, parametroProducto,
10 11 focaBusquedaProductosService
11 12 ) {
12 13  
... ... @@ -43,10 +44,10 @@ angular.module('focaBusquedaProductos')
43 44 $scope.searchLoading = false;
44 45 $scope.primerBusqueda = true;
45 46 $scope.productos = res.data;
46   - $scope.search();
  47 + $scope.search(true);
47 48 primera();
48 49 }
49   - $scope.search = function() {
  50 + $scope.search = function(pressed) {
50 51 if($scope.productos.length > 0) {
51 52 $scope.filteredProductos = $filter('filter')(
52 53 $scope.productos,
... ... @@ -58,6 +59,11 @@ angular.module('focaBusquedaProductos')
58 59 );
59 60  
60 61 $scope.resetPage();
  62 + }else if(pressed) {
  63 + $timeout(function() {
  64 + angular.element('#search')[0].focus();
  65 + $scope.filters = '';
  66 + });
61 67 }
62 68 };
63 69  
src/views/modal-busqueda-productos.html
1   -<div class="modal-header">
2   - <h5 class="modal-title my-1">Busqueda de Productos</h5>
3   -</div>
4   -<div class="modal-body" id="modal-body">
5   - <div class="input-group">
6   - <input
7   - ladda="searchLoading"
8   - type="text"
9   - class="form-control"
10   - placeholder="Busqueda"
11   - ng-model="filters"
12   - ng-change="search()"
13   - ng-keydown="busquedaDown($event.keyCode)"
14   - ng-keypress="busquedaPress($event.keyCode)"
15   - foca-focus="selectedProducto == -1"
16   - ng-focus="selectedProducto = -1"
17   - teclado-virtual
18   - >
19   - <div class="input-group-append">
20   - <button
  1 +<div class="modal-header py-1">
  2 + <div class="row w-100">
  3 + <div class="col-lg-6">
  4 + <h5 class="modal-title my-1">Busqueda de Productos</h5>
  5 + </div>
  6 + <div class="input-group col-lg-6 pr-0 my-2">
  7 + <input
21 8 ladda="searchLoading"
22   - class="btn btn-outline-secondary"
23   - type="button"
24   - ng-click="busquedaPress(13)"
  9 + type="text"
  10 + class="form-control form-control-sm"
  11 + id="search"
  12 + placeholder="Busqueda"
  13 + ng-model="filters"
  14 + ng-change="search()"
  15 + ng-keydown="busquedaDown($event.keyCode)"
  16 + ng-keypress="busquedaPress($event.keyCode)"
  17 + foca-focus="selectedProducto == -1"
  18 + ng-focus="selectedProducto = -1"
  19 + teclado-virtual
25 20 >
26   - <i class="fa fa-search" aria-hidden="true"></i>
27   - </button>
  21 + <div class="input-group-append">
  22 + <button
  23 + ladda="searchLoading"
  24 + data-spinner-color="#FF0000"
  25 + class="btn btn-outline-secondary"
  26 + type="button"
  27 + ng-click="busquedaPress(13)"
  28 + >
  29 + <i class="fa fa-search" aria-hidden="true"></i>
  30 + </button>
  31 + </div>
28 32 </div>
29 33 </div>
  34 +</div>
  35 +<div class="modal-body" id="modal-body">
  36 +
  37 + <div ng-show="!primerBusqueda">
  38 + Debe realizar una primer búsqueda.
  39 + </div>
  40 +
30 41 <table ng-show="primerBusqueda" class="table table-striped table-sm">
31 42 <thead>
32 43 <tr>
... ... @@ -47,9 +58,9 @@
47 58 ng-click="select(producto)">
48 59 <td ng-bind="producto.sector + '-' + producto.codigo"></td>
49 60 <td ng-bind="producto.descripcion"></td>
50   - <td class="text-right" ng-bind="producto.precio | currency: simbolo : 4"></td>
  61 + <td class="text-right" ng-bind="producto.precio | currency: simbolo : 2"></td>
51 62 <td class="d-md-none text-primary">
52   - <i class="fa fa-arrow-right" aria-hidden="true"></i>
  63 + <i class="fa fa-circle-thin" aria-hidden="true"></i>
53 64 </td>
54 65 <td class="d-none d-md-table-cell">
55 66 <button
... ... @@ -61,13 +72,16 @@
61 72 }"
62 73 foca-focus="selectedProducto == {{key}}"
63 74 ng-keydown="itemProducto($event.keyCode)">
64   - <i class="fa fa-arrow-right" aria-hidden="true"></i>
  75 + <i class="fa fa-circle-thin" aria-hidden="true"></i>
65 76 </button>
66 77 </td>
67 78 </tr>
68 79 </tbody>
69 80 </table>
70   - <nav ng-show="currentPageProductos.length > 0 && primerBusqueda">
  81 +
  82 +</div>
  83 +<div class="modal-footer py-1">
  84 + <nav ng-show="currentPageProductos.length > 0 && primerBusqueda" class="mr-auto">
71 85 <ul class="pagination pagination-sm justify-content mb-0">
72 86 <li class="page-item" ng-class="{'disabled': currentPage == 1}">
73 87 <a class="page-link" href="javascript:void();" ng-click="selectPage(currentPage - 1)">
... ... @@ -95,7 +109,5 @@
95 109 </li>
96 110 </ul>
97 111 </nav>
98   -</div>
99   -<div class="modal-footer">
100 112 <button class="btn btn-sm btn-secondary my-1" type="button" ng-click="cancel()">Cancelar</button>
101 113 </div>