Commit 21dfafd41b0eabbb94ee9508a8797e2cc842ea1b
Exists in
master
Merge branch 'develop' into 'master'
Develop See merge request !8
Showing
4 changed files
Show diff stats
package.json
1 | { | 1 | { |
2 | "name": "foca-modal-busqueda-productos", | 2 | "name": "foca-modal-busqueda-productos", |
3 | "version": "0.0.1", | 3 | "version": "0.0.1", |
4 | "description": "Modal para seleccion de productos", | 4 | "description": "Modal para seleccion de productos", |
5 | "scripts": { | 5 | "scripts": { |
6 | "refresh": "gulp uglify && cp tmp/foca-busqueda-productos.js ../wrapper-demo/node_modules/foca-modal-busqueda-productos/dist/foca-busqueda-productos.min.js", | ||
6 | "test": "echo \"Error: no test specified\" && exit 1", | 7 | "test": "echo \"Error: no test specified\" && exit 1", |
7 | "gulp-pre-commit": "gulp pre-commit", | 8 | "gulp-pre-commit": "gulp pre-commit", |
8 | "compile": "gulp uglify", | 9 | "compile": "gulp uglify", |
9 | "postinstall": "npm run compile && gulp clean-post-install", | 10 | "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+http://git.focasoftware.com/npm/foca-directivas.git" | 11 | "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.git" |
11 | }, | 12 | }, |
12 | "pre-commit": [ | 13 | "pre-commit": [ |
13 | "gulp-pre-commit" | 14 | "gulp-pre-commit" |
14 | ], | 15 | ], |
15 | "repository": { | 16 | "repository": { |
16 | "type": "git", | 17 | "type": "git", |
17 | "url": "http://git.focasoftware.com/npm/foca-modal-busqueda-productos" | 18 | "url": "http://git.focasoftware.com/npm/foca-modal-busqueda-productos" |
18 | }, | 19 | }, |
19 | "author": "Nicolás Guarnieri", | 20 | "author": "Nicolás Guarnieri", |
20 | "license": "ISC", | 21 | "license": "ISC", |
21 | "peerDependencies": { | 22 | "peerDependencies": { |
22 | "angular": "^1.7.4", | 23 | "angular": "^1.7.4", |
23 | "bootstrap": "^4.1.3", | 24 | "bootstrap": "^4.1.3", |
24 | "font-awesome": "^4.7.0", | 25 | "font-awesome": "^4.7.0", |
25 | "ui-bootstrap4": "^3.0.4", | 26 | "ui-bootstrap4": "^3.0.4", |
26 | "gulp": "^3.9.1", | 27 | "gulp": "^3.9.1", |
27 | "gulp-angular-templatecache": "^2.2.1", | 28 | "gulp-angular-templatecache": "^2.2.1", |
28 | "gulp-concat": "^2.6.1", | 29 | "gulp-concat": "^2.6.1", |
29 | "gulp-connect": "^5.6.1", | 30 | "gulp-connect": "^5.6.1", |
30 | "gulp-htmlmin": "^5.0.1", | 31 | "gulp-htmlmin": "^5.0.1", |
31 | "gulp-rename": "^1.4.0", | 32 | "gulp-rename": "^1.4.0", |
32 | "gulp-replace": "^1.0.0", | 33 | "gulp-replace": "^1.0.0", |
33 | "gulp-uglify": "^3.0.1", | 34 | "gulp-uglify": "^3.0.1", |
34 | "jquery": "^3.3.1", | 35 | "jquery": "^3.3.1", |
35 | "pump": "^3.0.0", | 36 | "pump": "^3.0.0", |
36 | "foca-directivas": "git+http://git.focasoftware.com/npm/foca-directivas.git" | 37 | "foca-directivas": "git+http://git.focasoftware.com/npm/foca-directivas.git" |
37 | }, | 38 | }, |
38 | "devDependencies": { | 39 | "devDependencies": { |
39 | "angular": "^1.7.5", | 40 | "angular": "^1.7.5", |
40 | "angular-ladda": "^0.4.3", | 41 | "angular-ladda": "^0.4.3", |
41 | "bootstrap": "^4.1.3", | 42 | "bootstrap": "^4.1.3", |
42 | "foca-directivas": "git+http://git.focasoftware.com/npm/foca-directivas.git", | 43 | "foca-directivas": "git+http://git.focasoftware.com/npm/foca-directivas.git", |
43 | "font-awesome": "^4.7.0", | 44 | "font-awesome": "^4.7.0", |
44 | "gulp": "^3.9.1", | 45 | "gulp": "^3.9.1", |
45 | "gulp-angular-templatecache": "^2.2.3", | 46 | "gulp-angular-templatecache": "^2.2.3", |
46 | "gulp-clean": "^0.4.0", | 47 | "gulp-clean": "^0.4.0", |
47 | "gulp-concat": "^2.6.1", | 48 | "gulp-concat": "^2.6.1", |
48 | "gulp-connect": "^5.6.1", | 49 | "gulp-connect": "^5.6.1", |
49 | "gulp-htmlmin": "^5.0.1", | 50 | "gulp-htmlmin": "^5.0.1", |
50 | "gulp-jshint": "^2.1.0", | 51 | "gulp-jshint": "^2.1.0", |
51 | "gulp-rename": "^1.4.0", | 52 | "gulp-rename": "^1.4.0", |
52 | "gulp-replace": "^1.0.0", | 53 | "gulp-replace": "^1.0.0", |
53 | "gulp-uglify": "^3.0.1", | 54 | "gulp-uglify": "^3.0.1", |
54 | "jasmine-core": "^3.3.0", | 55 | "jasmine-core": "^3.3.0", |
55 | "jquery": "^3.3.1", | 56 | "jquery": "^3.3.1", |
56 | "jshint": "^2.9.6", | 57 | "jshint": "^2.9.6", |
57 | "ladda": "1.0.6", | 58 | "ladda": "1.0.6", |
58 | "pre-commit": "^1.2.2", | 59 | "pre-commit": "^1.2.2", |
59 | "pump": "^3.0.0", | 60 | "pump": "^3.0.0", |
60 | "ui-bootstrap4": "^3.0.5" | 61 | "ui-bootstrap4": "^3.0.5" |
61 | } | 62 | } |
62 | } | 63 | } |
63 | 64 |
src/js/controller.js
1 | angular.module('focaBusquedaProductos') | 1 | angular.module('focaBusquedaProductos') |
2 | .controller('modalBusquedaProductosCtrl', | 2 | .controller('modalBusquedaProductosCtrl', |
3 | [ | 3 | [ |
4 | '$timeout', | 4 | '$timeout', |
5 | '$filter', | 5 | '$filter', |
6 | '$scope', | 6 | '$scope', |
7 | '$uibModalInstance', | 7 | '$uibModalInstance', |
8 | 'parametroProducto', | 8 | 'parametroProducto', |
9 | 'focaBusquedaProductosService', | 9 | 'focaBusquedaProductosService', |
10 | function($timeout, $filter, $scope, $uibModalInstance, parametroProducto, | 10 | function ($timeout, $filter, $scope, $uibModalInstance, parametroProducto, |
11 | focaBusquedaProductosService | 11 | focaBusquedaProductosService |
12 | ) { | 12 | ) { |
13 | 13 | ||
14 | $scope.simbolo = parametroProducto.simbolo; | 14 | $scope.simbolo = parametroProducto.simbolo; |
15 | $scope.filters = ''; | 15 | $scope.filters = ''; |
16 | $scope.productos = []; | 16 | $scope.listaProductos = []; |
17 | $scope.todosProductos = []; | ||
17 | $scope.primerBusqueda = false; | 18 | $scope.primerBusqueda = false; |
18 | $scope.searchLoading = false; | 19 | $scope.searchLoading = false; |
19 | // pagination | 20 | $scope.soloMostrar = parametroProducto.soloMostrar; |
21 | $scope.useAllProducts = false; | ||
22 | //#region pagination variables | ||
20 | $scope.numPerPage = 10; | 23 | $scope.numPerPage = 10; |
21 | $scope.currentPage = 1; | 24 | $scope.currentPage = 1; |
22 | $scope.filteredProductos = []; | 25 | $scope.filteredProductos = []; |
23 | $scope.currentPageProductos = []; | 26 | $scope.currentPageProductos = []; |
24 | $scope.selectedProducto = -1; | 27 | $scope.selectedProducto = -1; |
28 | //#endregion | ||
25 | 29 | ||
26 | $scope.soloMostrar = parametroProducto.soloMostrar; | ||
27 | |||
28 | //METODOS | 30 | //METODOS |
29 | $scope.busquedaPress = function(key) { | 31 | $scope.busquedaPress = function (key) { |
30 | if (key === 13) { | 32 | if (key === 13) { |
31 | $scope.searchLoading = true; | 33 | $scope.searchLoading = true; |
32 | if(parametroProducto.idLista > 0) { | 34 | if (parametroProducto.idLista > 0) { |
33 | focaBusquedaProductosService | 35 | focaBusquedaProductosService |
34 | .getProductosByIdLista(parametroProducto.idLista, $scope.filters) | 36 | .getProductosByIdLista(parametroProducto.idLista, $scope.filters) |
35 | .then(llenarDatos); | 37 | .then(function (data) { |
36 | } else if(parametroProducto.idLista === -1) { | 38 | llenarDatos(data); |
37 | focaBusquedaProductosService.getProductos() | 39 | focaBusquedaProductosService.getProductos() |
38 | .then(llenarDatos); | 40 | .then(fillAllProductos); |
41 | }); | ||
39 | } | 42 | } |
40 | } | 43 | } |
41 | }; | 44 | }; |
42 | function llenarDatos(res) { | 45 | function llenarDatos(res) { |
43 | for(var i = 0; i < res.data.length; i++) { | 46 | for (var i = 0; i < res.data.length; i++) { |
44 | res.data[i].precio = res.data[i].precio / parametroProducto.cotizacion; | 47 | res.data[i].precio = res.data[i].precio / parametroProducto.cotizacion; |
48 | } | ||
49 | $scope.searchLoading = false; | ||
50 | $scope.primerBusqueda = true; | ||
51 | $scope.listaProductos = res.data; | ||
52 | $scope.search(true); | ||
53 | primera(); | ||
54 | }; | ||
55 | function fillAllProductos(res) { | ||
56 | for (var i = 0; i < res.data.length; i++) { | ||
57 | var producto = $scope.listaProductos.filter(function(producto) { | ||
58 | return producto.id == res.data[i].id; | ||
59 | })[0]; | ||
60 | |||
61 | if (producto) { | ||
62 | res.data[i].precio = producto.precio; | ||
63 | } | ||
45 | } | 64 | } |
46 | $scope.searchLoading = false; | 65 | $scope.searchLoading = false; |
47 | $scope.primerBusqueda = true; | 66 | $scope.primerBusqueda = true; |
48 | $scope.productos = res.data; | 67 | $scope.todosProductos = res.data; |
49 | $scope.search(true); | 68 | $scope.search(true); |
50 | primera(); | 69 | primera(); |
51 | } | 70 | }; |
52 | $scope.search = function(pressed) { | 71 | $scope.changeProductsData = function () { |
53 | if($scope.productos.length > 0) { | 72 | $scope.useAllProducts = !$scope.useAllProducts; |
73 | $scope.search(false); | ||
74 | primera(); | ||
75 | }; | ||
76 | $scope.search = function (pressed) { | ||
77 | if ($scope.listaProductos.length > 0) { | ||
54 | $scope.filteredProductos = $filter('filter')( | 78 | $scope.filteredProductos = $filter('filter')( |
55 | $scope.productos, | 79 | ($scope.useAllProducts ? $scope.todosProductos : $scope.listaProductos), |
56 | {$: $scope.filters} | 80 | { $: $scope.filters } |
57 | ); | 81 | ); |
58 | 82 | ||
59 | $scope.lastPage = Math.ceil( | 83 | $scope.lastPage = Math.ceil( |
60 | $scope.filteredProductos.length / $scope.numPerPage | 84 | $scope.filteredProductos.length / $scope.numPerPage |
61 | ); | 85 | ); |
62 | 86 | ||
63 | $scope.resetPage(); | 87 | $scope.resetPage(); |
64 | }else if(pressed) { | 88 | } else if (pressed) { |
65 | $timeout(function() { | 89 | $timeout(function () { |
66 | angular.element('#search')[0].focus(); | 90 | angular.element('#search')[0].focus(); |
67 | $scope.filters = ''; | 91 | $scope.filters = ''; |
68 | }); | 92 | }); |
69 | } | 93 | } |
70 | }; | 94 | }; |
71 | 95 | $scope.resetPage = function () { | |
72 | $scope.resetPage = function() { | ||
73 | $scope.currentPage = 1; | 96 | $scope.currentPage = 1; |
74 | $scope.selectPage(1); | 97 | $scope.selectPage(1); |
75 | }; | 98 | }; |
76 | 99 | $scope.selectPage = function (page) { | |
77 | $scope.selectPage = function(page) { | ||
78 | var start = (page - 1) * $scope.numPerPage; | 100 | var start = (page - 1) * $scope.numPerPage; |
79 | var end = start + $scope.numPerPage; | 101 | var end = start + $scope.numPerPage; |
80 | $scope.paginas = []; | 102 | $scope.paginas = []; |
81 | $scope.paginas = calcularPages(page); | 103 | $scope.paginas = calcularPages(page); |
82 | $scope.currentPageProductos = $scope.filteredProductos.slice(start, end); | 104 | $scope.currentPageProductos = $scope.filteredProductos.slice(start, end); |
83 | $scope.currentPage = page; | 105 | $scope.currentPage = page; |
84 | }; | 106 | }; |
85 | 107 | $scope.select = function (producto) { | |
86 | $scope.select = function(producto) { | ||
87 | $uibModalInstance.close(producto); | 108 | $uibModalInstance.close(producto); |
88 | }; | 109 | }; |
89 | 110 | $scope.cancel = function () { | |
90 | $scope.cancel = function() { | ||
91 | $uibModalInstance.dismiss('cancel'); | 111 | $uibModalInstance.dismiss('cancel'); |
92 | }; | 112 | }; |
93 | 113 | $scope.busquedaDown = function (key) { | |
94 | $scope.busquedaDown = function(key) { | ||
95 | if (key === 40) { | 114 | if (key === 40) { |
96 | primera(key); | 115 | primera(key); |
97 | } | 116 | } |
98 | }; | 117 | }; |
99 | 118 | $scope.itemProducto = function (key) { | |
100 | $scope.itemProducto = function(key) { | ||
101 | if (key === 38) { | 119 | if (key === 38) { |
102 | anterior(key); | 120 | anterior(key); |
103 | } | 121 | } |
104 | 122 | ||
105 | if (key === 40) { | 123 | if (key === 40) { |
106 | siguiente(key); | 124 | siguiente(key); |
107 | } | 125 | } |
108 | 126 | ||
109 | if (key === 37) { | 127 | if (key === 37) { |
110 | retrocederPagina(); | 128 | retrocederPagina(); |
111 | } | 129 | } |
112 | 130 | ||
113 | if (key === 39) { | 131 | if (key === 39) { |
114 | avanzarPagina(); | 132 | avanzarPagina(); |
115 | } | 133 | } |
116 | }; | 134 | }; |
117 | 135 | ||
136 | //#region Paginador | ||
118 | function calcularPages(paginaActual) { | 137 | function calcularPages(paginaActual) { |
119 | var paginas = []; | 138 | var paginas = []; |
120 | paginas.push(paginaActual); | 139 | paginas.push(paginaActual); |
121 | 140 | ||
122 | if (paginaActual - 1 > 1) { | 141 | if (paginaActual - 1 > 1) { |
123 | 142 | ||
124 | paginas.unshift(paginaActual - 1); | 143 | paginas.unshift(paginaActual - 1); |
125 | if (paginaActual - 2 > 1) { | 144 | if (paginaActual - 2 > 1) { |
126 | paginas.unshift(paginaActual - 2); | 145 | paginas.unshift(paginaActual - 2); |
127 | } | 146 | } |
128 | } | 147 | } |
129 | 148 | ||
130 | if (paginaActual + 1 < $scope.lastPage) { | 149 | if (paginaActual + 1 < $scope.lastPage) { |
131 | paginas.push(paginaActual + 1); | 150 | paginas.push(paginaActual + 1); |
132 | if (paginaActual + 2 < $scope.lastPage) { | 151 | if (paginaActual + 2 < $scope.lastPage) { |
133 | paginas.push(paginaActual + 2); | 152 | paginas.push(paginaActual + 2); |
134 | } | 153 | } |
135 | } | 154 | } |
136 | 155 | ||
137 | if (paginaActual !== 1) { | 156 | if (paginaActual !== 1) { |
138 | paginas.unshift(1); | 157 | paginas.unshift(1); |
139 | } | 158 | } |
140 | 159 | ||
141 | if (paginaActual !== $scope.lastPage) { | 160 | if (paginaActual !== $scope.lastPage) { |
142 | paginas.push($scope.lastPage); | 161 | paginas.push($scope.lastPage); |
143 | } | 162 | } |
144 | 163 | ||
145 | return paginas; | 164 | return paginas; |
146 | } | 165 | }; |
147 | |||
148 | function primera() { | 166 | function primera() { |
149 | $scope.selectedProducto = 0; | 167 | $scope.selectedProducto = 0; |
150 | } | 168 | }; |
151 | |||
152 | function anterior() { | 169 | function anterior() { |
153 | if ($scope.selectedProducto === 0 && $scope.currentPage > 1) { | 170 | if ($scope.selectedProducto === 0 && $scope.currentPage > 1) { |
154 | retrocederPagina(); | 171 | retrocederPagina(); |
155 | } else { | 172 | } else { |
156 | $scope.selectedProducto--; | 173 | $scope.selectedProducto--; |
157 | } | 174 | } |
158 | } | 175 | }; |
159 | |||
160 | function siguiente() { | 176 | function siguiente() { |
161 | if ($scope.selectedProducto < $scope.currentPageProductos.length - 1 ) { | 177 | if ($scope.selectedProducto < $scope.currentPageProductos.length - 1) { |
162 | $scope.selectedProducto++; | 178 | $scope.selectedProducto++; |
163 | } else { | 179 | } else { |
164 | avanzarPagina(); | 180 | avanzarPagina(); |
165 | } | 181 | } |
166 | } | 182 | }; |
167 | |||
168 | function retrocederPagina() { | 183 | function retrocederPagina() { |
169 | if ($scope.currentPage > 1) { | 184 | if ($scope.currentPage > 1) { |
170 | $scope.selectPage($scope.currentPage - 1); | 185 | $scope.selectPage($scope.currentPage - 1); |
171 | $scope.selectedProducto = $scope.numPerPage - 1; | 186 | $scope.selectedProducto = $scope.numPerPage - 1; |
172 | } | 187 | } |
173 | } | 188 | }; |
174 |
src/js/service.js
1 | angular.module('focaBusquedaProductos') | 1 | angular.module('focaBusquedaProductos') |
2 | .service('focaBusquedaProductosService', [ | 2 | .service('focaBusquedaProductosService', [ |
3 | '$http', | 3 | '$http', |
4 | 'API_ENDPOINT', | 4 | 'API_ENDPOINT', |
5 | function($http, API_ENDPOINT) { | 5 | function ($http, API_ENDPOINT) { |
6 | return { | 6 | return { |
7 | getProductos: function() { | 7 | getProductos: function () { |
8 | return $http.get(API_ENDPOINT.URL + '/articulos'); | 8 | return $http.get(API_ENDPOINT.URL + '/articulos'); |
9 | }, | 9 | }, |
10 | getProductosByIdLista: function(id, filters) { | 10 | getProductosByIdLista: function (id, filters) { |
11 | return $http.post(API_ENDPOINT.URL + '/articulos/lista', | 11 | return $http.post(API_ENDPOINT.URL + '/articulos/lista', |
12 | {filters: filters, id: id}); | 12 | { filters: filters, id: id }); |
13 | } | 13 | } |
14 | }; | 14 | }; |
15 | } | 15 | } |
16 | ]); | 16 | ]); |
17 | 17 |
src/views/modal-busqueda-productos.html
1 | <div class="modal-header py-1"> | 1 | <div class="modal-header py-1"> |
2 | <div class="row w-100"> | 2 | <div class="row w-100"> |
3 | <div class="col-lg-6"> | 3 | <div class="col-lg-6"> |
4 | <h5 class="modal-title my-1">Búsqueda de Productos</h5> | 4 | <h5 class="modal-title my-1">Búsqueda de Productos</h5> |
5 | </div> | 5 | </div> |
6 | <div class="input-group col-lg-6 pr-0 my-2"> | 6 | <div class="input-group col-lg-6 pr-0 my-2"> |
7 | <input | 7 | <input |
8 | ladda="searchLoading" | 8 | ladda="searchLoading" |
9 | type="text" | 9 | type="text" |
10 | class="form-control form-control-sm" | 10 | class="form-control form-control-sm" |
11 | id="search" | 11 | id="search" |
12 | placeholder="Busqueda" | 12 | placeholder="Busqueda" |
13 | ng-model="filters" | 13 | ng-model="filters" |
14 | ng-change="search()" | 14 | ng-change="search()" |
15 | ng-keydown="busquedaDown($event.keyCode)" | 15 | ng-keydown="busquedaDown($event.keyCode)" |
16 | ng-keypress="busquedaPress($event.keyCode)" | 16 | ng-keypress="busquedaPress($event.keyCode)" |
17 | foca-focus="selectedProducto == -1" | 17 | foca-focus="selectedProducto == -1" |
18 | ng-focus="selectedProducto = -1" | 18 | ng-focus="selectedProducto = -1" |
19 | teclado-virtual | 19 | teclado-virtual |
20 | > | 20 | > |
21 | <div class="input-group-append"> | 21 | <div class="input-group-append"> |
22 | <button | 22 | <button |
23 | ladda="searchLoading" | 23 | ladda="searchLoading" |
24 | data-spinner-color="#FF0000" | 24 | data-spinner-color="#FF0000" |
25 | class="btn btn-outline-secondary" | 25 | class="btn btn-outline-secondary" |
26 | type="button" | 26 | type="button" |
27 | title="Buscar" | 27 | title="Buscar" |
28 | ng-click="busquedaPress(13)" | 28 | ng-click="busquedaPress(13)" |
29 | > | 29 | > |
30 | <i class="fa fa-search" aria-hidden="true"></i> | 30 | <i class="fa fa-search" aria-hidden="true"></i> |
31 | </button> | 31 | </button> |
32 | </div> | 32 | </div> |
33 | </div> | 33 | </div> |
34 | </div> | 34 | </div> |
35 | <div class="row"> | ||
36 | <div class="col my-1 d-flex justify-content-end"> | ||
37 | <div class="custom-control custom-checkbox mt-auto"> | ||
38 | <input type="checkbox" class="custom-control-input" id="check" ng-click="changeProductsData()"> | ||
39 | <label class="custom-control-label disable-selection" for="check"> | ||
40 | Buscar en todos los artículos disponibles | ||
41 | </label> | ||
42 | </div> | ||
43 | </div> | ||
44 | </div> | ||
35 | </div> | 45 | </div> |
36 | <div class="modal-body" id="modal-body"> | 46 | <div class="modal-body" id="modal-body"> |
37 | 47 | ||
38 | <div ng-show="!primerBusqueda"> | 48 | <div ng-show="!primerBusqueda"> |
39 | Debe realizar una primer búsqueda. | 49 | Debe realizar una primer búsqueda. |
40 | </div> | 50 | </div> |
41 | 51 | ||
42 | <table ng-show="primerBusqueda" class="table table-striped table-sm"> | 52 | <table ng-show="primerBusqueda" class="table table-striped table-sm"> |
43 | <thead> | 53 | <thead> |
44 | <tr> | 54 | <tr> |
45 | <th ng-hide="soloMostrar">Código</th> | 55 | <th ng-hide="soloMostrar">Código</th> |
46 | <th>Descripción</th> | 56 | <th>Descripción</th> |
47 | <th class="text-right">P. Base</th> | 57 | <th class="text-right">P. Lista</th> |
58 | <th class="text-right" ng-show="useAllProducts">P. Base</th> | ||
48 | <th ng-hide="soloMostrar"></th> | 59 | <th ng-hide="soloMostrar"></th> |
49 | </tr> | 60 | </tr> |
50 | </thead> | 61 | </thead> |
51 | <tbody> | 62 | <tbody> |
52 | <tr ng-show="currentPageProductos.length == 0 && primerBusqueda"> | 63 | <tr ng-show="currentPageProductos.length == 0 && primerBusqueda"> |
53 | <td colspan="5"> | 64 | <td colspan="5"> |
54 | No se encontraron resultados. | 65 | No se encontraron resultados. |
55 | </td> | 66 | </td> |
56 | </tr> | 67 | </tr> |
57 | <tr class="selectable" | 68 | <tr class="selectable" |
58 | ng-repeat="(key,producto) in currentPageProductos" | 69 | ng-repeat="(key,producto) in currentPageProductos" |
59 | ng-click="select(producto)"> | 70 | ng-click="select(producto)"> |
60 | <td ng-bind="producto.sector + '-' + producto.codigo" | 71 | <td ng-bind="producto.sector + '-' + producto.codigo" |
61 | ng-hide="soloMostrar"></td> | 72 | ng-hide="soloMostrar"></td> |
62 | <td ng-bind="producto.descripcion"></td> | 73 | <td ng-bind="producto.descripcion"></td> |
63 | <td class="text-right" ng-bind="producto.precio | number: 2"></td> | 74 | <td class="text-right">{{producto.precioBase == producto.precio ? '' : producto.precio}}</td> |
75 | <td class="text-right" ng-bind="producto.precioBase | number: 2" ng-show="useAllProducts"></td> | ||
64 | <td class="d-md-none text-primary"> | 76 | <td class="d-md-none text-primary"> |
65 | <i class="fa fa-circle-thin" aria-hidden="true"></i> | 77 | <i class="fa fa-circle-thin" aria-hidden="true"></i> |
66 | </td> | 78 | </td> |
67 | <td class="d-none d-md-table-cell"> | 79 | <td class="d-none d-md-table-cell"> |
68 | <button | 80 | <button |
69 | type="button" | 81 | type="button" |
70 | class="btn btn-xs p-1 float-right" | 82 | class="btn btn-xs p-1 float-right" |
71 | title="Seleccionar" | 83 | title="Seleccionar" |
72 | ng-class="{ | 84 | ng-class="{ |
73 | 'btn-secondary': selectedProducto != key, | 85 | 'btn-secondary': selectedProducto != key, |
74 | 'btn-primary': selectedProducto == key | 86 | 'btn-primary': selectedProducto == key |
75 | }" | 87 | }" |
76 | foca-focus="selectedProducto == {{key}}" | 88 | foca-focus="selectedProducto == {{key}}" |
77 | ng-keydown="itemProducto($event.keyCode)" | 89 | ng-keydown="itemProducto($event.keyCode)" |
78 | ng-hide="soloMostrar"> | 90 | ng-hide="soloMostrar"> |
79 | <i class="fa fa-circle-thin" aria-hidden="true"></i> | 91 | <i class="fa fa-circle-thin" aria-hidden="true"></i> |
80 | </button> | 92 | </button> |
81 | </td> | 93 | </td> |
82 | </tr> | 94 | </tr> |
83 | </tbody> | 95 | </tbody> |
84 | </table> | 96 | </table> |
85 | 97 | ||
86 | </div> | 98 | </div> |
87 | <div class="modal-footer py-1"> | 99 | <div class="modal-footer py-1"> |
88 | <nav ng-show="currentPageProductos.length > 0 && primerBusqueda" class="mr-auto"> | 100 | <nav ng-show="currentPageProductos.length > 0 && primerBusqueda" class="mr-auto"> |
89 | <ul class="pagination pagination-sm justify-content mb-0"> | 101 | <ul class="pagination pagination-sm justify-content mb-0"> |
90 | <li class="page-item" ng-class="{'disabled': currentPage == 1}"> | 102 | <li class="page-item" ng-class="{'disabled': currentPage == 1}"> |
91 | <a class="page-link" href="javascript:void();" ng-click="selectPage(currentPage - 1)"> | 103 | <a class="page-link" href="javascript:void();" ng-click="selectPage(currentPage - 1)"> |
92 | <span aria-hidden="true">«</span> | 104 | <span aria-hidden="true">«</span> |
93 | <span class="sr-only">Anterior</span> | 105 | <span class="sr-only">Anterior</span> |
94 | </a> | 106 | </a> |
95 | </li> | 107 | </li> |
96 | <li | 108 | <li |
97 | class="page-item" | 109 | class="page-item" |
98 | ng-repeat="pagina in paginas" | 110 | ng-repeat="pagina in paginas" |
99 | ng-class="{'active': pagina == currentPage}" | 111 | ng-class="{'active': pagina == currentPage}" |
100 | > | 112 | > |
101 | <a | 113 | <a |
102 | class="page-link" | 114 | class="page-link" |
103 | href="javascript:void();" | 115 | href="javascript:void();" |
104 | ng-click="selectPage(pagina)" | 116 | ng-click="selectPage(pagina)" |
105 | ng-bind="pagina" | 117 | ng-bind="pagina" |
106 | ></a> | 118 | ></a> |
107 | </li> | 119 | </li> |
108 | <li class="page-item" ng-class="{'disabled': currentPage == lastPage}"> | 120 | <li class="page-item" ng-class="{'disabled': currentPage == lastPage}"> |
109 | <a class="page-link" href="javascript:void();" ng-click="selectPage(currentPage + 1)"> | 121 | <a class="page-link" href="javascript:void();" ng-click="selectPage(currentPage + 1)"> |
110 | <span aria-hidden="true">»</span> | 122 | <span aria-hidden="true">»</span> |
111 | <span class="sr-only">Siguiente</span> | 123 | <span class="sr-only">Siguiente</span> |
112 | </a> | 124 | </a> |
113 | </li> | 125 | </li> |
114 | </ul> | 126 | </ul> |
115 | </nav> | 127 | </nav> |
116 | <button class="btn btn-sm btn-secondary my-1" type="button" ng-click="cancel()">Cancelar</button> | 128 | <button class="btn btn-sm btn-secondary my-1" type="button" ng-click="cancel()">Volver</button> |
117 | </div> | 129 | </div> |
118 | 130 |