Commit 97d48a46a6140da14c7824725d14c1362b20c341
Exists in
master
Merge branch 'master' into 'master'
Master (pmarco) See merge request modulos-npm/foca-modal-remito!1
Showing
5 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: 'focaModalRemito', | 31 | module: 'focaModalRemito', |
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-remito.js'), | 46 | concat('foca-modal-remito.js'), |
47 | replace('src/views/', ''), | 47 | replace('src/views/', ''), |
48 | replace("['ui.bootstrap', 'focaDirectivas', 'angular-ladda']", '[]'), | 48 | replace("['ui.bootstrap', 'focaDirectivas', 'angular-ladda']", '[]'), |
49 | gulp.dest(paths.tmp), | 49 | gulp.dest(paths.tmp), |
50 | rename('foca-modal-remito.min.js'), | 50 | rename('foca-modal-remito.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], ['copy']) | 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-remito/dist')); | 90 | .pipe(gulp.dest('../../wrapper-demo/node_modules/foca-modal-remito/dist')); |
91 | }); | 91 | }); |
92 | |||
93 | gulp.task('watchAndCopy', function() { | ||
94 | gulp.watch([paths.srcJS, paths.srcViews], ['copy']) | ||
95 | }); | ||
92 | 96 |
package.json
1 | { | 1 | { |
2 | "name": "foca-modal-remito", | 2 | "name": "foca-modal-remito", |
3 | "version": "0.0.1", | 3 | "version": "0.0.1", |
4 | "description": "Modal para seleccion de remitos", | 4 | "description": "Modal para seleccion de remitos", |
5 | "scripts": { | 5 | "scripts": { |
6 | "test": "echo \"Error: no test specified\" && exit 1", | 6 | "test": "echo \"Error: no test specified\" && exit 1", |
7 | "gulp-pre-commit": "gulp pre-commit", | 7 | "gulp-pre-commit": "gulp pre-commit", |
8 | "compile": "gulp uglify", | 8 | "compile": "gulp uglify", |
9 | "postinstall": "npm run compile && gulp clean-post-install", | 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+https://debo.suite.repo/modulos-npm/foca-directivas" |
11 | }, | 11 | }, |
12 | "pre-commit": [ | 12 | "pre-commit": [ |
13 | "gulp-pre-commit" | 13 | "gulp-pre-commit" |
14 | ], | 14 | ], |
15 | "repository": { | 15 | "repository": { |
16 | "type": "git", | 16 | "type": "git", |
17 | "url": "https://debo.suite.repo/modulos-npm/foca-modal-remito" | 17 | "url": "https://debo.suite.repo/modulos-npm/foca-modal-remito" |
18 | }, | 18 | }, |
19 | "author": "Nicolás Guarnieri", | 19 | "author": "Nicolás Guarnieri", |
20 | "license": "ISC", | 20 | "license": "ISC", |
21 | "peerDependencies": { | 21 | "peerDependencies": { |
22 | "angular": "^1.7.4", | 22 | "angular": "^1.7.4", |
23 | "bootstrap": "^4.1.3", | 23 | "bootstrap": "^4.1.3", |
24 | "font-awesome": "^4.7.0", | 24 | "font-awesome": "^4.7.0", |
25 | "ui-bootstrap4": "^3.0.4", | 25 | "ui-bootstrap4": "^3.0.4", |
26 | "gulp": "^3.9.1", | 26 | "gulp": "^3.9.1", |
27 | "gulp-angular-templatecache": "^2.2.1", | 27 | "gulp-angular-templatecache": "^2.2.1", |
28 | "gulp-concat": "^2.6.1", | 28 | "gulp-concat": "^2.6.1", |
29 | "gulp-connect": "^5.6.1", | 29 | "gulp-connect": "^5.6.1", |
30 | "gulp-htmlmin": "^5.0.1", | 30 | "gulp-htmlmin": "^5.0.1", |
31 | "gulp-rename": "^1.4.0", | 31 | "gulp-rename": "^1.4.0", |
32 | "gulp-replace": "^1.0.0", | 32 | "gulp-replace": "^1.0.0", |
33 | "gulp-uglify": "^3.0.1", | 33 | "gulp-uglify": "^3.0.1", |
34 | "jquery": "^3.3.1", | 34 | "jquery": "^3.3.1", |
35 | "pump": "^3.0.0", | 35 | "pump": "^3.0.0", |
36 | "foca-directivas": "git+https://debo.suite.repo/modulos-npm/foca-directivas" | 36 | "foca-directivas": "git+https://debo.suite.repo/modulos-npm/foca-directivas" |
37 | }, | 37 | }, |
38 | "devDependencies": { | 38 | "devDependencies": { |
39 | "angular": "^1.7.5", | 39 | "angular": "^1.7.5", |
40 | "angular-ladda": "^0.4.3", | 40 | "angular-ladda": "^0.4.3", |
41 | "bootstrap": "^4.1.3", | 41 | "bootstrap": "^4.1.3", |
42 | "foca-directivas": "git+https://debo.suite.repo/modulos-npm/foca-directivas", | 42 | "foca-directivas": "git+https://debo.suite.repo/modulos-npm/foca-directivas", |
43 | "font-awesome": "^4.7.0", | 43 | "font-awesome": "^4.7.0", |
44 | "gulp": "^3.9.1", | 44 | "gulp": "^3.9.1", |
45 | "gulp-angular-templatecache": "^2.2.3", | 45 | "gulp-angular-templatecache": "^2.2.5", |
46 | "gulp-clean": "^0.4.0", | 46 | "gulp-clean": "^0.4.0", |
47 | "gulp-concat": "^2.6.1", | 47 | "gulp-concat": "^2.6.1", |
48 | "gulp-connect": "^5.6.1", | 48 | "gulp-connect": "^5.6.1", |
49 | "gulp-htmlmin": "^5.0.1", | 49 | "gulp-htmlmin": "^5.0.1", |
50 | "gulp-jshint": "^2.1.0", | 50 | "gulp-jshint": "^2.1.0", |
51 | "gulp-rename": "^1.4.0", | 51 | "gulp-rename": "^1.4.0", |
52 | "gulp-replace": "^1.0.0", | 52 | "gulp-replace": "^1.0.0", |
53 | "gulp-uglify": "^3.0.1", | 53 | "gulp-uglify": "^3.0.1", |
54 | "jasmine-core": "^3.3.0", | 54 | "jasmine-core": "^3.3.0", |
55 | "jquery": "^3.3.1", | 55 | "jquery": "^3.3.1", |
56 | "jshint": "^2.9.6", | 56 | "jshint": "^2.9.6", |
57 | "ladda": "1.0.6", | 57 | "ladda": "1.0.6", |
58 | "pre-commit": "^1.2.2", | 58 | "pre-commit": "^1.2.2", |
59 | "pump": "^3.0.0", | 59 | "pump": "^3.0.0", |
60 | "ui-bootstrap4": "^3.0.5" | 60 | "ui-bootstrap4": "^3.0.5" |
61 | } | 61 | } |
62 | } | 62 | } |
63 | 63 |
src/js/controller.js
1 | angular.module('focaModalRemito') | 1 | angular.module('focaModalRemito') |
2 | .controller('focaModalRemitoController', | 2 | .controller('focaModalRemitoController', |
3 | [ | 3 | [ |
4 | '$filter', | 4 | '$filter', |
5 | '$scope', | 5 | '$scope', |
6 | '$uibModalInstance', | 6 | '$uibModalInstance', |
7 | 'parametroRemito', | ||
8 | 'focaModalRemitoService', | 7 | 'focaModalRemitoService', |
9 | function($filter, $scope, $uibModalInstance, parametroRemito, | 8 | function($filter, $scope, $uibModalInstance, |
10 | focaModalRemitoService | 9 | focaModalRemitoService |
11 | ) { | 10 | ) { |
12 | 11 | ||
13 | $scope.simbolo = parametroRemito.simbolo; | ||
14 | $scope.filters = ''; | 12 | $scope.filters = ''; |
15 | $scope.remitos = []; | 13 | $scope.remitos = []; |
16 | $scope.primerBusqueda = false; | 14 | $scope.primerBusqueda = false; |
17 | $scope.searchLoading = false; | 15 | $scope.searchLoading = false; |
18 | // pagination | 16 | // pagination |
19 | $scope.numPerPage = 10; | 17 | $scope.numPerPage = 10; |
20 | $scope.currentPage = 1; | 18 | $scope.currentPage = 1; |
21 | $scope.filteredRemitos = []; | 19 | $scope.filteredRemitos = []; |
22 | $scope.currentPageRemitos = []; | 20 | $scope.currentPageRemitos = []; |
23 | $scope.selectedRemito = -1; | 21 | $scope.selectedRemito = -1; |
24 | 22 | ||
25 | //METODOS | 23 | //METODOS |
26 | $scope.busquedaPress = function(key) { | 24 | $scope.busquedaPress = function(key) { |
27 | if (key === 13) { | 25 | if (key === 13) { |
28 | $scope.searchLoading = true; | 26 | $scope.searchLoading = true; |
29 | if(parametroRemito.idLista > 0) { | 27 | focaModalRemitoService.getRemitos().then(llenarDatos); |
30 | focaModalRemitoService | ||
31 | .getRemitosByIdLista(parametroRemito.idLista, $scope.filters) | ||
32 | .then(llenarDatos); | ||
33 | } else if(parametroRemito.idLista === -1) { | ||
34 | focaModalRemitoService.getRemitos() | ||
35 | .then(llenarDatos); | ||
36 | } | ||
37 | } | 28 | } |
38 | }; | 29 | }; |
39 | function llenarDatos(res) { | 30 | function llenarDatos(res) { |
40 | for(var i = 0; i < res.data.length; i++) { | ||
41 | res.data[i].precio = res.data[i].precio / parametroRemito.cotizacion; | ||
42 | } | ||
43 | $scope.searchLoading = false; | 31 | $scope.searchLoading = false; |
44 | $scope.primerBusqueda = true; | 32 | $scope.primerBusqueda = true; |
45 | $scope.remitos = res.data; | 33 | $scope.remitos = res.data; |
46 | $scope.search(); | 34 | $scope.search(); |
47 | primera(); | 35 | primera(); |
48 | } | 36 | } |
49 | $scope.search = function() { | 37 | $scope.search = function() { |
50 | if($scope.remitos.length > 0) { | 38 | if($scope.remitos.length > 0) { |
51 | $scope.filteredRemitos = $filter('filter')( | 39 | $scope.filteredRemitos = $filter('filter')( |
52 | $scope.remitos, | 40 | $scope.remitos, |
53 | {$: $scope.filters} | 41 | {$: $scope.filters} |
54 | ); | 42 | ); |
55 | 43 | ||
56 | $scope.lastPage = Math.ceil( | 44 | $scope.lastPage = Math.ceil( |
57 | $scope.filteredRemitos.length / $scope.numPerPage | 45 | $scope.filteredRemitos.length / $scope.numPerPage |
58 | ); | 46 | ); |
59 | 47 | ||
60 | $scope.resetPage(); | 48 | $scope.resetPage(); |
61 | } | 49 | } |
62 | }; | 50 | }; |
63 | 51 | ||
64 | $scope.resetPage = function() { | 52 | $scope.resetPage = function() { |
65 | $scope.currentPage = 1; | 53 | $scope.currentPage = 1; |
66 | $scope.selectPage(1); | 54 | $scope.selectPage(1); |
67 | }; | 55 | }; |
68 | 56 | ||
69 | $scope.selectPage = function(page) { | 57 | $scope.selectPage = function(page) { |
70 | var start = (page - 1) * $scope.numPerPage; | 58 | var start = (page - 1) * $scope.numPerPage; |
71 | var end = start + $scope.numPerPage; | 59 | var end = start + $scope.numPerPage; |
72 | $scope.paginas = []; | 60 | $scope.paginas = []; |
73 | $scope.paginas = calcularPages(page); | 61 | $scope.paginas = calcularPages(page); |
74 | $scope.currentPageRemitos = $scope.filteredRemitos.slice(start, end); | 62 | $scope.currentPageRemitos = $scope.filteredRemitos.slice(start, end); |
75 | $scope.currentPage = page; | 63 | $scope.currentPage = page; |
76 | }; | 64 | }; |
77 | 65 | ||
78 | $scope.select = function(remito) { | 66 | $scope.select = function(remito) { |
79 | $uibModalInstance.close(remito); | 67 | $uibModalInstance.close(remito); |
80 | }; | 68 | }; |
81 | 69 | ||
82 | $scope.cancel = function() { | 70 | $scope.cancel = function() { |
83 | $uibModalInstance.dismiss('cancel'); | 71 | $uibModalInstance.dismiss('cancel'); |
84 | }; | 72 | }; |
85 | 73 | ||
86 | $scope.busquedaDown = function(key) { | 74 | $scope.busquedaDown = function(key) { |
87 | if (key === 40) { | 75 | if (key === 40) { |
88 | primera(key); | 76 | primera(key); |
89 | } | 77 | } |
90 | }; | 78 | }; |
91 | 79 | ||
92 | $scope.itemRemito = function(key) { | 80 | $scope.itemRemito = function(key) { |
93 | if (key === 38) { | 81 | if (key === 38) { |
94 | anterior(key); | 82 | anterior(key); |
95 | } | 83 | } |
96 | 84 | ||
97 | if (key === 40) { | 85 | if (key === 40) { |
98 | siguiente(key); | 86 | siguiente(key); |
99 | } | 87 | } |
100 | 88 | ||
101 | if (key === 37) { | 89 | if (key === 37) { |
102 | retrocederPagina(); | 90 | retrocederPagina(); |
103 | } | 91 | } |
104 | 92 | ||
105 | if (key === 39) { | 93 | if (key === 39) { |
106 | avanzarPagina(); | 94 | avanzarPagina(); |
107 | } | 95 | } |
108 | }; | 96 | }; |
109 | 97 | ||
110 | function calcularPages(paginaActual) { | 98 | function calcularPages(paginaActual) { |
111 | var paginas = []; | 99 | var paginas = []; |
112 | paginas.push(paginaActual); | 100 | paginas.push(paginaActual); |
113 | 101 | ||
114 | if (paginaActual - 1 > 1) { | 102 | if (paginaActual - 1 > 1) { |
115 | 103 | ||
116 | paginas.unshift(paginaActual - 1); | 104 | paginas.unshift(paginaActual - 1); |
117 | if (paginaActual - 2 > 1) { | 105 | if (paginaActual - 2 > 1) { |
118 | paginas.unshift(paginaActual - 2); | 106 | paginas.unshift(paginaActual - 2); |
119 | } | 107 | } |
120 | } | 108 | } |
121 | 109 | ||
122 | if (paginaActual + 1 < $scope.lastPage) { | 110 | if (paginaActual + 1 < $scope.lastPage) { |
123 | paginas.push(paginaActual + 1); | 111 | paginas.push(paginaActual + 1); |
124 | if (paginaActual + 2 < $scope.lastPage) { | 112 | if (paginaActual + 2 < $scope.lastPage) { |
125 | paginas.push(paginaActual + 2); | 113 | paginas.push(paginaActual + 2); |
126 | } | 114 | } |
127 | } | 115 | } |
128 | 116 | ||
129 | if (paginaActual !== 1) { | 117 | if (paginaActual !== 1) { |
130 | paginas.unshift(1); | 118 | paginas.unshift(1); |
131 | } | 119 | } |
132 | 120 | ||
133 | if (paginaActual !== $scope.lastPage) { | 121 | if (paginaActual !== $scope.lastPage) { |
134 | paginas.push($scope.lastPage); | 122 | paginas.push($scope.lastPage); |
135 | } | 123 | } |
136 | 124 | ||
137 | return paginas; | 125 | return paginas; |
138 | } | 126 | } |
139 | 127 | ||
140 | function primera() { | 128 | function primera() { |
141 | $scope.selectedRemito = 0; | 129 | $scope.selectedRemito = 0; |
142 | } | 130 | } |
143 | 131 | ||
144 | function anterior() { | 132 | function anterior() { |
145 | if ($scope.selectedRemito === 0 && $scope.currentPage > 1) { | 133 | if ($scope.selectedRemito === 0 && $scope.currentPage > 1) { |
146 | retrocederPagina(); | 134 | retrocederPagina(); |
147 | } else { | 135 | } else { |
148 | $scope.selectedRemito--; | 136 | $scope.selectedRemito--; |
149 | } | 137 | } |
150 | } | 138 | } |
151 | 139 | ||
152 | function siguiente() { | 140 | function siguiente() { |
153 | if ($scope.selectedRemito < $scope.currentPageRemitos.length - 1 ) { | 141 | if ($scope.selectedRemito < $scope.currentPageRemitos.length - 1 ) { |
154 | $scope.selectedRemito++; | 142 | $scope.selectedRemito++; |
155 | } else { | 143 | } else { |
156 | avanzarPagina(); | 144 | avanzarPagina(); |
157 | } | 145 | } |
158 | } | 146 | } |
159 | 147 | ||
160 | function retrocederPagina() { | 148 | function retrocederPagina() { |
161 | if ($scope.currentPage > 1) { | 149 | if ($scope.currentPage > 1) { |
162 | $scope.selectPage($scope.currentPage - 1); | 150 | $scope.selectPage($scope.currentPage - 1); |
163 | $scope.selectedRemito = $scope.numPerPage - 1; | 151 | $scope.selectedRemito = $scope.numPerPage - 1; |
164 | } | 152 | } |
165 | } | 153 | } |
166 | 154 | ||
167 | function avanzarPagina() { | 155 | function avanzarPagina() { |
168 | if ($scope.currentPage < $scope.lastPage) { | 156 | if ($scope.currentPage < $scope.lastPage) { |
169 | $scope.selectPage($scope.currentPage + 1); | 157 | $scope.selectPage($scope.currentPage + 1); |
170 | $scope.selectedRemito = 0; | 158 | $scope.selectedRemito = 0; |
171 | } | 159 | } |
172 | } | 160 | } |
173 | } | 161 | } |
174 | ] | 162 | ] |
175 | ); | 163 | ); |
176 | 164 |
src/js/service.js
1 | angular.module('focaModalRemito') | 1 | angular.module('focaModalRemito') |
2 | .service('focaModalRemitoService', [ | 2 | .service('focaModalRemitoService', [ |
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 | getRemitos: function() { | 7 | getRemitos: function() { |
8 | return $http.get(API_ENDPOINT.URL + '/articulos'); | 8 | return $http.get(API_ENDPOINT.URL + '/remito'); |
9 | }, | ||
10 | getRemitosByIdLista: function(id, filters) { | ||
11 | return $http.post(API_ENDPOINT.URL + '/articulos/lista', | ||
12 | {filters: filters, id: id}); | ||
13 | } | 9 | } |
14 | }; | 10 | }; |
15 | } | 11 | } |
16 | ]); | 12 | ]); |
17 | 13 |
src/views/foca-modal-remito.html
1 | <div class="modal-header py-1"> | 1 | <div class="modal-header py-1"> |
2 | <h5 class="modal-title">Busqueda de Remito</h5> | 2 | <h5 class="modal-title">Busqueda de Remito</h5> |
3 | </div> | 3 | </div> |
4 | <div class="modal-body" id="modal-body"> | 4 | <div class="modal-body" id="modal-body"> |
5 | <div class="input-group"> | 5 | <div class="input-group"> |
6 | <input | 6 | <input |
7 | ladda="searchLoading" | 7 | ladda="searchLoading" |
8 | type="text" | 8 | type="text" |
9 | class="form-control" | 9 | class="form-control" |
10 | placeholder="Busqueda" | 10 | placeholder="Busqueda" |
11 | ng-model="filters" | 11 | ng-model="filters" |
12 | ng-change="search()" | 12 | ng-change="search()" |
13 | ng-keydown="busquedaDown($event.keyCode)" | 13 | ng-keydown="busquedaDown($event.keyCode)" |
14 | ng-keypress="busquedaPress($event.keyCode)" | 14 | ng-keypress="busquedaPress($event.keyCode)" |
15 | foca-focus="selectedRemito == -1" | 15 | foca-focus="selectedRemito == -1" |
16 | ng-focus="selectedRemito = -1" | 16 | ng-focus="selectedRemito = -1" |
17 | > | 17 | > |
18 | <div class="input-group-append"> | 18 | <div class="input-group-append"> |
19 | <button | 19 | <button |
20 | ladda="searchLoading" | 20 | ladda="searchLoading" |
21 | class="btn btn-outline-secondary" | 21 | class="btn btn-outline-secondary" |
22 | type="button" | 22 | type="button" |
23 | ng-click="busquedaPress(13)" | 23 | ng-click="busquedaPress(13)" |
24 | > | 24 | > |
25 | <i class="fa fa-search" aria-hidden="true"></i> | 25 | <i class="fa fa-search" aria-hidden="true"></i> |
26 | </button> | 26 | </button> |
27 | </div> | 27 | </div> |
28 | </div> | 28 | </div> |
29 | <table ng-show="primerBusqueda" class="table table-striped table-sm"> | 29 | <table ng-show="primerBusqueda" class="table table-striped table-sm"> |
30 | <thead> | 30 | <thead> |
31 | <tr> | 31 | <tr> |
32 | <th>Sec.</th> | 32 | <th>Fecha</th> |
33 | <th>Cod.</th> | 33 | <th>Cliente</th> |
34 | <th>Descripción</th> | 34 | <th>Comprobante</th> |
35 | <th>P. Base</th> | ||
36 | <th></th> | 35 | <th></th> |
37 | </tr> | 36 | </tr> |
38 | </thead> | 37 | </thead> |
39 | <tbody> | 38 | <tbody> |
40 | <tr ng-show="currentPageRemitos.length == 0 && primerBusqueda"> | 39 | <tr ng-show="currentPageRemitos.length == 0 && primerBusqueda"> |
41 | <td colspan="5"> | 40 | <td colspan="5"> |
42 | No se encontraron resultados. | 41 | No se encontraron resultados. |
43 | </td> | 42 | </td> |
44 | </tr> | 43 | </tr> |
45 | <tr class="selectable" | 44 | <tr class="selectable" |
46 | ng-repeat="(key,remito) in currentPageRemitos" | 45 | ng-repeat="(key, remito) in currentPageRemitos" |
47 | ng-click="select(remito)"> | 46 | ng-click="select(remito)"> |
48 | <td ng-bind="remito.sector"></td> | 47 | <td ng-bind="remito.fechaRemito | date : 'dd/MM/yyyy'"></td> |
49 | <td ng-bind="remito.codigo"></td> | 48 | <td ng-bind="remito.nombreCliente"></td> |
50 | <td ng-bind="remito.descripcion"></td> | 49 | <td ng-bind="[remito.sucursal, remito.numeroRemito] | comprobante"></td> |
51 | <td ng-bind="remito.precio | currency: simbolo : 4"></td> | ||
52 | <td> | 50 | <td> |
53 | <button | 51 | <button |
54 | type="button" | 52 | type="button" |
55 | class="btn btn-xs p-1 float-right" | 53 | class="btn btn-xs p-1 float-right" |
56 | ng-class="{ | 54 | ng-class="{ |
57 | 'btn-secondary': selectedRemito != key, | 55 | 'btn-secondary': selectedRemito != key, |
58 | 'btn-primary': selectedRemito == key | 56 | 'btn-primary': selectedRemito == key |
59 | }" | 57 | }" |
60 | foca-focus="selectedRemito == {{key}}" | 58 | foca-focus="selectedRemito == {{key}}" |
61 | ng-keydown="itemRemito($event.keyCode)" | 59 | ng-keydown="itemRemito($event.keyCode)" |
62 | > | 60 | > |
63 | <i class="fa fa-arrow-right" aria-hidden="true"></i> | 61 | <i class="fa fa-arrow-right" aria-hidden="true"></i> |
64 | </button> | 62 | </button> |
65 | </td> | 63 | </td> |
66 | </tr> | 64 | </tr> |
67 | </tbody> | 65 | </tbody> |
68 | </table> | 66 | </table> |
69 | <nav ng-show="currentPageRemitos.length > 0 && primerBusqueda"> | 67 | <nav ng-show="currentPageRemitos.length > 0 && primerBusqueda"> |
70 | <ul class="pagination pagination-sm justify-content mb-0"> | 68 | <ul class="pagination pagination-sm justify-content mb-0"> |
71 | <li class="page-item" ng-class="{'disabled': currentPage == 1}"> | 69 | <li class="page-item" ng-class="{'disabled': currentPage == 1}"> |
72 | <a class="page-link" href="#" ng-click="selectPage(currentPage - 1)"> | 70 | <a class="page-link" href="#" ng-click="selectPage(currentPage - 1)"> |
73 | <span aria-hidden="true">«</span> | 71 | <span aria-hidden="true">«</span> |
74 | <span class="sr-only">Anterior</span> | 72 | <span class="sr-only">Anterior</span> |
75 | </a> | 73 | </a> |
76 | </li> | 74 | </li> |
77 | <li | 75 | <li |
78 | class="page-item" | 76 | class="page-item" |
79 | ng-repeat="pagina in paginas" | 77 | ng-repeat="pagina in paginas" |
80 | ng-class="{'active': pagina == currentPage}" | 78 | ng-class="{'active': pagina == currentPage}" |
81 | > | 79 | > |
82 | <a | 80 | <a |
83 | class="page-link" | 81 | class="page-link" |
84 | href="#" | 82 | href="#" |
85 | ng-click="selectPage(pagina)" | 83 | ng-click="selectPage(pagina)" |
86 | ng-bind="pagina" | 84 | ng-bind="pagina" |
87 | ></a> | 85 | ></a> |
88 | </li> | 86 | </li> |
89 | <li class="page-item" ng-class="{'disabled': currentPage == lastPage}"> | 87 | <li class="page-item" ng-class="{'disabled': currentPage == lastPage}"> |
90 | <a class="page-link" href="#" ng-click="selectPage(currentPage + 1)"> | 88 | <a class="page-link" href="#" ng-click="selectPage(currentPage + 1)"> |
91 | <span aria-hidden="true">»</span> | 89 | <span aria-hidden="true">»</span> |
92 | <span class="sr-only">Siguiente</span> | 90 | <span class="sr-only">Siguiente</span> |
93 | </a> | 91 | </a> |
94 | </li> | 92 | </li> |
95 | </ul> | 93 | </ul> |
96 | </nav> | 94 | </nav> |
97 | </div> | 95 | </div> |
98 | <div class="modal-footer py-1"> | 96 | <div class="modal-footer py-1"> |
99 | <button class="btn btn-sm btn-secondary" type="button" ng-click="cancel()">Cancelar</button> | 97 | <button class="btn btn-sm btn-secondary" type="button" ng-click="cancel()">Cancelar</button> |
100 | </div> | 98 | </div> |
101 | 99 |