Commit 7001935009c1b0065a65b8342ddc322c8a613dd0
Exists in
master
and in
1 other branch
Merge branch 'master' into 'master'
Master See merge request !4
Showing
4 changed files
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: 'focaModalCobranza', | 31 | module: 'focaModalCobranza', |
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-cobranza.js'), | 46 | concat('foca-modal-cobranza.js'), |
47 | replace('src/views/', ''), | 47 | replace('src/views/', ''), |
48 | replace("['ui.bootstrap', 'focaDirectivas', 'angular-ladda']", '[]'), | 48 | replace("['ui.bootstrap', 'focaDirectivas', 'focaFiltros, 'angular-ladda', 'focaModal']", '[]'), |
49 | gulp.dest(paths.tmp), | 49 | gulp.dest(paths.tmp), |
50 | rename('foca-modal-cobranza.min.js'), | 50 | rename('foca-modal-cobranza.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-cobranza/dist')); | 90 | .pipe(gulp.dest('../../wrapper-demo/node_modules/foca-modal-cobranza/dist')); |
91 | }); | 91 | }); |
92 | 92 | ||
93 | gulp.task('watchAndCopy', function() { | 93 | gulp.task('watchAndCopy', function() { |
94 | gulp.watch([paths.srcJS, paths.srcViews], ['copy']) | 94 | gulp.watch([paths.srcJS, paths.srcViews], ['copy']) |
95 | }); | 95 | }); |
96 | 96 |
src/js/app.js
1 | angular.module('focaModalCobranza', [ | 1 | angular.module('focaModalCobranza', [ |
2 | 'ui.bootstrap', | 2 | 'ui.bootstrap', |
3 | 'focaDirectivas', | 3 | 'focaDirectivas', |
4 | 'focaFiltros', | 4 | 'focaFiltros', |
5 | 'angular-ladda' | 5 | 'angular-ladda', |
6 | 'focaModal' | ||
6 | ]); | 7 | ]); |
7 | 8 |
src/js/controller.js
1 | angular.module('focaModalCobranza') | 1 | angular.module('focaModalCobranza') |
2 | .controller('focaModalCobranzaController', | 2 | .controller('focaModalCobranzaController', |
3 | [ | 3 | [ |
4 | '$timeout', | 4 | '$timeout', |
5 | '$filter', | 5 | '$filter', |
6 | '$scope', | 6 | '$scope', |
7 | '$uibModalInstance', | 7 | '$uibModalInstance', |
8 | 'focaModalCobranzaService', | 8 | 'focaModalCobranzaService', |
9 | function($timeout, $filter, $scope, $uibModalInstance, focaModalCobranzaService) { | 9 | 'focaModalService', |
10 | function($timeout, $filter, $scope, $uibModalInstance, | ||
11 | focaModalCobranzaService, focaModalService) { | ||
10 | var fecha = new Date(); | 12 | var fecha = new Date(); |
11 | $scope.fechaHasta = new Date(); | 13 | $scope.fechaHasta = new Date(); |
12 | $scope.fechaDesde = new Date(fecha.setMonth(fecha.getMonth() - 1)); | 14 | $scope.fechaDesde = new Date(fecha.setMonth(fecha.getMonth() - 1)); |
13 | $scope.filters = ''; | 15 | $scope.filters = ''; |
14 | $scope.cobranzas = []; | 16 | $scope.cobranzas = []; |
15 | $scope.primerBusqueda = false; | 17 | $scope.primerBusqueda = false; |
16 | $scope.searchLoading = false; | 18 | $scope.searchLoading = false; |
17 | // pagination | 19 | // pagination |
18 | $scope.numPerPage = 10; | 20 | $scope.numPerPage = 10; |
19 | $scope.currentPage = 1; | 21 | $scope.currentPage = 1; |
20 | $scope.filteredCobranzas = []; | 22 | $scope.filteredCobranzas = []; |
21 | $scope.currentPageCobranzas = []; | 23 | $scope.currentPageCobranzas = []; |
22 | $scope.selectedCobranza = -1; | 24 | $scope.selectedCobranza = -1; |
23 | $scope.dateOptions = { | ||
24 | maxDate: new Date() | ||
25 | }; | ||
26 | 25 | ||
27 | //METODOS | 26 | //METODOS |
28 | $scope.busquedaPress = function(key) { | 27 | $scope.busquedaPress = function(key) { |
29 | if (key === 13) { | 28 | if (key === 13) { |
30 | //TODO Validaciones con alertas de foca | ||
31 | if(!$scope.fechaDesde) { | 29 | if(!$scope.fechaDesde) { |
32 | alert('INGRESE FECHA DESDE'); | 30 | focaModalService.alert('INGRESE FECHA DESDE'); |
33 | return; | 31 | return; |
34 | } | 32 | } |
35 | if(!$scope.fechaHasta) { | 33 | if(!$scope.fechaHasta) { |
36 | alert('INGRESE FECHA HASTA'); | 34 | focaModalService.alert('INGRESE FECHA HASTA'); |
37 | return; | 35 | return; |
38 | } | 36 | } |
39 | if($scope.fechaDesde > $scope.fechaHasta) { | 37 | if($scope.fechaDesde > $scope.fechaHasta) { |
40 | alert('La fecha desde no puede ser mayor a la fecha hasta'); | 38 | focaModalService |
39 | .alert('La fecha desde no puede ser mayor a la fecha hasta'); | ||
41 | return; | 40 | return; |
42 | } | 41 | } |
43 | $scope.searchLoading = true; | 42 | $scope.searchLoading = true; |
44 | //TODO: usar filtros en vez de toISOString | 43 | //TODO: usar filtros en vez de toISOString |
45 | focaModalCobranzaService | 44 | focaModalCobranzaService |
46 | .getCobranzas($scope.fechaDesde.toISOString().split('.')[0], | 45 | .getCobranzas($scope.fechaDesde.toISOString().split('.')[0], |
47 | $scope.fechaHasta.toISOString().split('.')[0]) | 46 | $scope.fechaHasta.toISOString().split('.')[0]) |
48 | .then(llenarDatos); | 47 | .then(llenarDatos); |
49 | } | 48 | } |
50 | }; | 49 | }; |
51 | function llenarDatos(res) { | 50 | function llenarDatos(res) { |
52 | $scope.cobranzas = []; | 51 | $scope.cobranzas = []; |
53 | $scope.filteredCobranzas = []; | 52 | $scope.filteredCobranzas = []; |
54 | $scope.currentPageCobranzas = []; | 53 | $scope.currentPageCobranzas = []; |
55 | $scope.selectedCobranza = -1; | 54 | $scope.selectedCobranza = -1; |
56 | $scope.searchLoading = false; | 55 | $scope.searchLoading = false; |
57 | $scope.primerBusqueda = true; | 56 | $scope.primerBusqueda = true; |
58 | $scope.cobranzas = res.data; | 57 | $scope.cobranzas = res.data; |
59 | $scope.search(true); | 58 | $scope.search(true); |
60 | primera(); | 59 | primera(); |
61 | } | 60 | } |
62 | $scope.search = function(pressed) { | 61 | $scope.search = function(pressed) { |
63 | if($scope.cobranzas.length > 0) { | 62 | if($scope.cobranzas.length > 0) { |
64 | $scope.filteredCobranzas = $filter('filter')( | 63 | $scope.filteredCobranzas = $filter('filter')( |
65 | $scope.cobranzas, | 64 | $scope.cobranzas, |
66 | {$: $scope.filters} | 65 | {$: $scope.filters} |
67 | ); | 66 | ); |
68 | 67 | ||
69 | if(pressed && $scope.filteredCobranzas.length === 0){ | 68 | if(pressed && $scope.filteredCobranzas.length === 0){ |
70 | $timeout(function() { | 69 | $timeout(function() { |
71 | angular.element('#search')[0].focus(); | 70 | angular.element('#search')[0].focus(); |
72 | $scope.filters = ''; | 71 | $scope.filters = ''; |
73 | }); | 72 | }); |
74 | } | 73 | } |
75 | 74 | ||
76 | $scope.lastPage = Math.ceil( | 75 | $scope.lastPage = Math.ceil( |
77 | $scope.filteredCobranzas.length / $scope.numPerPage | 76 | $scope.filteredCobranzas.length / $scope.numPerPage |
78 | ); | 77 | ); |
79 | 78 | ||
80 | $scope.resetPage(); | 79 | $scope.resetPage(); |
81 | } | 80 | } |
82 | }; | 81 | }; |
83 | 82 | ||
84 | $scope.resetPage = function() { | 83 | $scope.resetPage = function() { |
85 | $scope.currentPage = 1; | 84 | $scope.currentPage = 1; |
86 | $scope.selectPage(1); | 85 | $scope.selectPage(1); |
87 | }; | 86 | }; |
88 | 87 | ||
89 | $scope.selectPage = function(page) { | 88 | $scope.selectPage = function(page) { |
90 | var start = (page - 1) * $scope.numPerPage; | 89 | var start = (page - 1) * $scope.numPerPage; |
91 | var end = start + $scope.numPerPage; | 90 | var end = start + $scope.numPerPage; |
92 | $scope.paginas = []; | 91 | $scope.paginas = []; |
93 | $scope.paginas = calcularPages(page); | 92 | $scope.paginas = calcularPages(page); |
94 | $scope.currentPageCobranzas = $scope.filteredCobranzas.slice(start, end); | 93 | $scope.currentPageCobranzas = $scope.filteredCobranzas.slice(start, end); |
95 | $scope.currentPage = page; | 94 | $scope.currentPage = page; |
96 | }; | 95 | }; |
97 | 96 | ||
98 | $scope.select = function(cobranza) { | 97 | $scope.select = function(cobranza) { |
99 | $uibModalInstance.close(cobranza); | 98 | $uibModalInstance.close(cobranza); |
100 | }; | 99 | }; |
101 | 100 | ||
102 | $scope.cancel = function() { | 101 | $scope.cancel = function() { |
103 | $uibModalInstance.dismiss('cancel'); | 102 | $uibModalInstance.dismiss('cancel'); |
104 | }; | 103 | }; |
105 | 104 | ||
106 | $scope.busquedaDown = function(key) { | 105 | $scope.busquedaDown = function(key) { |
107 | if (key === 40) { | 106 | if (key === 40) { |
108 | primera(key); | 107 | primera(key); |
109 | } | 108 | } |
110 | }; | 109 | }; |
111 | 110 | ||
112 | $scope.itemCobranza = function(key) { | 111 | $scope.itemCobranza = function(key) { |
113 | if (key === 38) { | 112 | if (key === 38) { |
114 | anterior(key); | 113 | anterior(key); |
115 | } | 114 | } |
116 | 115 | ||
117 | if (key === 40) { | 116 | if (key === 40) { |
118 | siguiente(key); | 117 | siguiente(key); |
119 | } | 118 | } |
120 | 119 | ||
121 | if (key === 37) { | 120 | if (key === 37) { |
122 | retrocederPagina(); | 121 | retrocederPagina(); |
123 | } | 122 | } |
124 | 123 | ||
125 | if (key === 39) { | 124 | if (key === 39) { |
126 | avanzarPagina(); | 125 | avanzarPagina(); |
127 | } | 126 | } |
128 | }; | 127 | }; |
129 | 128 | ||
130 | $scope.getTotalCobrado = function(cobros) { | 129 | $scope.getTotalCobrado = function(cobros) { |
131 | var total = 0; | 130 | var total = 0; |
132 | for (var i = 0; i < cobros.length; i++) { | 131 | for (var i = 0; i < cobros.length; i++) { |
133 | total += cobros[i].importe; | 132 | total += cobros[i].importe; |
134 | } | 133 | } |
135 | return parseFloat(total.toFixed(2)); | 134 | return parseFloat(total.toFixed(2)); |
136 | }; | 135 | }; |
137 | 136 | ||
138 | function calcularPages(paginaActual) { | 137 | function calcularPages(paginaActual) { |
139 | var paginas = []; | 138 | var paginas = []; |
140 | paginas.push(paginaActual); | 139 | paginas.push(paginaActual); |
141 | 140 | ||
142 | if (paginaActual - 1 > 1) { | 141 | if (paginaActual - 1 > 1) { |
143 | 142 | ||
144 | paginas.unshift(paginaActual - 1); | 143 | paginas.unshift(paginaActual - 1); |
145 | if (paginaActual - 2 > 1) { | 144 | if (paginaActual - 2 > 1) { |
146 | paginas.unshift(paginaActual - 2); | 145 | paginas.unshift(paginaActual - 2); |
147 | } | 146 | } |
148 | } | 147 | } |
149 | 148 | ||
150 | if (paginaActual + 1 < $scope.lastPage) { | 149 | if (paginaActual + 1 < $scope.lastPage) { |
151 | paginas.push(paginaActual + 1); | 150 | paginas.push(paginaActual + 1); |
152 | if (paginaActual + 2 < $scope.lastPage) { | 151 | if (paginaActual + 2 < $scope.lastPage) { |
153 | paginas.push(paginaActual + 2); | 152 | paginas.push(paginaActual + 2); |
154 | } | 153 | } |
155 | } | 154 | } |
156 | 155 | ||
157 | if (paginaActual !== 1) { | 156 | if (paginaActual !== 1) { |
158 | paginas.unshift(1); | 157 | paginas.unshift(1); |
159 | } | 158 | } |
160 | 159 | ||
161 | if (paginaActual !== $scope.lastPage) { | 160 | if (paginaActual !== $scope.lastPage) { |
162 | paginas.push($scope.lastPage); | 161 | paginas.push($scope.lastPage); |
163 | } | 162 | } |
164 | 163 | ||
165 | return paginas; | 164 | return paginas; |
166 | } | 165 | } |
167 | 166 | ||
168 | function primera() { | 167 | function primera() { |
169 | $scope.selectedCobranza = 0; | 168 | $scope.selectedCobranza = 0; |
170 | } | 169 | } |
171 | 170 | ||
172 | function anterior() { | 171 | function anterior() { |
173 | if ($scope.selectedCobranza === 0 && $scope.currentPage > 1) { | 172 | if ($scope.selectedCobranza === 0 && $scope.currentPage > 1) { |
174 | retrocederPagina(); | 173 | retrocederPagina(); |
175 | } else { | 174 | } else { |
176 | $scope.selectedCobranza--; | 175 | $scope.selectedCobranza--; |
177 | } | 176 | } |
178 | } | 177 | } |
179 | 178 | ||
180 | function siguiente() { | 179 | function siguiente() { |
181 | if ($scope.selectedCobranza < $scope.currentPageCobranzas.length - 1 ) { | 180 | if ($scope.selectedCobranza < $scope.currentPageCobranzas.length - 1 ) { |
182 | $scope.selectedCobranza++; | 181 | $scope.selectedCobranza++; |
183 | } else { | 182 | } else { |
184 | avanzarPagina(); | 183 | avanzarPagina(); |
185 | } | 184 | } |
186 | } | 185 | } |
187 | 186 | ||
188 | function retrocederPagina() { | 187 | function retrocederPagina() { |
189 | if ($scope.currentPage > 1) { | 188 | if ($scope.currentPage > 1) { |
190 | $scope.selectPage($scope.currentPage - 1); | 189 | $scope.selectPage($scope.currentPage - 1); |
191 | $scope.selectedCobranza = $scope.numPerPage - 1; | 190 | $scope.selectedCobranza = $scope.numPerPage - 1; |
192 | } | 191 | } |
193 | } | 192 | } |
194 | 193 | ||
195 | function avanzarPagina() { | 194 | function avanzarPagina() { |
196 | if ($scope.currentPage < $scope.lastPage) { | 195 | if ($scope.currentPage < $scope.lastPage) { |
197 | $scope.selectPage($scope.currentPage + 1); | 196 | $scope.selectPage($scope.currentPage + 1); |
198 | $scope.selectedCobranza = 0; | 197 | $scope.selectedCobranza = 0; |
199 | } | 198 | } |
200 | } | 199 | } |
201 | } | 200 | } |
src/views/foca-modal-cobranza.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 Cobranza</h5> | 4 | <h5 class="modal-title my-1">Búsqueda de Cobranza</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 | placeholder="Razón social" | 11 | placeholder="Razón social" |
12 | ng-model="filters" | 12 | ng-model="filters" |
13 | ng-change="search()" | 13 | ng-change="search()" |
14 | ng-keydown="busquedaDown($event.keyCode)" | 14 | ng-keydown="busquedaDown($event.keyCode)" |
15 | ng-keypress="busquedaPress($event.keyCode)" | 15 | ng-keypress="busquedaPress($event.keyCode)" |
16 | foca-focus="selectedCobranza == -1" | 16 | foca-focus="selectedCobranza == -1" |
17 | ng-focus="selectedCobranza = -1" | 17 | ng-focus="selectedCobranza = -1" |
18 | id="search" | 18 | id="search" |
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 | ng-click="busquedaPress(13)" | 27 | ng-click="busquedaPress(13)" |
28 | > | 28 | > |
29 | <i class="fa fa-search" aria-hidden="true"></i> | 29 | <i class="fa fa-search" aria-hidden="true"></i> |
30 | </button> | 30 | </button> |
31 | </div> | 31 | </div> |
32 | </div> | 32 | </div> |
33 | </div> | 33 | </div> |
34 | 34 | ||
35 | </div> | 35 | </div> |
36 | <div class="modal-body" id="modal-body"> | 36 | <div class="modal-body" id="modal-body"> |
37 | <div class="input-group row"> | 37 | <div class="input-group row"> |
38 | <small class="col-md-2 col-4 text-left my-1">Fecha Desde</small> | 38 | <small class="col-md-2 col-4 text-left my-1">Fecha Desde</small> |
39 | <div class="col-md-4 col-8 input-group mb-2"> | 39 | <div class="col-md-4 col-8 input-group mb-2"> |
40 | <div class="input-group-prepend"> | 40 | <div class="input-group-prepend"> |
41 | <div class="input-group-text form-control-sm"> | 41 | <div class="input-group-text form-control-sm"> |
42 | <i class="fa fa-calendar"></i> | 42 | <i class="fa fa-calendar"></i> |
43 | </div> | 43 | </div> |
44 | </div> | 44 | </div> |
45 | <input | 45 | <input |
46 | class="form-control form-control-sm" | 46 | class="form-control form-control-sm" |
47 | id="inlineFormInputGroup" | 47 | id="inlineFormInputGroup" |
48 | ladda="searchLoading" | 48 | ladda="searchLoading" |
49 | type="text" | 49 | type="text" |
50 | ng-model="fechaDesde" | 50 | ng-model="fechaDesde" |
51 | ng-required="true" | 51 | ng-required="true" |
52 | uib-datepicker-popup="dd/MM/yyyy" | 52 | uib-datepicker-popup="dd/MM/yyyy" |
53 | show-button-bar="false" | 53 | show-button-bar="false" |
54 | is-open="datepickerOpen" | 54 | is-open="datepickerOpen" |
55 | on-open-focus="false" | 55 | on-open-focus="false" |
56 | ng-focus="datepickerOpen = true" | 56 | ng-focus="datepickerOpen = true" |
57 | datepicker-options="dateOptions" | ||
58 | /> | 57 | /> |
59 | </div> | 58 | </div> |
60 | <small class="col-md-2 col-4 text-left my-1">Fecha Hasta</small> | 59 | <small class="col-md-2 col-4 text-left my-1">Fecha Hasta</small> |
61 | <div class="col-md-4 col-8 input-group mb-2"> | 60 | <div class="col-md-4 col-8 input-group mb-2"> |
62 | <div class="input-group-prepend"> | 61 | <div class="input-group-prepend"> |
63 | <div class="input-group-text form-control-sm"> | 62 | <div class="input-group-text form-control-sm"> |
64 | <i class="fa fa-calendar"></i> | 63 | <i class="fa fa-calendar"></i> |
65 | </div> | 64 | </div> |
66 | </div> | 65 | </div> |
67 | <input | 66 | <input |
68 | class="form-control form-control-sm" | 67 | class="form-control form-control-sm" |
69 | id="inlineFormInputGroup" | 68 | id="inlineFormInputGroup" |
70 | ladda="searchLoading" | 69 | ladda="searchLoading" |
71 | type="text" | 70 | type="text" |
72 | ng-model="fechaHasta" | 71 | ng-model="fechaHasta" |
73 | ng-required="true" | 72 | ng-required="true" |
74 | uib-datepicker-popup="dd/MM/yyyy" | 73 | uib-datepicker-popup="dd/MM/yyyy" |
75 | show-button-bar="false" | 74 | show-button-bar="false" |
76 | is-open="datepicker2Open" | 75 | is-open="datepicker2Open" |
77 | on-open-focus="false" | 76 | on-open-focus="false" |
78 | ng-focus="datepicker2Open = true" | 77 | ng-focus="datepicker2Open = true" |
79 | datepicker-options="dateOptions" | ||
80 | /> | 78 | /> |
81 | </div> | 79 | </div> |
82 | </div> | 80 | </div> |
83 | <table ng-show="primerBusqueda" class="table table-striped table-sm"> | 81 | <table ng-show="primerBusqueda" class="table table-striped table-sm"> |
84 | <thead> | 82 | <thead> |
85 | <tr> | 83 | <tr> |
86 | <th>Fecha</th> | 84 | <th>Fecha</th> |
87 | <th>Cliente</th> | 85 | <th>Cliente</th> |
88 | <th>Comprobante</th> | 86 | <th>Comprobante</th> |
89 | <th>Importe</th> | 87 | <th>Importe</th> |
90 | <th></th> | 88 | <th></th> |
91 | </tr> | 89 | </tr> |
92 | </thead> | 90 | </thead> |
93 | <tbody> | 91 | <tbody> |
94 | <tr ng-show="currentPageCobranzas.length == 0 && primerBusqueda"> | 92 | <tr ng-show="currentPageCobranzas.length == 0 && primerBusqueda"> |
95 | <td colspan="5"> | 93 | <td colspan="5"> |
96 | No se encontraron resultados. | 94 | No se encontraron resultados. |
97 | </td> | 95 | </td> |
98 | </tr> | 96 | </tr> |
99 | <tr class="selectable" | 97 | <tr class="selectable" |
100 | ng-repeat="(key, cobranza) in currentPageCobranzas" | 98 | ng-repeat="(key, cobranza) in currentPageCobranzas" |
101 | ng-click="select(cobranza)"> | 99 | ng-click="select(cobranza)"> |
102 | <td ng-bind="cobranza.fecha | date : 'dd/MM/yyyy'"></td> | 100 | <td ng-bind="cobranza.fecha | date : 'dd/MM/yyyy'"></td> |
103 | <td ng-bind="cobranza.cliente.NOM"></td> | 101 | <td ng-bind="cobranza.cliente.NOM"></td> |
104 | <td ng-bind="[cobranza.puntoVenta, cobranza.numeroRecibo] | comprobante"></td> | 102 | <td ng-bind="[cobranza.puntoVenta, cobranza.numeroRecibo] | comprobante"></td> |
105 | <td ng-bind="getTotalCobrado(cobranza.cobros) | number: 2"></td> | 103 | <td ng-bind="getTotalCobrado(cobranza.cobros) | number: 2"></td> |
106 | <td> | 104 | <td> |
107 | <button | 105 | <button |
108 | type="button" | 106 | type="button" |
109 | class="btn btn-xs p-1 float-right" | 107 | class="btn btn-xs p-1 float-right" |
110 | ng-class="{ | 108 | ng-class="{ |
111 | 'btn-secondary': selectedCobranza != key, | 109 | 'btn-secondary': selectedCobranza != key, |
112 | 'btn-primary': selectedCobranza == key | 110 | 'btn-primary': selectedCobranza == key |
113 | }" | 111 | }" |
114 | foca-focus="selectedCobranza == {{key}}" | 112 | foca-focus="selectedCobranza == {{key}}" |
115 | ng-keydown="itemCobranza($event.keyCode)" | 113 | ng-keydown="itemCobranza($event.keyCode)" |
116 | > | 114 | > |
117 | <i class="fa fa-circle-thin" aria-hidden="true"></i> | 115 | <i class="fa fa-circle-thin" aria-hidden="true"></i> |
118 | </button> | 116 | </button> |
119 | </td> | 117 | </td> |
120 | </tr> | 118 | </tr> |
121 | </tbody> | 119 | </tbody> |
122 | </table> | 120 | </table> |
123 | </div> | 121 | </div> |
124 | <div class="modal-footer py-1"> | 122 | <div class="modal-footer py-1"> |
125 | <nav ng-show="currentPageCobranzas.length > 0 && primerBusqueda" class="mr-auto"> | 123 | <nav ng-show="currentPageCobranzas.length > 0 && primerBusqueda" class="mr-auto"> |
126 | <ul class="pagination pagination-sm justify-content mb-0"> | 124 | <ul class="pagination pagination-sm justify-content mb-0"> |
127 | <li class="page-item" ng-class="{'disabled': currentPage == 1}"> | 125 | <li class="page-item" ng-class="{'disabled': currentPage == 1}"> |
128 | <a | 126 | <a |
129 | class="page-link" | 127 | class="page-link" |
130 | href="javascript:void();" | 128 | href="javascript:void();" |
131 | ng-click="selectPage(currentPage - 1)" | 129 | ng-click="selectPage(currentPage - 1)" |
132 | > | 130 | > |
133 | <span aria-hidden="true">«</span> | 131 | <span aria-hidden="true">«</span> |
134 | <span class="sr-only">Anterior</span> | 132 | <span class="sr-only">Anterior</span> |
135 | </a> | 133 | </a> |
136 | </li> | 134 | </li> |
137 | <li | 135 | <li |
138 | class="page-item" | 136 | class="page-item" |
139 | ng-repeat="pagina in paginas" | 137 | ng-repeat="pagina in paginas" |
140 | ng-class="{'active': pagina == currentPage}" | 138 | ng-class="{'active': pagina == currentPage}" |
141 | > | 139 | > |
142 | <a | 140 | <a |
143 | class="page-link" | 141 | class="page-link" |
144 | href="javascript:void();" | 142 | href="javascript:void();" |
145 | ng-click="selectPage(pagina)" | 143 | ng-click="selectPage(pagina)" |
146 | ng-bind="pagina" | 144 | ng-bind="pagina" |
147 | ></a> | 145 | ></a> |
148 | </li> | 146 | </li> |
149 | <li class="page-item" ng-class="{'disabled': currentPage == lastPage}"> | 147 | <li class="page-item" ng-class="{'disabled': currentPage == lastPage}"> |
150 | <a | 148 | <a |
151 | class="page-link" | 149 | class="page-link" |
152 | href="javascript:void();" | 150 | href="javascript:void();" |
153 | ng-click="selectPage(currentPage + 1)" | 151 | ng-click="selectPage(currentPage + 1)" |
154 | > | 152 | > |
155 | <span aria-hidden="true">»</span> | 153 | <span aria-hidden="true">»</span> |
156 | <span class="sr-only">Siguiente</span> | 154 | <span class="sr-only">Siguiente</span> |
157 | </a> | 155 | </a> |
158 | </li> | 156 | </li> |
159 | </ul> | 157 | </ul> |
160 | </nav> | 158 | </nav> |
161 | <button class="btn btn-sm btn-secondary" type="button" ng-click="cancel()">Cancelar</button> | 159 | <button class="btn btn-sm btn-secondary" type="button" ng-click="cancel()">Cancelar</button> |
162 | </div> | 160 | </div> |
163 | 161 |