Commit 3b404e5734e8a0e09b0678a5ef4928ba3868323d
1 parent
d9a8ec7d1e
Exists in
master
ver detalles boton
Showing
4 changed files
with
40 additions
and
6 deletions
Show diff stats
gulpfile.js
| 1 | const templateCache = require('gulp-angular-templatecache'); | 1 | const templateCache = require('gulp-angular-templatecache'); |
| 2 | const concat = require('gulp-concat'); | 2 | const concat = require('gulp-concat'); |
| 3 | const htmlmin = require('gulp-htmlmin'); | 3 | const htmlmin = require('gulp-htmlmin'); |
| 4 | const rename = require('gulp-rename'); | 4 | const rename = require('gulp-rename'); |
| 5 | const uglify = require('gulp-uglify'); | 5 | const uglify = require('gulp-uglify'); |
| 6 | const gulp = require('gulp'); | 6 | const gulp = require('gulp'); |
| 7 | const pump = require('pump'); | 7 | const pump = require('pump'); |
| 8 | const jshint = require('gulp-jshint'); | 8 | const jshint = require('gulp-jshint'); |
| 9 | const replace = require('gulp-replace'); | 9 | const replace = require('gulp-replace'); |
| 10 | const connect = require('gulp-connect'); | 10 | const connect = require('gulp-connect'); |
| 11 | const clean = require('gulp-clean'); | 11 | const clean = require('gulp-clean'); |
| 12 | 12 | ||
| 13 | var paths = { | 13 | var paths = { |
| 14 | srcJS: 'src/js/*.js', | 14 | srcJS: 'src/js/*.js', |
| 15 | srcViews: 'src/views/*.html', | 15 | srcViews: 'src/views/*.html', |
| 16 | tmp: 'tmp', | 16 | tmp: 'tmp', |
| 17 | dist: 'dist/' | 17 | dist: 'dist/' |
| 18 | }; | 18 | }; |
| 19 | 19 | ||
| 20 | gulp.task('clean', function() { | 20 | gulp.task('clean', function() { |
| 21 | return gulp.src(['tmp', 'dist'], {read: false}) | 21 | return gulp.src(['tmp', 'dist'], {read: false}) |
| 22 | .pipe(clean()); | 22 | .pipe(clean()); |
| 23 | }); | 23 | }); |
| 24 | 24 | ||
| 25 | gulp.task('templates', ['clean'], function() { | 25 | gulp.task('templates', ['clean'], function() { |
| 26 | return pump( | 26 | return pump( |
| 27 | [ | 27 | [ |
| 28 | gulp.src(paths.srcViews), | 28 | gulp.src(paths.srcViews), |
| 29 | htmlmin(), | 29 | htmlmin(), |
| 30 | templateCache('views.js', { | 30 | templateCache('views.js', { |
| 31 | module: 'focaModalFactura', | 31 | module: 'focaModalFactura', |
| 32 | root: '' | 32 | root: '' |
| 33 | }), | 33 | }), |
| 34 | gulp.dest(paths.tmp) | 34 | gulp.dest(paths.tmp) |
| 35 | ] | 35 | ] |
| 36 | ); | 36 | ); |
| 37 | }); | 37 | }); |
| 38 | 38 | ||
| 39 | gulp.task('uglify', ['templates'], function() { | 39 | gulp.task('uglify', ['templates'], function() { |
| 40 | return pump( | 40 | return pump( |
| 41 | [ | 41 | [ |
| 42 | gulp.src([ | 42 | gulp.src([ |
| 43 | paths.srcJS, | 43 | paths.srcJS, |
| 44 | 'tmp/views.js' | 44 | 'tmp/views.js' |
| 45 | ]), | 45 | ]), |
| 46 | concat('foca-modal-factura.js'), | 46 | concat('foca-modal-factura.js'), |
| 47 | replace('src/views/', ''), | 47 | replace('src/views/', ''), |
| 48 | replace("['ui.bootstrap', 'focaDirectivas', 'angular-ladda']", '[]'), | 48 | replace("['ui.bootstrap', 'focaDirectivas', 'angular-ladda', 'focaModal']", '[]'), |
| 49 | gulp.dest(paths.tmp), | 49 | gulp.dest(paths.tmp), |
| 50 | rename('foca-modal-factura.min.js'), | 50 | rename('foca-modal-factura.min.js'), |
| 51 | uglify(), | 51 | uglify(), |
| 52 | gulp.dest(paths.dist) | 52 | gulp.dest(paths.dist) |
| 53 | ] | 53 | ] |
| 54 | ); | 54 | ); |
| 55 | }); | 55 | }); |
| 56 | 56 | ||
| 57 | gulp.task('pre-commit', function() { | 57 | gulp.task('pre-commit', function() { |
| 58 | return pump( | 58 | return pump( |
| 59 | [ | 59 | [ |
| 60 | gulp.src(paths.srcJS), | 60 | gulp.src(paths.srcJS), |
| 61 | jshint('.jshintrc'), | 61 | jshint('.jshintrc'), |
| 62 | jshint.reporter('default'), | 62 | jshint.reporter('default'), |
| 63 | jshint.reporter('fail') | 63 | jshint.reporter('fail') |
| 64 | ] | 64 | ] |
| 65 | ); | 65 | ); |
| 66 | 66 | ||
| 67 | gulp.start('uglify'); | 67 | gulp.start('uglify'); |
| 68 | }); | 68 | }); |
| 69 | 69 | ||
| 70 | gulp.task('webserver', function() { | 70 | gulp.task('webserver', function() { |
| 71 | pump [ | 71 | pump [ |
| 72 | connect.server({port: 3000}) | 72 | connect.server({port: 3000}) |
| 73 | ] | 73 | ] |
| 74 | }); | 74 | }); |
| 75 | 75 | ||
| 76 | gulp.task('clean-post-install', function() { | 76 | gulp.task('clean-post-install', function() { |
| 77 | return gulp.src(['src', 'tmp', '.jshintrc','readme.md', '.gitignore', 'gulpfile.js', | 77 | return gulp.src(['src', 'tmp', '.jshintrc','readme.md', '.gitignore', 'gulpfile.js', |
| 78 | 'index.html'], {read: false}) | 78 | 'index.html'], {read: false}) |
| 79 | .pipe(clean()); | 79 | .pipe(clean()); |
| 80 | }); | 80 | }); |
| 81 | 81 | ||
| 82 | gulp.task('default', ['webserver']); | 82 | gulp.task('default', ['webserver']); |
| 83 | 83 | ||
| 84 | gulp.task('watch', function() { | 84 | gulp.task('watch', function() { |
| 85 | gulp.watch([paths.srcJS, paths.srcViews], ['uglify']) | 85 | gulp.watch([paths.srcJS, paths.srcViews], ['uglify']) |
| 86 | }); | 86 | }); |
| 87 | 87 | ||
| 88 | gulp.task('copy', ['uglify'], function() { | 88 | gulp.task('copy', ['uglify'], function() { |
| 89 | gulp.src('dist/*.js') | 89 | gulp.src('dist/*.js') |
| 90 | .pipe(gulp.dest('../../wrapper-demo/node_modules/foca-modal-nota-pedido/dist')); | 90 | .pipe(gulp.dest('../../wrapper-demo/node_modules/foca-modal-nota-pedido/dist')); |
| 91 | }); | 91 | }); |
| 92 | 92 | ||
| 93 | gulp.task('watchAndCopy', function() { | 93 | gulp.task('watchAndCopy', function() { |
| 94 | return gulp.watch([paths.srcJS, paths.srcViews], ['copy']); | 94 | return gulp.watch([paths.srcJS, paths.srcViews], ['copy']); |
| 95 | }); | 95 | }); |
| 96 | 96 |
src/js/app.js
| 1 | angular.module('focaModalFactura', ['ui.bootstrap', 'focaDirectivas', 'angular-ladda']); | 1 | angular.module('focaModalFactura', ['ui.bootstrap', 'focaDirectivas', 'angular-ladda', 'focaModal']); |
| 2 | 2 |
src/js/controller.js
| 1 | angular.module('focaModalFactura') | 1 | angular.module('focaModalFactura') |
| 2 | .controller('focaModalFacturaController', | 2 | .controller('focaModalFacturaController', |
| 3 | [ | 3 | [ |
| 4 | '$filter', | 4 | '$filter', |
| 5 | '$scope', | 5 | '$scope', |
| 6 | '$uibModalInstance', | 6 | '$uibModalInstance', |
| 7 | 'focaModalFacturaService', | 7 | 'focaModalFacturaService', |
| 8 | 'parametrosFactura', | 8 | 'parametrosFactura', |
| 9 | '$uibModal', | ||
| 9 | function($filter, $scope, $uibModalInstance, | 10 | function($filter, $scope, $uibModalInstance, |
| 10 | focaModalFacturaService, parametrosFactura | 11 | focaModalFacturaService, parametrosFactura, $uibModal |
| 11 | ) { | 12 | ) { |
| 12 | var fecha = new Date(); | 13 | var fecha = new Date(); |
| 13 | $scope.fechaHasta = new Date(); | 14 | $scope.fechaHasta = new Date(); |
| 14 | $scope.fechaDesde = new Date(fecha.setMonth(fecha.getMonth() - 1)); | 15 | $scope.fechaDesde = new Date(fecha.setMonth(fecha.getMonth() - 1)); |
| 15 | $scope.filters = ''; | 16 | $scope.filters = ''; |
| 16 | $scope.facturas = []; | 17 | $scope.facturas = []; |
| 17 | $scope.primerBusqueda = false; | 18 | $scope.primerBusqueda = false; |
| 18 | $scope.searchLoading = false; | 19 | $scope.searchLoading = false; |
| 19 | $scope.parametrosFactura = parametrosFactura; | 20 | $scope.parametrosFactura = parametrosFactura; |
| 20 | // pagination | 21 | // pagination |
| 21 | $scope.numPerPage = 10; | 22 | $scope.numPerPage = 10; |
| 22 | $scope.currentPage = 1; | 23 | $scope.currentPage = 1; |
| 23 | $scope.filteredFacturas = []; | 24 | $scope.filteredFacturas = []; |
| 24 | $scope.currentPageFacturas = []; | 25 | $scope.currentPageFacturas = []; |
| 25 | $scope.selectedFactura = -1; | 26 | $scope.selectedFactura = -1; |
| 26 | 27 | ||
| 27 | //METODOS | 28 | //METODOS |
| 28 | $scope.busquedaPress = function(key) { | 29 | $scope.busquedaPress = function(key) { |
| 29 | if (key === 13) { | 30 | if (key === 13) { |
| 30 | //TODO Validaciones con alertas | 31 | //TODO Validaciones con alertas |
| 31 | if(!$scope.fechaDesde) { | 32 | if(!$scope.fechaDesde) { |
| 32 | alert('INGRESE FECHA DESDE'); | 33 | alert('INGRESE FECHA DESDE'); |
| 33 | return; | 34 | return; |
| 34 | } | 35 | } |
| 35 | if(!$scope.fechaHasta) { | 36 | if(!$scope.fechaHasta) { |
| 36 | alert('INGRESE FECHA HASTA'); | 37 | alert('INGRESE FECHA HASTA'); |
| 37 | return; | 38 | return; |
| 38 | } | 39 | } |
| 39 | if($scope.fechaDesde > $scope.fechaHasta) { | 40 | if($scope.fechaDesde > $scope.fechaHasta) { |
| 40 | alert('La fecha desde no puede ser mayor a la fecha hasta'); | 41 | alert('La fecha desde no puede ser mayor a la fecha hasta'); |
| 41 | return; | 42 | return; |
| 42 | } | 43 | } |
| 43 | $scope.searchLoading = true; | 44 | $scope.searchLoading = true; |
| 44 | //TODO hacer filtro de fecha | 45 | //TODO hacer filtro de fecha |
| 45 | focaModalFacturaService | 46 | focaModalFacturaService |
| 46 | .getFacturasByIdCliente( | 47 | .getFacturasByIdCliente( |
| 47 | parametrosFactura.cliente, | 48 | parametrosFactura.cliente.COD, |
| 48 | parametrosFactura.moneda, | 49 | parametrosFactura.moneda, |
| 49 | '2001-01-01', | 50 | '2001-01-01', |
| 50 | '2100-12-31' | 51 | '2100-12-31' |
| 51 | ) | 52 | ) |
| 52 | .then(llenarDatos); | 53 | .then(llenarDatos); |
| 53 | } | 54 | } |
| 54 | }; | 55 | }; |
| 55 | 56 | ||
| 56 | $scope.aceptar = function() { | 57 | $scope.aceptar = function() { |
| 57 | var result = $scope.facturas.filter(function(a) {return a.checked === true;}); | 58 | var result = $scope.facturas.filter(function(a) {return a.checked === true;}); |
| 58 | $uibModalInstance.close(result); | 59 | $uibModalInstance.close(result); |
| 59 | }; | 60 | }; |
| 60 | 61 | ||
| 61 | $scope.tieneAlMenosUno = function() { | 62 | $scope.tieneAlMenosUno = function() { |
| 62 | var result = $scope.facturas.filter(function(a) {return a.checked === true;}); | 63 | var result = $scope.facturas.filter(function(a) {return a.checked === true;}); |
| 63 | return !result.length; | 64 | return !result.length; |
| 64 | }; | 65 | }; |
| 65 | 66 | ||
| 66 | function llenarDatos(res) { | 67 | function llenarDatos(res) { |
| 67 | $scope.facturas = []; | 68 | $scope.facturas = []; |
| 68 | $scope.filteredFacturas = []; | 69 | $scope.filteredFacturas = []; |
| 69 | $scope.currentPageFacturas = []; | 70 | $scope.currentPageFacturas = []; |
| 70 | $scope.selectedFactura = -1; | 71 | $scope.selectedFactura = -1; |
| 71 | $scope.searchLoading = false; | 72 | $scope.searchLoading = false; |
| 72 | $scope.primerBusqueda = true; | 73 | $scope.primerBusqueda = true; |
| 73 | $scope.facturas = calcularSaldos(res.data); | 74 | $scope.facturas = calcularSaldos(res.data); |
| 74 | $scope.search(); | 75 | $scope.search(); |
| 75 | primera(); | 76 | primera(); |
| 76 | } | 77 | } |
| 78 | |||
| 79 | $scope.verFactura = function(factura) { | ||
| 80 | var modalInstance = $uibModal.open( | ||
| 81 | { | ||
| 82 | ariaLabelledBy: 'Detalle de factura', | ||
| 83 | templateUrl: 'foca-modal-factura-detalle.html', | ||
| 84 | controller: 'focaModalFacturaDetalleController', | ||
| 85 | size: 'md', | ||
| 86 | resolve: { | ||
| 87 | factura: factura, | ||
| 88 | cliente: parametrosFactura.cliente | ||
| 89 | } | ||
| 90 | } | ||
| 91 | ); | ||
| 92 | modalInstance.result.then(); | ||
| 93 | }; | ||
| 94 | |||
| 77 | $scope.search = function() { | 95 | $scope.search = function() { |
| 78 | if($scope.facturas.length > 0) { | 96 | if($scope.facturas.length > 0) { |
| 79 | $scope.filteredFacturas = $filter('filter')( | 97 | $scope.filteredFacturas = $filter('filter')( |
| 80 | $scope.facturas, | 98 | $scope.facturas, |
| 81 | {$: $scope.filters} | 99 | {$: $scope.filters} |
| 82 | ); | 100 | ); |
| 83 | 101 | ||
| 84 | $scope.lastPage = Math.ceil( | 102 | $scope.lastPage = Math.ceil( |
| 85 | $scope.filteredFacturas.length / $scope.numPerPage | 103 | $scope.filteredFacturas.length / $scope.numPerPage |
| 86 | ); | 104 | ); |
| 87 | 105 | ||
| 88 | $scope.resetPage(); | 106 | $scope.resetPage(); |
| 89 | } | 107 | } |
| 90 | }; | 108 | }; |
| 91 | 109 | ||
| 92 | $scope.resetPage = function() { | 110 | $scope.resetPage = function() { |
| 93 | $scope.currentPage = 1; | 111 | $scope.currentPage = 1; |
| 94 | $scope.selectPage(1); | 112 | $scope.selectPage(1); |
| 95 | }; | 113 | }; |
| 96 | 114 | ||
| 97 | $scope.selectPage = function(page) { | 115 | $scope.selectPage = function(page) { |
| 98 | var start = (page - 1) * $scope.numPerPage; | 116 | var start = (page - 1) * $scope.numPerPage; |
| 99 | var end = start + $scope.numPerPage; | 117 | var end = start + $scope.numPerPage; |
| 100 | $scope.paginas = []; | 118 | $scope.paginas = []; |
| 101 | $scope.paginas = calcularPages(page); | 119 | $scope.paginas = calcularPages(page); |
| 102 | $scope.currentPageFacturas = $scope.filteredFacturas.slice(start, end); | 120 | $scope.currentPageFacturas = $scope.filteredFacturas.slice(start, end); |
| 103 | $scope.currentPage = page; | 121 | $scope.currentPage = page; |
| 104 | }; | 122 | }; |
| 105 | 123 | ||
| 106 | $scope.cancel = function() { | 124 | $scope.cancel = function() { |
| 107 | $uibModalInstance.dismiss('cancel'); | 125 | $uibModalInstance.dismiss('cancel'); |
| 108 | }; | 126 | }; |
| 109 | 127 | ||
| 110 | $scope.busquedaDown = function(key) { | 128 | $scope.busquedaDown = function(key) { |
| 111 | if (key === 40) { | 129 | if (key === 40) { |
| 112 | primera(key); | 130 | primera(key); |
| 113 | } | 131 | } |
| 114 | }; | 132 | }; |
| 115 | 133 | ||
| 116 | $scope.itemFactura = function(key) { | 134 | $scope.itemFactura = function(key) { |
| 117 | if (key === 38) { | 135 | if (key === 38) { |
| 118 | anterior(key); | 136 | anterior(key); |
| 119 | } | 137 | } |
| 120 | 138 | ||
| 121 | if (key === 40) { | 139 | if (key === 40) { |
| 122 | siguiente(key); | 140 | siguiente(key); |
| 123 | } | 141 | } |
| 124 | 142 | ||
| 125 | if (key === 37) { | 143 | if (key === 37) { |
| 126 | retrocederPagina(); | 144 | retrocederPagina(); |
| 127 | } | 145 | } |
| 128 | 146 | ||
| 129 | if (key === 39) { | 147 | if (key === 39) { |
| 130 | avanzarPagina(); | 148 | avanzarPagina(); |
| 131 | } | 149 | } |
| 132 | }; | 150 | }; |
| 133 | 151 | ||
| 134 | function calcularPages(paginaActual) { | 152 | function calcularPages(paginaActual) { |
| 135 | var paginas = []; | 153 | var paginas = []; |
| 136 | paginas.push(paginaActual); | 154 | paginas.push(paginaActual); |
| 137 | 155 | ||
| 138 | if (paginaActual - 1 > 1) { | 156 | if (paginaActual - 1 > 1) { |
| 139 | 157 | ||
| 140 | paginas.unshift(paginaActual - 1); | 158 | paginas.unshift(paginaActual - 1); |
| 141 | if (paginaActual - 2 > 1) { | 159 | if (paginaActual - 2 > 1) { |
| 142 | paginas.unshift(paginaActual - 2); | 160 | paginas.unshift(paginaActual - 2); |
| 143 | } | 161 | } |
| 144 | } | 162 | } |
| 145 | 163 | ||
| 146 | if (paginaActual + 1 < $scope.lastPage) { | 164 | if (paginaActual + 1 < $scope.lastPage) { |
| 147 | paginas.push(paginaActual + 1); | 165 | paginas.push(paginaActual + 1); |
| 148 | if (paginaActual + 2 < $scope.lastPage) { | 166 | if (paginaActual + 2 < $scope.lastPage) { |
| 149 | paginas.push(paginaActual + 2); | 167 | paginas.push(paginaActual + 2); |
| 150 | } | 168 | } |
| 151 | } | 169 | } |
| 152 | 170 | ||
| 153 | if (paginaActual !== 1) { | 171 | if (paginaActual !== 1) { |
| 154 | paginas.unshift(1); | 172 | paginas.unshift(1); |
| 155 | } | 173 | } |
| 156 | 174 | ||
| 157 | if (paginaActual !== $scope.lastPage) { | 175 | if (paginaActual !== $scope.lastPage) { |
| 158 | paginas.push($scope.lastPage); | 176 | paginas.push($scope.lastPage); |
| 159 | } | 177 | } |
| 160 | 178 | ||
| 161 | return paginas; | 179 | return paginas; |
| 162 | } | 180 | } |
| 163 | 181 | ||
| 164 | function primera() { | 182 | function primera() { |
| 165 | $scope.selectedFactura = 0; | 183 | $scope.selectedFactura = 0; |
| 166 | } | 184 | } |
| 167 | 185 | ||
| 168 | function anterior() { | 186 | function anterior() { |
| 169 | if ($scope.selectedFactura === 0 && $scope.currentPage > 1) { | 187 | if ($scope.selectedFactura === 0 && $scope.currentPage > 1) { |
| 170 | retrocederPagina(); | 188 | retrocederPagina(); |
| 171 | } else { | 189 | } else { |
| 172 | $scope.selectedFactura--; | 190 | $scope.selectedFactura--; |
| 173 | } | 191 | } |
| 174 | } | 192 | } |
| 175 | 193 | ||
| 176 | function siguiente() { | 194 | function siguiente() { |
| 177 | if ($scope.selectedFactura < $scope.currentPageFacturas.length - 1 ) { | 195 | if ($scope.selectedFactura < $scope.currentPageFacturas.length - 1 ) { |
| 178 | $scope.selectedFactura++; | 196 | $scope.selectedFactura++; |
| 179 | } else { | 197 | } else { |
| 180 | avanzarPagina(); | 198 | avanzarPagina(); |
| 181 | } | 199 | } |
| 182 | } | 200 | } |
| 183 | 201 | ||
| 184 | function retrocederPagina() { | 202 | function retrocederPagina() { |
| 185 | if ($scope.currentPage > 1) { | 203 | if ($scope.currentPage > 1) { |
| 186 | $scope.selectPage($scope.currentPage - 1); | 204 | $scope.selectPage($scope.currentPage - 1); |
| 187 | $scope.selectedFactura = $scope.numPerPage - 1; | 205 | $scope.selectedFactura = $scope.numPerPage - 1; |
| 188 | } | 206 | } |
| 189 | } | 207 | } |
| 190 | 208 | ||
| 191 | function avanzarPagina() { | 209 | function avanzarPagina() { |
| 192 | if ($scope.currentPage < $scope.lastPage) { | 210 | if ($scope.currentPage < $scope.lastPage) { |
| 193 | $scope.selectPage($scope.currentPage + 1); | 211 | $scope.selectPage($scope.currentPage + 1); |
| 194 | $scope.selectedFactura = 0; | 212 | $scope.selectedFactura = 0; |
| 195 | } | 213 | } |
| 196 | } | 214 | } |
| 197 | 215 | ||
| 198 | function calcularSaldos(facturas) { | 216 | function calcularSaldos(facturas) { |
| 199 | var saldo = 0; | 217 | var saldo = 0; |
| 200 | 218 | ||
| 201 | facturas.forEach(function(factura) { | 219 | facturas.forEach(function(factura) { |
| 202 | if (factura.TCO === 'CI' || | 220 | if (factura.TCO === 'CI' || |
| 203 | factura.TCO === 'FT' || | 221 | factura.TCO === 'FT' || |
| 204 | factura.TCO === 'ND'){ | 222 | factura.TCO === 'ND'){ |
| 205 | factura.IPA = factura.IPA * -1; | 223 | factura.IPA = factura.IPA * -1; |
| 206 | }else{ | 224 | }else{ |
| 207 | factura.IPA = factura.IPA; | 225 | factura.IPA = factura.IPA; |
| 208 | } | 226 | } |
| 209 | saldo += factura.IPA; | 227 | saldo += factura.IPA; |
| 210 | factura.saldo = saldo; | 228 | factura.saldo = saldo; |
| 211 | factura.saldo_show = Math.abs(saldo); | 229 | factura.saldo_show = Math.abs(saldo); |
| 212 | factura.IPA_SHOW = Math.abs(factura.IPA); | 230 | factura.IPA_SHOW = Math.abs(factura.IPA); |
| 213 | }); | 231 | }); |
| 214 | 232 | ||
| 215 | return facturas; | 233 | return facturas; |
| 216 | } | 234 | } |
| 217 | 235 | ||
| 218 | $scope.busquedaPress(13); | 236 | $scope.busquedaPress(13); |
| 219 | } | 237 | } |
| 220 | ] | 238 | ] |
| 221 | ); | 239 | ); |
| 222 | 240 |
src/views/foca-modal-factura.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">Búsqueda de Comprobantes</h5> | 4 | <h5 class="modal-title">Búsqueda de Comprobantes</h5> |
| 5 | </div> | 5 | </div> |
| 6 | </div> | 6 | </div> |
| 7 | </div> | 7 | </div> |
| 8 | <div class="modal-body" id="modal-body"> | 8 | <div class="modal-body" id="modal-body"> |
| 9 | <table ng-show="primerBusqueda" class="table table-striped table-sm"> | 9 | <table ng-show="primerBusqueda" class="table table-striped table-sm"> |
| 10 | <thead> | 10 | <thead> |
| 11 | <tr> | 11 | <tr> |
| 12 | <th>Comprobante</th> | 12 | <th>Comprobante</th> |
| 13 | <th>Vencimiento</th> | 13 | <th>Vencimiento</th> |
| 14 | <th class="text-right">Importe</th> | 14 | <th class="text-right">Importe</th> |
| 15 | <th class="text-right">Saldo</th> | 15 | <th class="text-right">Saldo</th> |
| 16 | <th class="text-right"></th> | 16 | <th class="text-right"></th> |
| 17 | <th class="text-right"></th> | ||
| 18 | <th class="text-right"></th> | ||
| 17 | </tr> | 19 | </tr> |
| 18 | </thead> | 20 | </thead> |
| 19 | <tbody> | 21 | <tbody> |
| 20 | <tr ng-show="currentPageFacturas.length == 0 && primerBusqueda"> | 22 | <tr ng-show="currentPageFacturas.length == 0 && primerBusqueda"> |
| 21 | <td colspan="5"> | 23 | <td colspan="5"> |
| 22 | No se encontraron resultados. | 24 | No se encontraron resultados. |
| 23 | </td> | 25 | </td> |
| 24 | </tr> | 26 | </tr> |
| 25 | <tr class="selectable" | 27 | <tr class="selectable" |
| 26 | ng-repeat="(key,factura) in currentPageFacturas" | 28 | ng-repeat="(key,factura) in currentPageFacturas"> |
| 27 | ng-click="factura.checked = !factura.checked"> | ||
| 28 | <td>{{factura.numeroFactura}} {{factura.FECHA_COMPROBANTE | date : 'dd/MM/yyyy' : 'GMT'}}</td> | 29 | <td>{{factura.numeroFactura}} {{factura.FECHA_COMPROBANTE | date : 'dd/MM/yyyy' : 'GMT'}}</td> |
| 29 | <td>{{(factura.TCO == 'FT') ? factura.NCU + ' - ' : ''}}{{factura.FEV | date : 'dd/MM/yyyy' : 'GMT'}}</td> | 30 | <td>{{(factura.TCO == 'FT') ? factura.NCU + ' - ' : ''}}{{factura.FEV | date : 'dd/MM/yyyy' : 'GMT'}}</td> |
| 30 | <td class="text-right"> | 31 | <td class="text-right"> |
| 31 | {{ (factura.IPA_SHOW / parametrosFactura.cotizacion) | number:2 }} | 32 | {{ (factura.IPA_SHOW / parametrosFactura.cotizacion) | number:2 }} |
| 32 | <span ng-class="{'invisible': factura.IPA >= 0}">-</span> | 33 | <span ng-class="{'invisible': factura.IPA >= 0}">-</span> |
| 33 | </td> | 34 | </td> |
| 34 | <td class="text-right"> | 35 | <td class="text-right"> |
| 35 | {{ factura.saldo_show | number:2 }} | 36 | {{ factura.saldo_show | number:2 }} |
| 36 | <span ng-class="{'invisible': factura.saldo >= 0}">-</span> | 37 | <span ng-class="{'invisible': factura.saldo >= 0}">-</span> |
| 37 | </td> | 38 | </td> |
| 38 | <td class="text-right"> | 39 | <td class="text-right"> |
| 39 | <input | 40 | <input |
| 40 | ng-class="{ | 41 | ng-class="{ |
| 41 | 'btn-secondary': selectedFactura != key, | 42 | 'btn-secondary': selectedFactura != key, |
| 42 | 'btn-primary': selectedFactura == key}" | 43 | 'btn-primary': selectedFactura == key}" |
| 43 | ng-keydown="itemFactura($event.keyCode)" | 44 | ng-keydown="itemFactura($event.keyCode)" |
| 44 | foca-focus="selectedFactura == {{key}}" | 45 | foca-focus="selectedFactura == {{key}}" |
| 45 | type="checkbox" | 46 | type="checkbox" |
| 46 | ng-model="factura.checked" | 47 | ng-model="factura.checked" |
| 47 | /> | 48 | /> |
| 48 | </td> | 49 | </td> |
| 50 | <td> | ||
| 51 | <button | ||
| 52 | class="btn p-1" | ||
| 53 | ng-click="verFactura(factura)" | ||
| 54 | > | ||
| 55 | <i class="fa fa-eye" aria-hidden="true"></i> | ||
| 56 | </button> | ||
| 57 | </td> | ||
| 58 | <td> | ||
| 59 | <button | ||
| 60 | class="btn p-1" | ||
| 61 | > | ||
| 62 | <i class="fa fa-envelope-o" aria-hidden="true"></i> | ||
| 63 | </button> | ||
| 64 | </td> | ||
| 49 | </tr> | 65 | </tr> |
| 50 | </tbody> | 66 | </tbody> |
| 51 | </table> | 67 | </table> |
| 52 | </div> | 68 | </div> |
| 53 | <div class="modal-footer py-1"> | 69 | <div class="modal-footer py-1"> |
| 54 | <nav ng-show="currentPageFacturas.length > 0 && primerBusqueda" class="mr-auto"> | 70 | <nav ng-show="currentPageFacturas.length > 0 && primerBusqueda" class="mr-auto"> |
| 55 | <ul class="pagination pagination-sm justify-content mb-0"> | 71 | <ul class="pagination pagination-sm justify-content mb-0"> |
| 56 | <li class="page-item" ng-class="{'disabled': currentPage == 1}"> | 72 | <li class="page-item" ng-class="{'disabled': currentPage == 1}"> |
| 57 | <a class="page-link" href="javascript:void();" ng-click="selectPage(currentPage - 1)"> | 73 | <a class="page-link" href="javascript:void();" ng-click="selectPage(currentPage - 1)"> |
| 58 | <span aria-hidden="true">«</span> | 74 | <span aria-hidden="true">«</span> |
| 59 | <span class="sr-only">Anterior</span> | 75 | <span class="sr-only">Anterior</span> |
| 60 | </a> | 76 | </a> |
| 61 | </li> | 77 | </li> |
| 62 | <li | 78 | <li |
| 63 | class="page-item" | 79 | class="page-item" |
| 64 | ng-repeat="pagina in paginas" | 80 | ng-repeat="pagina in paginas" |
| 65 | ng-class="{'active': pagina == currentPage}" | 81 | ng-class="{'active': pagina == currentPage}" |
| 66 | > | 82 | > |
| 67 | <a | 83 | <a |
| 68 | class="page-link" | 84 | class="page-link" |
| 69 | href="javascript:void();" | 85 | href="javascript:void();" |
| 70 | ng-click="selectPage(pagina)" | 86 | ng-click="selectPage(pagina)" |
| 71 | ng-bind="pagina" | 87 | ng-bind="pagina" |
| 72 | ></a> | 88 | ></a> |
| 73 | </li> | 89 | </li> |
| 74 | <li class="page-item" ng-class="{'disabled': currentPage == lastPage}"> | 90 | <li class="page-item" ng-class="{'disabled': currentPage == lastPage}"> |
| 75 | <a class="page-link" href="javascript:void();" ng-click="selectPage(currentPage + 1)"> | 91 | <a class="page-link" href="javascript:void();" ng-click="selectPage(currentPage + 1)"> |
| 76 | <span aria-hidden="true">»</span> | 92 | <span aria-hidden="true">»</span> |
| 77 | <span class="sr-only">Siguiente</span> | 93 | <span class="sr-only">Siguiente</span> |
| 78 | </a> | 94 | </a> |
| 79 | </li> | 95 | </li> |
| 80 | </ul> | 96 | </ul> |
| 81 | </nav> | 97 | </nav> |
| 82 | <button class="btn btn-sm btn-secondary" type="button" ng-click="cancel()">Cancelar</button> | 98 | <button class="btn btn-sm btn-secondary" type="button" ng-click="cancel()">Cancelar</button> |
| 83 | <button | 99 | <button |
| 84 | class="btn btn-sm btn-primary" | 100 | class="btn btn-sm btn-primary" |
| 85 | type="button" | 101 | type="button" |
| 86 | ng-click="aceptar()" | 102 | ng-click="aceptar()" |
| 87 | ng-disabled="tieneAlMenosUno()" | 103 | ng-disabled="tieneAlMenosUno()" |
| 88 | >Aceptar</button> | 104 | >Aceptar</button> |
| 89 | </div> | 105 | </div> |