Commit e77f489f6e50d66162ea2cef1e6a32bd28e2b65c
Exists in
master
Merge branch 'master' into 'master'
Master(efernandez) See merge request !4
Showing
14 changed files
Show diff stats
.gitignore
| 1 | # See http://help.github.com/ignore-files/ for more about ignoring files. | 1 | # See http://help.github.com/ignore-files/ for more about ignoring files. |
| 2 | 2 | ||
| 3 | # compiled output | 3 | # compiled output |
| 4 | /dist | 4 | /dist |
| 5 | /tmp | 5 | /tmp |
| 6 | /out-tsc | 6 | /out-tsc |
| 7 | |||
| 7 | # Only exists if Bazel was run | 8 | # Only exists if Bazel was run |
| 8 | /bazel-out | 9 | /bazel-out |
| 9 | 10 | ||
| 10 | # dependencies | 11 | # dependencies |
| 11 | /node_modules | 12 | /node_modules |
| 12 | /www/* | 13 | /www/* |
| 13 | /plugins/* | 14 | /plugins/* |
| 14 | /platforms/* | 15 | /platforms/* |
| 15 | 16 | ||
| 16 | # profiling files | 17 | # profiling files |
| 17 | chrome-profiler-events.json | 18 | chrome-profiler-events.json |
| 18 | speed-measure-plugin.json | 19 | speed-measure-plugin.json |
| 19 | 20 | ||
| 20 | # IDEs and editors | 21 | # IDEs and editors |
| 21 | /.idea | 22 | /.idea |
| 22 | .project | 23 | .project |
| 23 | .classpath | 24 | .classpath |
| 24 | .c9/ | 25 | .c9/ |
| 25 | *.launch | 26 | *.launch |
| 26 | .settings/ | 27 | .settings/ |
| 27 | *.sublime-workspace | 28 | *.sublime-workspace |
| 28 | 29 | ||
| 29 | # IDE - VSCode | 30 | # IDE - VSCode |
| 30 | .vscode/* | 31 | .vscode/* |
| 31 | !.vscode/settings.json | 32 | !.vscode/settings.json |
| 32 | !.vscode/tasks.json | 33 | !.vscode/tasks.json |
| 33 | !.vscode/launch.json | 34 | !.vscode/launch.json |
| 34 | !.vscode/extensions.json | 35 | !.vscode/extensions.json |
| 35 | .history/* | 36 | .history/* |
| 36 | 37 | ||
| 37 | # misc | 38 | # misc |
| 38 | /.sass-cache | 39 | /.sass-cache |
| 39 | /connect.lock | 40 | /connect.lock |
| 40 | /coverage | 41 | /coverage |
| 41 | /libpeerconnection.log | 42 | /libpeerconnection.log |
| 42 | npm-debug.log | 43 | npm-debug.log |
| 43 | yarn-error.log | 44 | yarn-error.log |
| 44 | testem.log | 45 | testem.log |
| 45 | /typings | 46 | /typings |
| 46 | 47 | ||
| 47 | # System Files | 48 | # System Files |
| 48 | .DS_Store | 49 | .DS_Store |
| 49 | Thumbs.db | 50 | Thumbs.db |
| 51 | |||
| 52 | # config | ||
| 53 | /etc/AppSeting.ts | ||
| 50 | 54 |
angular.json
| 1 | { | 1 | { |
| 2 | "$schema": "./node_modules/@angular/cli/lib/config/schema.json", | 2 | "$schema": "./node_modules/@angular/cli/lib/config/schema.json", |
| 3 | "version": 1, | 3 | "version": 1, |
| 4 | "newProjectRoot": "projects", | 4 | "newProjectRoot": "projects", |
| 5 | "projects": { | 5 | "projects": { |
| 6 | "distribucion-comprobantes": { | 6 | "distribucion-comprobantes": { |
| 7 | "projectType": "application", | 7 | "projectType": "application", |
| 8 | "schematics": {}, | 8 | "schematics": {}, |
| 9 | "root": "", | 9 | "root": "", |
| 10 | "sourceRoot": "src", | 10 | "sourceRoot": "src", |
| 11 | "prefix": "app", | 11 | "prefix": "app", |
| 12 | "architect": { | 12 | "architect": { |
| 13 | "build": { | 13 | "build": { |
| 14 | "builder": "@angular-devkit/build-angular:browser", | 14 | "builder": "@angular-devkit/build-angular:browser", |
| 15 | "options": { | 15 | "options": { |
| 16 | "outputPath": "www", | 16 | "outputPath": "www", |
| 17 | "index": "src/index.html", | 17 | "index": "src/index.html", |
| 18 | "main": "src/main.ts", | 18 | "main": "src/main.ts", |
| 19 | "polyfills": "src/polyfills.ts", | 19 | "polyfills": "src/polyfills.ts", |
| 20 | "tsConfig": "tsconfig.app.json", | 20 | "tsConfig": "tsconfig.app.json", |
| 21 | "assets": [ | 21 | "assets": [ |
| 22 | "src/favicon.ico", | 22 | "src/favicon.ico", |
| 23 | "src/assets" | 23 | "src/assets" |
| 24 | ], | 24 | ], |
| 25 | "styles": [ | 25 | "styles": [ |
| 26 | "src/styles.css" | 26 | "src/styles.css" |
| 27 | ], | 27 | ], |
| 28 | "scripts": [] | 28 | "scripts": [] |
| 29 | }, | 29 | }, |
| 30 | "configurations": { | 30 | "configurations": { |
| 31 | "production": { | 31 | "production": { |
| 32 | "fileReplacements": [ | 32 | "fileReplacements": [ |
| 33 | { | 33 | { |
| 34 | "replace": "src/environments/environment.ts", | 34 | "replace": "src/environments/environment.ts", |
| 35 | "with": "src/environments/environment.prod.ts" | 35 | "with": "src/environments/environment.prod.ts" |
| 36 | } | 36 | } |
| 37 | ], | 37 | ], |
| 38 | "optimization": true, | 38 | "optimization": true, |
| 39 | "outputHashing": "all", | 39 | "outputHashing": "all", |
| 40 | "sourceMap": false, | 40 | "sourceMap": false, |
| 41 | "extractCss": true, | 41 | "extractCss": true, |
| 42 | "namedChunks": false, | 42 | "namedChunks": false, |
| 43 | "aot": true, | 43 | "aot": true, |
| 44 | "extractLicenses": true, | 44 | "extractLicenses": true, |
| 45 | "vendorChunk": false, | 45 | "vendorChunk": false, |
| 46 | "buildOptimizer": true, | 46 | "buildOptimizer": true, |
| 47 | "budgets": [ | 47 | "budgets": [ |
| 48 | { | 48 | { |
| 49 | "type": "initial", | 49 | "type": "initial", |
| 50 | "maximumWarning": "2mb", | 50 | "maximumWarning": "2mb", |
| 51 | "maximumError": "5mb" | 51 | "maximumError": "5mb" |
| 52 | } | 52 | } |
| 53 | ] | 53 | ] |
| 54 | } | 54 | } |
| 55 | } | 55 | } |
| 56 | }, | 56 | }, |
| 57 | "serve": { | 57 | "serve": { |
| 58 | "builder": "@angular-devkit/build-angular:dev-server", | 58 | "builder": "@angular-devkit/build-angular:dev-server", |
| 59 | "options": { | 59 | "options": { |
| 60 | "browserTarget": "distribucion-comprobantes:build" | 60 | "browserTarget": "distribucion-comprobantes:build" |
| 61 | }, | 61 | }, |
| 62 | "configurations": { | 62 | "configurations": { |
| 63 | "production": { | 63 | "production": { |
| 64 | "browserTarget": "distribucion-comprobantes:build:production" | 64 | "browserTarget": "distribucion-comprobantes:build:production" |
| 65 | } | 65 | } |
| 66 | } | 66 | } |
| 67 | }, | 67 | }, |
| 68 | "extract-i18n": { | 68 | "extract-i18n": { |
| 69 | "builder": "@angular-devkit/build-angular:extract-i18n", | 69 | "builder": "@angular-devkit/build-angular:extract-i18n", |
| 70 | "options": { | 70 | "options": { |
| 71 | "browserTarget": "distribucion-comprobantes:build" | 71 | "browserTarget": "distribucion-comprobantes:build" |
| 72 | } | 72 | } |
| 73 | }, | 73 | }, |
| 74 | "test": { | 74 | "test": { |
| 75 | "builder": "@angular-devkit/build-angular:karma", | 75 | "builder": "@angular-devkit/build-angular:karma", |
| 76 | "options": { | 76 | "options": { |
| 77 | "main": "src/test.ts", | 77 | "main": "src/test.ts", |
| 78 | "polyfills": "src/polyfills.ts", | 78 | "polyfills": "src/polyfills.ts", |
| 79 | "tsConfig": "tsconfig.spec.json", | 79 | "tsConfig": "tsconfig.spec.json", |
| 80 | "karmaConfig": "karma.conf.js", | 80 | "karmaConfig": "karma.conf.js", |
| 81 | "assets": [ | 81 | "assets": [ |
| 82 | "src/favicon.ico", | 82 | "src/favicon.ico", |
| 83 | "src/assets" | 83 | "src/assets" |
| 84 | ], | 84 | ], |
| 85 | "styles": [ | 85 | "styles": [ |
| 86 | "src/styles.css" | 86 | "src/styles.css" |
| 87 | ], | 87 | ], |
| 88 | "scripts": [] | 88 | "scripts": [] |
| 89 | } | 89 | } |
| 90 | }, | 90 | }, |
| 91 | "lint": { | 91 | "lint": { |
| 92 | "builder": "@angular-devkit/build-angular:tslint", | 92 | "builder": "@angular-devkit/build-angular:tslint", |
| 93 | "options": { | 93 | "options": { |
| 94 | "tsConfig": [ | 94 | "tsConfig": [ |
| 95 | "tsconfig.app.json", | 95 | "tsconfig.app.json", |
| 96 | "tsconfig.spec.json", | 96 | "tsconfig.spec.json", |
| 97 | "e2e/tsconfig.json" | 97 | "e2e/tsconfig.json" |
| 98 | ], | 98 | ], |
| 99 | "exclude": [ | 99 | "exclude": [ |
| 100 | "**/node_modules/**" | 100 | "**/node_modules/**" |
| 101 | ] | 101 | ] |
| 102 | } | 102 | } |
| 103 | }, | 103 | }, |
| 104 | "e2e": { | 104 | "e2e": { |
| 105 | "builder": "@angular-devkit/build-angular:protractor", | 105 | "builder": "@angular-devkit/build-angular:protractor", |
| 106 | "options": { | 106 | "options": { |
| 107 | "protractorConfig": "e2e/protractor.conf.js", | 107 | "protractorConfig": "e2e/protractor.conf.js", |
| 108 | "devServerTarget": "distribucion-comprobantes:serve" | 108 | "devServerTarget": "distribucion-comprobantes:serve" |
| 109 | }, | 109 | }, |
| 110 | "configurations": { | 110 | "configurations": { |
| 111 | "production": { | 111 | "production": { |
| 112 | "devServerTarget": "distribucion-comprobantes:serve:production" | 112 | "devServerTarget": "distribucion-comprobantes:serve:production" |
| 113 | } | 113 | } |
| 114 | } | 114 | } |
| 115 | } | 115 | } |
| 116 | } | 116 | } |
| 117 | }}, | 117 | }}, |
| 118 | "defaultProject": "distribucion-comprobantes" | 118 | "defaultProject": "distribucion-comprobantes" |
| 119 | } | ||
| 119 | } |
package.json
| 1 | { | 1 | { |
| 2 | "name": "distribucion-comprobantes", | 2 | "name": "distribucion-comprobantes", |
| 3 | "version": "0.0.0", | 3 | "version": "0.0.0", |
| 4 | "scripts": { | 4 | "scripts": { |
| 5 | "ng": "ng", | 5 | "ng": "ng", |
| 6 | "start": "ng serve", | 6 | "start": "ng serve", |
| 7 | "build": "ng build", | 7 | "build": "ng build", |
| 8 | "test": "ng test", | 8 | "test": "ng test", |
| 9 | "lint": "ng lint", | 9 | "lint": "ng lint", |
| 10 | "e2e": "ng e2e" | 10 | "e2e": "ng e2e", |
| 11 | "apkToDrop": "cp ./platforms/android/app/build/outputs/apk/debug/app-debug.apk C:/Users/Usuario/Dropbox/Apks_PlanexDEBO/v0.0.1" | ||
| 11 | }, | 12 | }, |
| 12 | "private": true, | 13 | "private": true, |
| 13 | "dependencies": { | 14 | "dependencies": { |
| 14 | "@angular/animations": "~8.0.0", | 15 | "@angular/animations": "~8.0.0", |
| 15 | "@angular/common": "~8.0.0", | 16 | "@angular/common": "~8.0.0", |
| 16 | "@angular/compiler": "~8.0.0", | 17 | "@angular/compiler": "~8.0.0", |
| 17 | "@angular/core": "~8.0.0", | 18 | "@angular/core": "~8.0.0", |
| 18 | "@angular/forms": "~8.0.0", | 19 | "@angular/forms": "~8.0.0", |
| 19 | "@angular/platform-browser": "~8.0.0", | 20 | "@angular/platform-browser": "~8.0.0", |
| 20 | "@angular/platform-browser-dynamic": "~8.0.0", | 21 | "@angular/platform-browser-dynamic": "~8.0.0", |
| 21 | "@angular/router": "~8.0.0", | 22 | "@angular/router": "~8.0.0", |
| 22 | "@ng-bootstrap/ng-bootstrap": "^4.2.0", | 23 | "@ng-bootstrap/ng-bootstrap": "^4.2.0", |
| 23 | "angular2-ladda": "^2.0.1", | 24 | "angular2-ladda": "^2.0.1", |
| 24 | "cordova-android": "^8.0.0", | 25 | "cordova-android": "^8.0.0", |
| 25 | "font-awesome": "^4.7.0", | 26 | "font-awesome": "^4.7.0", |
| 26 | "rxjs": "~6.4.0", | 27 | "rxjs": "~6.4.0", |
| 27 | "tslib": "^1.9.0", | 28 | "tslib": "^1.9.0", |
| 28 | "zone.js": "~0.9.1" | 29 | "zone.js": "~0.9.1" |
| 29 | }, | 30 | }, |
| 30 | "devDependencies": { | 31 | "devDependencies": { |
| 31 | "@angular-devkit/build-angular": "~0.800.0", | 32 | "@angular-devkit/build-angular": "~0.800.0", |
| 32 | "@angular/cli": "~8.0.0", | 33 | "@angular/cli": "~8.0.0", |
| 33 | "@angular/compiler-cli": "~8.0.0", | 34 | "@angular/compiler-cli": "~8.0.0", |
| 34 | "@angular/language-service": "~8.0.0", | 35 | "@angular/language-service": "~8.0.0", |
| 35 | "@types/node": "~8.9.4", | 36 | "@types/node": "~8.9.4", |
| 36 | "@types/jasmine": "~3.3.8", | 37 | "@types/jasmine": "~3.3.8", |
| 37 | "@types/jasminewd2": "~2.0.3", | 38 | "@types/jasminewd2": "~2.0.3", |
| 38 | "codelyzer": "^5.0.0", | 39 | "codelyzer": "^5.0.0", |
| 39 | "jasmine-core": "~3.4.0", | 40 | "jasmine-core": "~3.4.0", |
| 40 | "jasmine-spec-reporter": "~4.2.1", | 41 | "jasmine-spec-reporter": "~4.2.1", |
| 41 | "karma": "~4.1.0", | 42 | "karma": "~4.1.0", |
| 42 | "karma-chrome-launcher": "~2.2.0", | 43 | "karma-chrome-launcher": "~2.2.0", |
| 43 | "karma-coverage-istanbul-reporter": "~2.0.1", | 44 | "karma-coverage-istanbul-reporter": "~2.0.1", |
| 44 | "karma-jasmine": "~2.0.1", | 45 | "karma-jasmine": "~2.0.1", |
| 45 | "karma-jasmine-html-reporter": "^1.4.0", | 46 | "karma-jasmine-html-reporter": "^1.4.0", |
| 46 | "protractor": "~5.4.0", | 47 | "protractor": "~5.4.0", |
| 47 | "ts-node": "~7.0.0", | 48 | "ts-node": "~7.0.0", |
| 48 | "tslint": "~5.15.0", | 49 | "tslint": "~5.15.0", |
| 49 | "typescript": "~3.4.3" | 50 | "typescript": "~3.4.3" |
| 50 | }, | 51 | }, |
| 51 | "cordova": { | 52 | "cordova": { |
| 52 | "plugins": { | 53 | "plugins": { |
| 53 | "cordova-plugin-whitelist": {} | 54 | "cordova-plugin-whitelist": {} |
| 54 | }, | 55 | }, |
| 55 | "platforms": [ | 56 | "platforms": [ |
| 56 | "android" | 57 | "android" |
| 57 | ] | 58 | ] |
| 58 | } | 59 | } |
| 59 | } | 60 | } |
src/app/boton-service.service.ts
| 1 | import { Injectable } from '@angular/core'; | 1 | import { Injectable } from '@angular/core'; |
| 2 | import { HttpClient } from '@angular/common/http'; | 2 | // import { HttpClient } from '@angular/common/http'; |
| 3 | 3 | ||
| 4 | @Injectable({ | 4 | @Injectable({ |
| 5 | providedIn: 'root' | 5 | providedIn: 'root' |
| 6 | }) | 6 | }) |
| 7 | export class BotonServiceService { | 7 | export class BotonServiceService { |
| 8 | 8 | ||
| 9 | constructor(private http: String) { } | 9 | constructor(/*private http: String*/) { } |
| 10 | 10 | ||
| 11 | getBotones() { | 11 | getBotones() { |
| 12 | // return this.http.get('http://localhost:5555/comprobantes'); | 12 | // return this.http.get('http://localhost:5555/comprobantes'); |
| 13 | return [1]; | 13 | return [1]; |
| 14 | } | 14 | } |
| 15 | } | 15 | } |
| 16 | 16 |
src/app/botonera/botonera.component.html
| 1 | <div class="col-6"> | 1 | <div class="col-6"> |
| 2 | <img src="assets/img/logo.png" class="botonera-principal-logo"> | 2 | <img src="assets/img/logo.png" class="botonera-principal-logo"> |
| 3 | </div> | 3 | </div> |
| 4 | <div class="pt-5 row"> | 4 | <div class="pt-5 row"> |
| 5 | <div class="swiper col-12"> | 5 | <div class="swiper col-12"> |
| 6 | <a class="botonera-principal-comprobante" routerLink="/comprobantes"> | 6 | <a class="botonera-principal-comprobante" routerLink="/comprobantes"> |
| 7 | <span>Lista comprobantes</span> | 7 | <span>Lista comprobantes</span> |
| 8 | </a> | 8 | </a> |
| 9 | </div> | 9 | </div> |
| 10 | <div class="d-none d-sm-block"> | 10 | <div class="d-none d-sm-block"> |
| 11 | <a | 11 | <a |
| 12 | class="btn btn-outline-dark mt-5 btn-lg" | 12 | class="btn btn-outline-dark mt-5 btn-lg" |
| 13 | href="javascript:void()" | 13 | href="javascript:void()" |
| 14 | ng-click="showTerminal()" | 14 | (click)="showTerminal()" |
| 15 | > | 15 | > |
| 16 | <i class="fa fa-info-circle" aria-hidden="true"></i> | 16 | <i class="fa fa-info-circle" aria-hidden="true"></i> |
| 17 | </a> | 17 | </a> |
| 18 | <a class="btn btn-outline-dark mt-5 btn-lg" | 18 | <a class="btn btn-outline-dark mt-5 btn-lg" |
| 19 | href="javascript:void()" | 19 | href="javascript:void()" |
| 20 | ng-click="logout()" | 20 | routerLink="/login" |
| 21 | > | 21 | > |
| 22 | <i class="fa fa-power-off" aria-hidden="true"></i> | 22 | <i class="fa fa-power-off" aria-hidden="true"></i> |
| 23 | </a> | 23 | </a> |
| 24 | </div> | 24 | </div> |
| 25 | <div class="row d-md-none fixed-bottom"> | 25 | <div class="row d-md-none fixed-bottom"> |
| 26 | <div class="w-100 d-flex px-3 acciones-mobile"> | 26 | <div class="w-100 d-flex px-3 acciones-mobile"> |
| 27 | <a | 27 | <a |
| 28 | class="btn btn-outline-dark btn-lg mr-2" | 28 | class="btn btn-outline-dark btn-lg mr-2" |
| 29 | href="javascript:void()" | 29 | href="javascript:void()" |
| 30 | ng-click="showTerminal()" | 30 | (click)="showTerminal()" |
| 31 | > | 31 | > |
| 32 | <i class="fa fa-info-circle" aria-hidden="true"></i> | 32 | <i class="fa fa-info-circle" aria-hidden="true"></i> |
| 33 | </a> | 33 | </a> |
| 34 | <a class="btn btn-outline-dark btn-lg" | 34 | <a class="btn btn-outline-dark btn-lg" |
| 35 | href="javascript:void()" | 35 | href="javascript:void()" |
| 36 | ng-click="logout()" | 36 | routerLink="/login" |
| 37 | > | 37 | > |
| 38 | <i class="fa fa-power-off" aria-hidden="true"></i> | 38 | <i class="fa fa-power-off" aria-hidden="true"></i> |
| 39 | </a> | 39 | </a> |
| 40 | </div> | 40 | </div> |
| 41 | </div> | 41 | </div> |
| 42 | </div> | 42 | </div> |
| 43 | 43 |
src/app/botonera/botonera.component.ts
| 1 | import { Component } from '@angular/core'; | 1 | import { Component } from '@angular/core'; |
| 2 | import { BotonServiceService } from 'src/app/boton-service.service'; | 2 | import { BotonServiceService } from 'src/app/boton-service.service'; |
| 3 | 3 | ||
| 4 | @Component({ | 4 | @Component({ |
| 5 | selector: 'app-botonera', | 5 | selector: 'app-botonera', |
| 6 | templateUrl: './botonera.component.html', | 6 | templateUrl: './botonera.component.html', |
| 7 | styleUrls: ['./botonera.component.css'] | 7 | styleUrls: ['./botonera.component.css'] |
| 8 | }) | 8 | }) |
| 9 | 9 | ||
| 10 | export class AppBotonera { | 10 | export class AppBotonera { |
| 11 | botones = new BotonServiceService('').getBotones(); | 11 | botones = new BotonServiceService().getBotones(); |
| 12 | paginas = [1]; | 12 | paginas = [1]; |
| 13 | |||
| 13 | } | 14 | } |
| 14 | 15 |
src/app/busqueda-comprobante/busqueda-comprobante.component.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 d-flex" id="modal-body"> | 8 | <div class="modal-body d-flex" id="modal-body"> |
| 9 | <table class="table table-striped table-sm"> | 9 | <table class="table table-striped table-sm"> |
| 10 | <thead> | 10 | <thead> |
| 11 | <tr> | 11 | <tr> |
| 12 | <th>Comprobante</th> | 12 | <th>Comprobante</th> |
| 13 | <th>Items</th> | 13 | <th>Items</th> |
| 14 | <th></th> | 14 | <th></th> |
| 15 | </tr> | 15 | </tr> |
| 16 | </thead> | 16 | </thead> |
| 17 | <tbody> | 17 | <tbody> |
| 18 | <tr *ngIf="!getPaginaFiltro().length"> | ||
| 19 | <th colspan="3">Por el momento no hay elementos aqui</th> | ||
| 20 | </tr> | ||
| 18 | <tr *ngFor="let comprobante of getPaginaFiltro()"> | 21 | <tr *ngFor="let comprobante of getPaginaFiltro()"> |
| 19 | <td> | 22 | <td> |
| 20 | {{comprobante.cabecera.TCO + '-' + comprobante.cabecera.TIP + '-' + rellenar(4, comprobante.cabecera.SUC) + '-' + rellenar(8, comprobante.cabecera.NCO)}} | 23 | {{comprobante.cabecera.TCO + '-' + comprobante.cabecera.TIP + '-' + rellenar(4, comprobante.cabecera.SUC) + '-' + rellenar(8, comprobante.cabecera.NCO)}} |
| 21 | </td> | 24 | </td> |
| 22 | <td>{{comprobante.cuerpo.length}}</td> | 25 | <td>{{comprobante.cuerpo.length}}</td> |
| 23 | <td> | 26 | <td> |
| 24 | <button type="button" class="btn btn-xs p-1 float-right btn-primary" (click)="selectItem(comprobante)"> | 27 | <button type="button" class="btn btn-xs p-1 float-right btn-primary" (click)="selectItem(comprobante)"> |
| 25 | <i class="fa fa-circle-thin" aria-hidden="true"></i> | 28 | <i class="fa fa-circle-thin" aria-hidden="true"></i> |
| 26 | </button> | 29 | </button> |
| 27 | </td> | 30 | </td> |
| 28 | </tr> | 31 | </tr> |
| 29 | </tbody> | 32 | </tbody> |
| 30 | </table> | 33 | </table> |
| 31 | </div> | 34 | </div> |
| 32 | <div class="modal-footer py-1"> | 35 | <div class="modal-footer py-1"> |
| 33 | <nav *ngIf="comprobantes.length > 0" class="mr-auto mb-5"> | 36 | <nav *ngIf="comprobantes.length > 0" class="mr-auto mb-5"> |
| 34 | <ul class="pagination pagination-sm justify-content mb-0"> | 37 | <ul class="pagination pagination-sm justify-content mb-0"> |
| 35 | <li class="page-item" [ngClass]="{'disabled': paginaActiva == 1}"> | 38 | <li class="page-item" [ngClass]="{'disabled': paginaActiva == 1}"> |
| 36 | <a class="page-link" href="javascript:void();" (click)="paginaActiva = paginaActiva - 1"> | 39 | <a class="page-link" href="javascript:void();" (click)="paginaActiva = paginaActiva - 1"> |
| 37 | <span aria-hidden="true">«</span> | 40 | <span aria-hidden="true">«</span> |
| 38 | <span class="sr-only">Anterior</span> | 41 | <span class="sr-only">Anterior</span> |
| 39 | </a> | 42 | </a> |
| 40 | </li> | 43 | </li> |
| 41 | <li | 44 | <li |
| 42 | class="page-item" | 45 | class="page-item" |
| 43 | *ngFor="let pagina of paginas; index as i" | 46 | *ngFor="let pagina of paginas; index as i" |
| 44 | [ngClass]="{'active': pagina == paginaActiva}" | 47 | [ngClass]="{'active': pagina == paginaActiva}" |
| 45 | > | 48 | > |
| 46 | <a | 49 | <a |
| 47 | class="page-link" | 50 | class="page-link" |
| 48 | href="javascript:void();" | 51 | href="javascript:void();" |
| 49 | (click)="paginaActiva = pagina" | 52 | (click)="paginaActiva = pagina" |
| 50 | >{{pagina}}</a> | 53 | >{{pagina}}</a> |
| 51 | </li> | 54 | </li> |
| 52 | <li class="page-item" [ngClass]="{'disabled': paginaActiva == paginas.length}"> | 55 | <li class="page-item" [ngClass]="{'disabled': paginaActiva == paginas.length}"> |
| 53 | <a class="page-link" href="javascript:void();" (click)="paginaActiva = paginaActiva + 1"> | 56 | <a class="page-link" href="javascript:void();" (click)="paginaActiva = paginaActiva + 1"> |
| 54 | <span aria-hidden="true">»</span> | 57 | <span aria-hidden="true">»</span> |
| 55 | <span class="sr-only">Siguiente</span> | 58 | <span class="sr-only">Siguiente</span> |
| 56 | </a> | 59 | </a> |
| 57 | </li> | 60 | </li> |
| 58 | </ul> | 61 | </ul> |
| 59 | </nav> | 62 | </nav> |
| 60 | <button class="btn btn-sm btn-secondary" type="button" (click)="close()">Cerrar</button> | 63 | <button class="btn btn-sm btn-secondary" type="button" (click)="close()">Cerrar</button> |
| 61 | </div> | 64 | </div> |
| 62 | 65 |
src/app/busqueda-comprobante/busqueda-comprobante.component.ts
| 1 | import { Component, OnInit} from '@angular/core'; | 1 | import { Component, OnInit} from '@angular/core'; |
| 2 | import { NgbActiveModal } from '@ng-bootstrap/ng-bootstrap'; | 2 | import { NgbActiveModal } from '@ng-bootstrap/ng-bootstrap'; |
| 3 | import { BusquedaComprobantesService } from './busqueda-comprobantes.service'; | 3 | import { BusquedaComprobantesService } from './busqueda-comprobantes.service'; |
| 4 | 4 | ||
| 5 | @Component({ | 5 | @Component({ |
| 6 | templateUrl: './busqueda-comprobante.component.html', | 6 | templateUrl: './busqueda-comprobante.component.html', |
| 7 | styleUrls: ['./busqueda-comprobante.component.scss'], | 7 | styleUrls: ['./busqueda-comprobante.component.scss'], |
| 8 | providers: [BusquedaComprobantesService] | 8 | providers: [BusquedaComprobantesService] |
| 9 | }) | 9 | }) |
| 10 | export class BusquedaComprobanteComponent implements OnInit { | 10 | export class BusquedaComprobanteComponent implements OnInit { |
| 11 | 11 | ||
| 12 | comprobantes: Array<Object> = []; | 12 | comprobantes: Array<Object> = []; |
| 13 | paginaActiva = 1; | 13 | paginaActiva = 1; |
| 14 | paginas = []; | 14 | paginas = []; |
| 15 | cantidadPorPagina = 10; | 15 | cantidadPorPagina = 10; |
| 16 | 16 | ||
| 17 | constructor(public activeModal: NgbActiveModal, public comprobanteService: BusquedaComprobantesService) { } | 17 | constructor(public activeModal: NgbActiveModal, public comprobanteService: BusquedaComprobantesService) { } |
| 18 | 18 | ||
| 19 | ngOnInit() { | 19 | ngOnInit() { |
| 20 | this.comprobanteService.getComprobantes().subscribe((data: Array<Object>) => { | 20 | this.comprobanteService.getComprobantes().subscribe((data: Array<Object>) => { |
| 21 | this.comprobantes = data; | 21 | this.comprobantes = data; |
| 22 | this.comprobantes.push(this.comprobantes[0]); | ||
| 23 | this.comprobantes.push(this.comprobantes[1]); | ||
| 24 | this.comprobantes.push(this.comprobantes[0]); | ||
| 25 | this.comprobantes.push(this.comprobantes[1]); | ||
| 26 | this.comprobantes.push(this.comprobantes[0]); | ||
| 27 | this.comprobantes.push(this.comprobantes[1]); | ||
| 28 | this.comprobantes.push(this.comprobantes[0]); | ||
| 29 | this.comprobantes.push(this.comprobantes[1]); | ||
| 30 | this.comprobantes.push(this.comprobantes[0]); | ||
| 31 | this.comprobantes.push(this.comprobantes[1]); | ||
| 32 | this.comprobantes.push(this.comprobantes[0]); | ||
| 33 | this.comprobantes.push(this.comprobantes[1]); | ||
| 34 | this.comprobantes.push(this.comprobantes[0]); | ||
| 35 | this.comprobantes.push(this.comprobantes[1]); | ||
| 36 | this.comprobantes.push(this.comprobantes[0]); | ||
| 37 | this.comprobantes.push(this.comprobantes[1]); | ||
| 38 | this.paginar(); | 22 | this.paginar(); |
| 39 | }); | 23 | }); |
| 40 | } | 24 | } |
| 41 | 25 | ||
| 42 | getPaginaFiltro() { | 26 | getPaginaFiltro() { |
| 43 | return this.comprobantes.slice((this.paginaActiva - 1) * this.cantidadPorPagina, | 27 | return this.comprobantes.slice((this.paginaActiva - 1) * this.cantidadPorPagina, |
| 44 | this.paginaActiva * this.cantidadPorPagina); | 28 | this.paginaActiva * this.cantidadPorPagina); |
| 45 | } | 29 | } |
| 46 | 30 | ||
| 47 | paginar() { | 31 | paginar() { |
| 48 | 32 | ||
| 49 | var cantPaginas = Math.ceil(this.comprobantes.length / this.cantidadPorPagina); | 33 | var cantPaginas = Math.ceil(this.comprobantes.length / this.cantidadPorPagina); |
| 50 | this.paginas = []; | 34 | this.paginas = []; |
| 51 | for (let i = 0; i < cantPaginas; i++) { | 35 | for (let i = 0; i < cantPaginas; i++) { |
| 52 | this.paginas.push(i + 1); | 36 | this.paginas.push(i + 1); |
| 53 | } | 37 | } |
| 54 | } | 38 | } |
| 55 | 39 | ||
| 56 | rellenar(relleno: number, numero: number) { | 40 | rellenar(relleno: number, numero: number) { |
| 57 | 41 | ||
| 58 | if (numero.toString().length >= relleno) { | 42 | if (numero.toString().length >= relleno) { |
| 59 | return numero; | 43 | return numero; |
| 60 | } | 44 | } |
| 61 | 45 | ||
| 62 | let rellenar = ''; | 46 | let rellenar = ''; |
| 63 | 47 | ||
| 64 | for (let i = 0; i < relleno - numero.toString().length; i++) { | 48 | for (let i = 0; i < relleno - numero.toString().length; i++) { |
| 65 | rellenar += '0' | 49 | rellenar += '0' |
| 66 | } | 50 | } |
| 67 | 51 | ||
| 68 | return rellenar + numero.toString(); | 52 | return rellenar + numero.toString(); |
| 69 | } | 53 | } |
| 70 | 54 | ||
| 71 | close() { | 55 | close() { |
| 72 | this.activeModal.dismiss(); | 56 | this.activeModal.dismiss(); |
| 73 | } | 57 | } |
| 74 | 58 | ||
| 75 | selectItem(comprobante: object) { | 59 | selectItem(comprobante: object) { |
| 76 | this.activeModal.close(comprobante); | 60 | this.activeModal.close(comprobante); |
| 77 | } | 61 | } |
| 78 | } | 62 | } |
| 79 | 63 |
src/app/comprobantes/comprobantes.component.html
| 1 | <div class="row panel-informativo"> | 1 | <div class="row panel-informativo"> |
| 2 | <div class="col-12"> | 2 | <div class="col-12"> |
| 3 | <div class="row titulares"> | 3 | <div class="row titulares"> |
| 4 | <div class="col-12 col-sm numero-pedido text-center text-md-left border border-white align-middle ng-binding ng-scope"> | 4 | <div class="col-12 col-sm numero-pedido text-center text-md-left border border-white align-middle ng-binding ng-scope"> |
| 5 | Recepción | 5 | Recepción |
| 6 | <button | 6 | <button |
| 7 | class="btn btn-xs btn-outline-light float-right" | 7 | class="btn btn-xs btn-outline-light float-right" |
| 8 | type="button" | 8 | type="button" |
| 9 | (click)="busquedaComprobantes()" | 9 | (click)="busquedaComprobantes()" |
| 10 | title="Buscar" | 10 | title="Buscar" |
| 11 | > | 11 | > |
| 12 | <i class="fa fa-search"></i> | 12 | <i class="fa fa-search"></i> |
| 13 | </button> | 13 | </button> |
| 14 | </div> | 14 | </div> |
| 15 | <div class="col-7 col-sm border border-white align-middle"> | 15 | <div class="col-7 col-sm border border-white align-middle"> |
| 16 | Fecha: | 16 | Fecha: |
| 17 | <span | 17 | <span |
| 18 | ng-click="datepickerAbierto = true" | 18 | ng-click="datepickerAbierto = true" |
| 19 | > {{ fecha | date: 'dd/MM/yyyy' }}</span> | 19 | > {{ fecha | date: 'dd/MM/yyyy' }}</span> |
| 20 | </div> | 20 | </div> |
| 21 | <div class="col-5 col-sm border border-white border-right-0 align-middle"> | 21 | <div class="col-5 col-sm border border-white border-right-0 align-middle"> |
| 22 | Hora: | 22 | Hora: |
| 23 | <span | 23 | <span |
| 24 | ng-click="datepickerAbierto = true" | 24 | ng-click="datepickerAbierto = true" |
| 25 | > {{ fecha | date: 'shortTime'}}</span> | 25 | > {{ fecha | date: 'shortTime'}}</span> |
| 26 | </div> | 26 | </div> |
| 27 | </div> | 27 | </div> |
| 28 | </div> | 28 | </div> |
| 29 | </div> | 29 | </div> |
| 30 | <div class="row"> | 30 | <div class="row"> |
| 31 | <form class="col-12 col-sm-10"> | 31 | <form class="col-12 col-sm-10"> |
| 32 | <div class="row border"> | 32 | <div class="row border"> |
| 33 | <div class="col-6 col-sm-3 d-flex"> | 33 | <div class="col-6 col-sm-3 d-flex"> |
| 34 | <strong>Letra Factura: </strong> | 34 | <strong>Letra Factura: </strong> |
| 35 | <label>{{cabecera.TIP}}</label> | 35 | <label>{{cabecera['TIP']}}</label> |
| 36 | </div> | 36 | </div> |
| 37 | <div class="col-6 col-sm-3 d-flex"> | 37 | <div class="col-6 col-sm-3 d-flex"> |
| 38 | <strong>Tipo Factura: </strong> | 38 | <strong>Tipo Factura: </strong> |
| 39 | <label>{{cabecera.TCO}}</label> | 39 | <label>{{cabecera['TCO']}}</label> |
| 40 | </div> | 40 | </div> |
| 41 | <div class="col-6 col-sm-3 d-flex"> | 41 | <div class="col-6 col-sm-3 d-flex"> |
| 42 | <strong>Sucursal: </strong> | 42 | <strong>Sucursal: </strong> |
| 43 | <label>{{cabecera.SUC}}</label> | 43 | <label>{{cabecera['SUC']}}</label> |
| 44 | </div> | 44 | </div> |
| 45 | <div class="col-6 col-sm-3 d-flex"> | 45 | <div class="col-6 col-sm-3 d-flex"> |
| 46 | <strong>Número: </strong> | 46 | <strong>Número: </strong> |
| 47 | <label>{{cabecera.NCO}}</label> | 47 | <label>{{cabecera['NCO']}}</label> |
| 48 | </div> | 48 | </div> |
| 49 | <div class="col-6 col-sm-3 d-flex"> | 49 | <div class="col-6 col-sm-3 d-flex"> |
| 50 | <strong>Cuit: </strong> | 50 | <strong>Cuit: </strong> |
| 51 | <label>{{cabecera.CUI}}</label> | 51 | <label>{{cabecera['CUI']}}</label> |
| 52 | </div> | 52 | </div> |
| 53 | <div class="col-12 col-sm-6 d-flex"> | 53 | <div class="col-12 col-sm-6 d-flex"> |
| 54 | <strong>Nombre: </strong> | 54 | <strong>Nombre: </strong> |
| 55 | <label>{{cabecera.NOM}}</label> | 55 | <label>{{cabecera['NOM']}}</label> |
| 56 | </div> | 56 | </div> |
| 57 | </div> | 57 | </div> |
| 58 | <div class="row border pr-2"> | 58 | <div class="row border pr-2"> |
| 59 | <div class="col-4"> | 59 | <div class="col-4"> |
| 60 | <button | 60 | <button |
| 61 | type="button" | 61 | type="button" |
| 62 | class="btn btn-outline-secondary btn-sm" | 62 | class="btn btn-outline-secondary btn-sm" |
| 63 | [ngClass]="{'active': estadoArticulos == 'pendiente'}" | 63 | [ngClass]="{'active': estadoArticulos == 'pendiente'}" |
| 64 | (click)="estadoArticulos = 'pendiente'; paginaActiva = 1; filter = '';"> | 64 | (click)="estadoArticulos = 'pendiente'; paginaActiva = 1; filter = '';"> |
| 65 | Pendientes ({{getCantidadArticulosByEstado('pendiente')}}) | 65 | Pendientes ({{getCantidadArticulosByEstado('pendiente')}}) |
| 66 | </button> | 66 | </button> |
| 67 | </div> | 67 | </div> |
| 68 | <div class="col-4"> | 68 | <div class="col-4"> |
| 69 | <button | 69 | <button |
| 70 | type="button" | 70 | type="button" |
| 71 | class="btn btn-outline-success btn-sm" | 71 | class="btn btn-outline-success btn-sm" |
| 72 | [ngClass]="{'active': estadoArticulos == 'aprobado'}" | 72 | [ngClass]="{'active': estadoArticulos == 'aprobado'}" |
| 73 | (click)="estadoArticulos = 'aprobado'; paginaActiva = 1; filter = '';"> | 73 | (click)="estadoArticulos = 'aprobado'; paginaActiva = 1; filter = '';"> |
| 74 | Aprobados ({{getCantidadArticulosByEstado('aprobado')}}) | 74 | Aprobados ({{getCantidadArticulosByEstado('aprobado')}}) |
| 75 | </button> | 75 | </button> |
| 76 | </div> | 76 | </div> |
| 77 | <div class="col-4"> | 77 | <div class="col-4"> |
| 78 | <button | 78 | <button |
| 79 | type="button" | 79 | type="button" |
| 80 | class="btn btn-outline-danger btn-sm" | 80 | class="btn btn-outline-danger btn-sm" |
| 81 | [ngClass]="{'active': estadoArticulos == 'rechazado'}" | 81 | [ngClass]="{'active': estadoArticulos == 'rechazado'}" |
| 82 | (click)="estadoArticulos = 'rechazado'; paginaActiva = 1; filter = '';"> | 82 | (click)="estadoArticulos = 'rechazado'; paginaActiva = 1; filter = '';"> |
| 83 | Rechazados ({{getCantidadArticulosByEstado('rechazado')}}) | 83 | Rechazados ({{getCantidadArticulosByEstado('rechazado')}}) |
| 84 | </button> | 84 | </button> |
| 85 | </div> | 85 | </div> |
| 86 | </div> | 86 | </div> |
| 87 | <div class="row"> | 87 | <div class="row"> |
| 88 | <input | 88 | <input |
| 89 | type="text" | 89 | type="text" |
| 90 | class="form-control-sm col-12" | 90 | class="form-control-sm col-12" |
| 91 | placeholder="Busque producto por nombre, codigo" | 91 | placeholder="Busque producto por nombre, codigo" |
| 92 | [(ngModel)]="filter" | 92 | [(ngModel)]="filter" |
| 93 | [ngModelOptions]="{standalone: true}"/> | 93 | [ngModelOptions]="{standalone: true}"/> |
| 94 | </div> | 94 | </div> |
| 95 | <div class="row"> | 95 | <div class="row"> |
| 96 | <table class="table table-dark"> | 96 | <table class="table table-dark"> |
| 97 | <thead> | 97 | <thead> |
| 98 | <tr> | 98 | <tr> |
| 99 | <th *ngIf="estadoArticulos != 'rechazado'">Rechazar</th> | 99 | <th *ngIf="estadoArticulos != 'rechazado'">Rechazar</th> |
| 100 | <th>Producto</th> | 100 | <th>Producto</th> |
| 101 | <th>Cantidad</th> | 101 | <th>Cantidad</th> |
| 102 | <th *ngIf="estadoArticulos != 'aprobado'">Aceptar</th> | 102 | <th *ngIf="estadoArticulos != 'aprobado'">Aceptar</th> |
| 103 | </tr> | 103 | </tr> |
| 104 | </thead> | 104 | </thead> |
| 105 | <tbody> | 105 | <tbody> |
| 106 | <tr *ngFor="let articulo of getPaginaFiltro()" [ngClass]="{'bg-success': articulo.estado == 'aprobado'}"> | 106 | <tr *ngFor="let articulo of getPaginaFiltro()" [ngClass]="{'bg-success': articulo.estado == 'aprobado'}"> |
| 107 | <th *ngIf="estadoArticulos != 'rechazado'"><button type="button" class="" (click)="articulo.estado = 'rechazado'"> | 107 | <th *ngIf="estadoArticulos != 'rechazado'"><button type="button" class="" (click)="articulo.estado = 'rechazado'"> |
| 108 | <i class="fa fa-window-close"></i> | 108 | <i class="fa fa-window-close"></i> |
| 109 | </button></th> | 109 | </button></th> |
| 110 | <th>{{articulo.TIO}}</th> | 110 | <th>{{articulo.TIO}}</th> |
| 111 | <th *ngIf="!articulo.input" (click)="articulo.input = true"> | 111 | <th *ngIf="!articulo.input" (click)="articulo.input = true"> |
| 112 | {{articulo.recibido ? articulo.recibido + '/' : ''}}{{articulo.CAN}}</th> | 112 | {{articulo.recibido ? articulo.recibido + '/' : ''}}{{articulo.CAN}}</th> |
| 113 | <th *ngIf="articulo.input"> | 113 | <th *ngIf="articulo.input"> |
| 114 | <input | 114 | <input |
| 115 | class="form-control-sm col-12" | 115 | class="form-control-sm col-12" |
| 116 | type="number" | 116 | type="number" |
| 117 | (keyup.enter)="articulo.input = false" | 117 | (keyup.enter)="articulo.input = false" |
| 118 | [(ngModel)]="articulo.recibido" | 118 | [(ngModel)]="articulo.recibido" |
| 119 | [ngModelOptions]="{standalone: true}" | 119 | [ngModelOptions]="{standalone: true}" |
| 120 | autofocus/> | 120 | autofocus/> |
| 121 | /{{articulo.CAN}} | 121 | /{{articulo.CAN}} |
| 122 | </th> | 122 | </th> |
| 123 | <th *ngIf="estadoArticulos != 'aprobado'"> | 123 | <th *ngIf="estadoArticulos != 'aprobado'"> |
| 124 | <button type="button" class="" (click)="articulo.estado = 'aprobado'"> | 124 | <button type="button" class="" (click)="articulo.estado = 'aprobado'"> |
| 125 | <i class="fa fa-check"></i> | 125 | <i class="fa fa-check"></i> |
| 126 | </button> | 126 | </button> |
| 127 | </th> | 127 | </th> |
| 128 | </tr> | 128 | </tr> |
| 129 | <tr> | 129 | <tr> |
| 130 | <th colspan="3" *ngIf="articulosFiltro.length == 0">Por el momento no hay elementos aquí</th> | 130 | <th colspan="3" *ngIf="articulosFiltro.length == 0">Por el momento no hay elementos aquí</th> |
| 131 | </tr> | 131 | </tr> |
| 132 | </tbody> | 132 | </tbody> |
| 133 | <tfoot> | 133 | <tfoot> |
| 134 | <nav *ngIf="articulosFiltro.length > 0" class="mr-auto position-absolute mb-5"> | 134 | <nav *ngIf="articulosFiltro.length > 0" class="mr-auto position-absolute mb-5"> |
| 135 | <ul class="pagination pagination-sm justify-content mb-0"> | 135 | <ul class="pagination pagination-sm justify-content mb-0"> |
| 136 | <li class="page-item" [ngClass]="{'disabled': paginaActiva == 1}"> | 136 | <li class="page-item" [ngClass]="{'disabled': paginaActiva == 1}"> |
| 137 | <a class="page-link" href="javascript:void();" (click)="paginaActiva = paginaActiva - 1"> | 137 | <a class="page-link" href="javascript:void();" (click)="paginaActiva = paginaActiva - 1"> |
| 138 | <span aria-hidden="true">«</span> | 138 | <span aria-hidden="true">«</span> |
| 139 | <span class="sr-only">Anterior</span> | 139 | <span class="sr-only">Anterior</span> |
| 140 | </a> | 140 | </a> |
| 141 | </li> | 141 | </li> |
| 142 | <li | 142 | <li |
| 143 | class="page-item" | 143 | class="page-item" |
| 144 | *ngFor="let pagina of paginas; index as i" | 144 | *ngFor="let pagina of paginas; index as i" |
| 145 | [ngClass]="{'active': pagina == paginaActiva}" | 145 | [ngClass]="{'active': pagina == paginaActiva}" |
| 146 | > | 146 | > |
| 147 | <a | 147 | <a |
| 148 | class="page-link" | 148 | class="page-link" |
| 149 | href="javascript:void();" | 149 | href="javascript:void();" |
| 150 | (click)="paginaActiva = pagina" | 150 | (click)="paginaActiva = pagina" |
| 151 | >{{pagina}}</a> | 151 | >{{pagina}}</a> |
| 152 | </li> | 152 | </li> |
| 153 | <li class="page-item" [ngClass]="{'disabled': paginaActiva == paginas.length}"> | 153 | <li class="page-item" [ngClass]="{'disabled': paginaActiva == paginas.length}"> |
| 154 | <a class="page-link" href="javascript:void();" (click)="paginaActiva = paginaActiva + 1"> | 154 | <a class="page-link" href="javascript:void();" (click)="paginaActiva = paginaActiva + 1"> |
| 155 | <span aria-hidden="true">»</span> | 155 | <span aria-hidden="true">»</span> |
| 156 | <span class="sr-only">Siguiente</span> | 156 | <span class="sr-only">Siguiente</span> |
| 157 | </a> | 157 | </a> |
| 158 | </li> | 158 | </li> |
| 159 | </ul> | 159 | </ul> |
| 160 | </nav> | 160 | </nav> |
| 161 | </tfoot> | 161 | </tfoot> |
| 162 | </table> | 162 | </table> |
| 163 | </div> | 163 | </div> |
| 164 | </form> | 164 | </form> |
| 165 | <app-acciones (guardar)="guardarComprobante()" [(saveLoading)]="saveLoading"></app-acciones> | 165 | <app-acciones (guardar)="guardarComprobante()" [(saveLoading)]="saveLoading"></app-acciones> |
| 166 | </div> | 166 | </div> |
| 167 | 167 |
src/app/comprobantes/comprobantes.component.ts
| 1 | import { Component, OnInit} from '@angular/core'; | 1 | import { Component, OnInit} from '@angular/core'; |
| 2 | import { NgbModal } from '@ng-bootstrap/ng-bootstrap'; | 2 | import { NgbModal } from '@ng-bootstrap/ng-bootstrap'; |
| 3 | import { BusquedaComprobanteComponent } from '../busqueda-comprobante/busqueda-comprobante.component'; | 3 | import { BusquedaComprobanteComponent } from '../busqueda-comprobante/busqueda-comprobante.component'; |
| 4 | import { ComprobanteService } from './comprobantes.service'; | 4 | import { ComprobanteService } from './comprobantes.service'; |
| 5 | import { Router } from '@angular/router'; | ||
| 5 | 6 | ||
| 6 | @Component({ | 7 | @Component({ |
| 7 | templateUrl: './comprobantes.component.html', | 8 | templateUrl: './comprobantes.component.html', |
| 8 | styleUrls: ['./comprobantes.component.scss'], | 9 | styleUrls: ['./comprobantes.component.scss'], |
| 9 | providers:[ ComprobanteService ] | 10 | providers:[ ComprobanteService ] |
| 10 | }) | 11 | }) |
| 11 | export class ComprobantesComponent implements OnInit { | 12 | export class ComprobantesComponent implements OnInit { |
| 12 | 13 | ||
| 13 | constructor(private modalService: NgbModal, public comprobanteService: ComprobanteService) { } | 14 | constructor( |
| 15 | private modalService: NgbModal, | ||
| 16 | public comprobanteService: ComprobanteService, | ||
| 17 | public router: Router) { } | ||
| 14 | 18 | ||
| 15 | ngOnInit() { } | 19 | ngOnInit() { } |
| 16 | 20 | ||
| 17 | filter = ''; | 21 | filter = ''; |
| 18 | estadoArticulos = 'pendiente'; | 22 | estadoArticulos = 'pendiente'; |
| 19 | comprobantes = [1, 2, 3]; | 23 | comprobantes = [1, 2, 3]; |
| 20 | cabecera = {}; | 24 | cabecera = {}; |
| 21 | cuerpo = []; | 25 | cuerpo = []; |
| 22 | articulosFiltro = []; | 26 | articulosFiltro = []; |
| 23 | paginaActiva = 1; | 27 | paginaActiva = 1; |
| 24 | paginas = []; | 28 | paginas = []; |
| 25 | saveLoading = false; | 29 | saveLoading = false; |
| 26 | 30 | ||
| 27 | fecha = new Date(); | 31 | fecha = new Date(); |
| 28 | 32 | ||
| 29 | paginar() { | 33 | paginar() { |
| 30 | 34 | ||
| 31 | var cantPaginas = Math.ceil(this.articulosFiltro.length / 5); | 35 | var cantPaginas = Math.ceil(this.articulosFiltro.length / 5); |
| 32 | this.paginas = []; | 36 | this.paginas = []; |
| 33 | for (let i = 0; i < cantPaginas; i++) { | 37 | for (let i = 0; i < cantPaginas; i++) { |
| 34 | this.paginas.push(i + 1); | 38 | this.paginas.push(i + 1); |
| 35 | } | 39 | } |
| 36 | } | 40 | } |
| 37 | 41 | ||
| 38 | getPaginaFiltro() { | 42 | getPaginaFiltro() { |
| 39 | 43 | ||
| 40 | this.articulosFiltro = this.cuerpo.filter((articulo) => { | 44 | this.articulosFiltro = this.cuerpo.filter((articulo) => { |
| 41 | return articulo.estado == this.estadoArticulos && | 45 | return articulo.estado == this.estadoArticulos && |
| 42 | (articulo.TIO.toLocaleUpperCase().includes(this.filter.toLocaleUpperCase()) || | 46 | (articulo.TIO.toLocaleUpperCase().includes(this.filter.toLocaleUpperCase()) || |
| 43 | articulo.codigoBarras == this.filter); | 47 | articulo.codigoBarras == this.filter); |
| 44 | }); | 48 | }); |
| 45 | 49 | ||
| 46 | this.paginar(); | 50 | this.paginar(); |
| 47 | 51 | ||
| 48 | return this.articulosFiltro.slice((this.paginaActiva - 1) * 5 , this.paginaActiva * 5); | 52 | return this.articulosFiltro.slice((this.paginaActiva - 1) * 5 , this.paginaActiva * 5); |
| 49 | } | 53 | } |
| 50 | 54 | ||
| 51 | getCantidadArticulosByEstado(estado: String) { | 55 | getCantidadArticulosByEstado(estado: String) { |
| 52 | return this.cuerpo.filter((articulo) => { | 56 | return this.cuerpo.filter((articulo) => { |
| 53 | return articulo.estado == estado; | 57 | return articulo.estado == estado; |
| 54 | }).length; | 58 | }).length; |
| 55 | } | 59 | } |
| 56 | 60 | ||
| 57 | guardarComprobante(event: any) { | 61 | guardarComprobante() { |
| 58 | 62 | ||
| 59 | if (this.getCantidadArticulosByEstado('pendiente')) { | 63 | if (this.getCantidadArticulosByEstado('pendiente')) { |
| 60 | alert('No deben quedar articulos pendientes'); | 64 | alert('No deben quedar articulos pendientes'); |
| 61 | } | 65 | } |
| 62 | 66 | ||
| 63 | this.comprobanteService | 67 | this.comprobanteService |
| 64 | .saveComprobantes({cabecera: this.cabecera, cuerpo: this.cuerpo}) | 68 | .saveComprobantes({cabecera: this.cabecera, cuerpo: this.cuerpo}) |
| 65 | .subscribe(data => { | 69 | .subscribe(data => { |
| 66 | console.log(data); | 70 | alert('Comprobante guardado con éxito'); |
| 71 | this.router.navigateByUrl('/home'); | ||
| 72 | }, err => { | ||
| 73 | alert('Algo salió mal'); | ||
| 74 | console.log(err); | ||
| 67 | }); | 75 | }); |
| 68 | } | 76 | } |
| 69 | 77 | ||
| 70 | busquedaComprobantes() { | 78 | busquedaComprobantes() { |
| 71 | this.modalService.open(BusquedaComprobanteComponent).result.then(comprobante => { | 79 | this.modalService.open(BusquedaComprobanteComponent).result.then(comprobante => { |
| 72 | 80 | ||
| 73 | this.cabecera = comprobante.cabecera; | 81 | this.cabecera = comprobante.cabecera; |
| 74 | this.cuerpo = comprobante.cuerpo; | 82 | this.cuerpo = comprobante.cuerpo; |
| 75 | 83 | ||
| 76 | this.cuerpo.forEach(articulo => { | 84 | this.cuerpo.forEach(articulo => { |
| 77 | articulo['estado'] = 'pendiente'; | 85 | articulo['estado'] = 'pendiente'; |
| 78 | }); | 86 | }); |
| 79 | 87 | ||
| 80 | this.getPaginaFiltro(); | 88 | this.getPaginaFiltro(); |
| 81 | }, (reason) => { }); | 89 | }, (reason) => { }); |
| 82 | } | 90 | } |
| 83 | 91 | ||
| 84 | } | 92 | } |
| 85 | 93 |
src/app/login/login.component.html
| 1 | <div class="d-flex justify-content-center align-items-center"> | 1 | <div class="d-flex justify-content-center align-items-center"> |
| 2 | <div class="login"> | 2 | <div class="login"> |
| 3 | <form name="login"> | 3 | <form name="login"> |
| 4 | <div class="login-titulo"> | 4 | <div class="login-titulo"> |
| 5 | <span>Ingreso de usuario</span> | 5 | <span>Ingreso de usuario</span> |
| 6 | </div> | 6 | </div> |
| 7 | <div class="login-campo"> | 7 | <div class="login-campo"> |
| 8 | <label>Usuario</label> | 8 | <label>Usuario</label> |
| 9 | <input | 9 | <input |
| 10 | type="text" | 10 | type="text" |
| 11 | [(ngModel)]="usuario.idUsuario" | 11 | [(ngModel)]="usuario['idUsuario']" |
| 12 | [ngModelOptions]="{standalone: true}" | 12 | [ngModelOptions]="{standalone: true}" |
| 13 | ng-keyup="$event.keyCode == 13 && irPaso(2)" | 13 | ng-keyup="$event.keyCode == 13 && irPaso(2)" |
| 14 | [ladda]="loginLoading" | 14 | [ladda]="loginLoading" |
| 15 | /> | 15 | /> |
| 16 | </div> | 16 | </div> |
| 17 | <div class="login-campo"> | 17 | <div class="login-campo"> |
| 18 | <label>Contraseña</label> | 18 | <label>Contraseña</label> |
| 19 | <input | 19 | <input |
| 20 | type="password" | 20 | type="password" |
| 21 | [(ngModel)]="usuario.clave" | 21 | [(ngModel)]="usuario['clave']" |
| 22 | [ngModelOptions]="{standalone: true}" | 22 | [ngModelOptions]="{standalone: true}" |
| 23 | foca-focus="paso == 2" | 23 | foca-focus="paso == 2" |
| 24 | ng-keyup="$event.keyCode == 13 && enviar()" | 24 | ng-keyup="$event.keyCode == 13 && enviar()" |
| 25 | [ladda]="loginLoading" | 25 | [ladda]="loginLoading" |
| 26 | /> | 26 | /> |
| 27 | </div> | 27 | </div> |
| 28 | <div class="d-flex"> | 28 | <div class="d-flex"> |
| 29 | <button | 29 | <button |
| 30 | type="button" | 30 | type="button" |
| 31 | class="btn btn-outline-dark mt-3 mr-auto" | 31 | class="btn btn-outline-dark mt-3 mr-auto" |
| 32 | (click)="configuracionEstacion = !configuracionEstacion" | 32 | (click)="configuracionEstacion = !configuracionEstacion" |
| 33 | [ngClass]="{'active': configuracionEstacion}" | 33 | [ngClass]="{'active': configuracionEstacion}" |
| 34 | [disabled]="loginLoading" | 34 | [disabled]="loginLoading" |
| 35 | >Configuración</button> | 35 | >Configuración</button> |
| 36 | <button | 36 | <button |
| 37 | type="button" | 37 | type="button" |
| 38 | class="btn btn-dark mt-3 ml-auto" | 38 | class="btn btn-dark mt-3 ml-auto" |
| 39 | (click)="ingresar()" | 39 | (click)="ingresar()" |
| 40 | [ladda]="loginLoading" | 40 | [ladda]="loginLoading" |
| 41 | >Ingresar</button> | 41 | >Ingresar</button> |
| 42 | </div> | 42 | </div> |
| 43 | <div *ngIf="configuracionEstacion" class="mt-3"> | 43 | <div *ngIf="configuracionEstacion" class="mt-3"> |
| 44 | <strong>Configuración estación</strong> | 44 | <strong>Configuración estación</strong> |
| 45 | <br/> | 45 | <br/> |
| 46 | <div> | 46 | <div> |
| 47 | <label class="justify-content-left">Código estación:</label> | 47 | <label class="justify-content-left">Código estación:</label> |
| 48 | <input | 48 | <input |
| 49 | class="form-control" | 49 | class="form-control" |
| 50 | placeholder="Código estación" | 50 | placeholder="Código estación" |
| 51 | [(ngModel)]="usuario.codigoEntidad" | 51 | [(ngModel)]="usuario['codigoEntidad']" |
| 52 | [ngModelOptions]="{standalone: true}"> | 52 | [ngModelOptions]="{standalone: true}"> |
| 53 | </div> | 53 | </div> |
| 54 | <div> | 54 | <div> |
| 55 | <label class="justify-content-left">GLN:</label> | 55 | <label class="justify-content-left">GLN:</label> |
| 56 | <input | 56 | <input |
| 57 | class="form-control" | 57 | class="form-control" |
| 58 | placeholder="GLN ESTACIÓN" | 58 | placeholder="GLN ESTACIÓN" |
| 59 | [(ngModel)]="usuario.gln" | 59 | [(ngModel)]="usuario['gln']" |
| 60 | [ngModelOptions]="{standalone: true}"/> | 60 | [ngModelOptions]="{standalone: true}"/> |
| 61 | </div> | 61 | </div> |
| 62 | </div> | 62 | </div> |
| 63 | </form> | 63 | </form> |
| 64 | </div> | 64 | </div> |
| 65 | </div> | 65 | </div> |
| 66 | 66 |
src/app/login/login.component.ts
| 1 | import { Component, OnInit } from '@angular/core'; | 1 | import { Component, OnInit } from '@angular/core'; |
| 2 | import { LoginService } from './login.service'; | 2 | import { LoginService } from './login.service'; |
| 3 | import { Router } from '@angular/router'; | 3 | import { Router } from '@angular/router'; |
| 4 | 4 | ||
| 5 | @Component({ | 5 | @Component({ |
| 6 | templateUrl: './login.component.html', | 6 | templateUrl: './login.component.html', |
| 7 | styleUrls: ['./login.component.scss'], | 7 | styleUrls: ['./login.component.scss'], |
| 8 | providers: [LoginService] | 8 | providers: [LoginService] |
| 9 | }) | 9 | }) |
| 10 | export class LoginComponent implements OnInit { | 10 | export class LoginComponent implements OnInit { |
| 11 | 11 | ||
| 12 | loginLoading: boolean = false; | 12 | loginLoading: boolean = false; |
| 13 | configuracionEstacion: boolean = false; | ||
| 13 | usuario: object = {}; | 14 | usuario: object = {}; |
| 14 | 15 | ||
| 15 | constructor(private loginService: LoginService, private router: Router) { } | 16 | constructor(private loginService: LoginService, private router: Router) { } |
| 16 | 17 | ||
| 17 | ngOnInit() { | 18 | ngOnInit() { |
| 18 | 19 | ||
| 19 | let glnPrevius = localStorage.getItem('gln') | 20 | let glnPrevius = localStorage.getItem('gln') |
| 20 | if (glnPrevius) { | 21 | if (glnPrevius) { |
| 21 | this.usuario['gln'] = glnPrevius; | 22 | this.usuario['gln'] = glnPrevius; |
| 22 | } | 23 | } |
| 23 | } | 24 | } |
| 24 | 25 | ||
| 25 | ingresar() { | 26 | ingresar() { |
| 26 | 27 | ||
| 27 | this.loginLoading = true; | 28 | this.loginLoading = true; |
| 28 | this.loginService.getLogin(this.usuario).subscribe(login => { | 29 | this.loginService.getLogin(this.usuario).subscribe(login => { |
| 29 | if(login['data'] == 'ok') { | 30 | if(login['data'] == 'ok') { |
| 30 | localStorage.setItem('gln', this.usuario['gln']) | 31 | localStorage.setItem('gln', this.usuario['gln']) |
| 31 | this.router.navigateByUrl('/home'); | 32 | this.router.navigateByUrl('/home'); |
| 32 | } else { | 33 | } else { |
| 33 | alert('No se encontró la estación'); | 34 | alert('No se encontró la estación'); |
| 34 | this.loginLoading = false; | 35 | this.loginLoading = false; |
| 35 | } | 36 | } |
| 36 | }); | 37 | }); |
| 37 | } | 38 | } |
| 38 | } | 39 | } |
| 39 | 40 |
src/etc/AppSetings.ejemplo.ts
| File was created | 1 | // export class AppSetings { | |
| 2 | // public static END_POINT='http://10.231.45.197:6060/gateway-debo'; | ||
| 3 | // } | ||
| 4 |
src/etc/AppSetings.ts
| 1 | export class AppSetings { | 1 | export class AppSetings { |
| 2 | public static END_POINT='http://localhost:6060/gateway-debo'; | 2 | public static END_POINT='http://10.231.45.234:6060/gateway-debo'; |
| 3 | } | 3 | } |
| 4 | 4 |