diff --git a/src/app/busqueda-comprobante/busqueda-comprobante.component.html b/src/app/busqueda-comprobante/busqueda-comprobante.component.html new file mode 100644 index 0000000..e242d92 --- /dev/null +++ b/src/app/busqueda-comprobante/busqueda-comprobante.component.html @@ -0,0 +1,61 @@ + + + diff --git a/src/app/busqueda-comprobante/busqueda-comprobante.component.scss b/src/app/busqueda-comprobante/busqueda-comprobante.component.scss new file mode 100644 index 0000000..e69de29 diff --git a/src/app/busqueda-comprobante/busqueda-comprobante.component.ts b/src/app/busqueda-comprobante/busqueda-comprobante.component.ts new file mode 100644 index 0000000..958dec3 --- /dev/null +++ b/src/app/busqueda-comprobante/busqueda-comprobante.component.ts @@ -0,0 +1,78 @@ +import { Component, OnInit} from '@angular/core'; +import { NgbActiveModal } from '@ng-bootstrap/ng-bootstrap'; +import { BusquedaComprobantesService } from './busqueda-comprobantes.service'; + +@Component({ + templateUrl: './busqueda-comprobante.component.html', + styleUrls: ['./busqueda-comprobante.component.scss'], + providers: [BusquedaComprobantesService] +}) +export class BusquedaComprobanteComponent implements OnInit { + + comprobantes: Array = []; + paginaActiva = 1; + paginas = []; + cantidadPorPagina = 10; + + constructor(public activeModal: NgbActiveModal, public comprobanteService: BusquedaComprobantesService) { } + + ngOnInit() { + this.comprobanteService.getComprobantes().subscribe((data: Array) => { + this.comprobantes = data; + this.comprobantes.push(this.comprobantes[0]); + this.comprobantes.push(this.comprobantes[1]); + this.comprobantes.push(this.comprobantes[0]); + this.comprobantes.push(this.comprobantes[1]); + this.comprobantes.push(this.comprobantes[0]); + this.comprobantes.push(this.comprobantes[1]); + this.comprobantes.push(this.comprobantes[0]); + this.comprobantes.push(this.comprobantes[1]); + this.comprobantes.push(this.comprobantes[0]); + this.comprobantes.push(this.comprobantes[1]); + this.comprobantes.push(this.comprobantes[0]); + this.comprobantes.push(this.comprobantes[1]); + this.comprobantes.push(this.comprobantes[0]); + this.comprobantes.push(this.comprobantes[1]); + this.comprobantes.push(this.comprobantes[0]); + this.comprobantes.push(this.comprobantes[1]); + this.paginar(); + }); + } + + getPaginaFiltro() { + return this.comprobantes.slice((this.paginaActiva - 1) * this.cantidadPorPagina, + this.paginaActiva * this.cantidadPorPagina); + } + + paginar() { + + var cantPaginas = Math.ceil(this.comprobantes.length / this.cantidadPorPagina); + this.paginas = []; + for (let i = 0; i < cantPaginas; i++) { + this.paginas.push(i + 1); + } + } + + rellenar(relleno: number, numero: number) { + + if (numero.toString().length >= relleno) { + return numero; + } + + let rellenar = ''; + + for (let i = 0; i < relleno - numero.toString().length; i++) { + rellenar += '0' + } + + return rellenar + numero.toString(); + } + + close() { + this.activeModal.dismiss(); + } + + selectItem(comprobante: object) { + this.activeModal.close(comprobante); + } +} diff --git a/src/app/busqueda-comprobante/busqueda-comprobantes.service.ts b/src/app/busqueda-comprobante/busqueda-comprobantes.service.ts new file mode 100644 index 0000000..6a32041 --- /dev/null +++ b/src/app/busqueda-comprobante/busqueda-comprobantes.service.ts @@ -0,0 +1,14 @@ +import { Injectable } from '@angular/core'; +import { HttpClient, HttpHeaders } from '@angular/common/http'; +import { AppSetings } from '../../etc/AppSetings'; + +@Injectable() +export class BusquedaComprobantesService { + + constructor(private http: HttpClient) { + } + + getComprobantes() { + return this.http.get(AppSetings.END_POINT + '/comprobantes/' + localStorage.getItem('gln')); + }; +} diff --git a/src/app/login/login.component.html b/src/app/login/login.component.html new file mode 100644 index 0000000..5b422fb --- /dev/null +++ b/src/app/login/login.component.html @@ -0,0 +1,65 @@ +
+ +
diff --git a/src/app/login/login.component.scss b/src/app/login/login.component.scss new file mode 100644 index 0000000..13fc7f1 --- /dev/null +++ b/src/app/login/login.component.scss @@ -0,0 +1,56 @@ +.login { + background-color: #bdbdbd; + border: 1px solid #000000; + border-radius: 3px; + height: calc(193px + 1em); + left: calc(50% - 130px); + opacity: 0.7; + text-align: center; + top: 190px; + width: 260px; + margin-top: 3.5rem; + &-titulo { + border-bottom: 1px solid #ffffff; + padding: 5px 0; + } + &-campo { + label { + display: block; + font-size: 12px; + margin: 5px 0 0; + } + input { + -moz-border-radius: 10px; + -khtml-border-radius: 10px; + -webkit-border-radius: 10px; + -webkit-appearance: none; + padding-right: 5%; + padding-left: 5%; + border-radius: 10px; + outline: 0; + border-color: transparent; + &:focus { + border-color: #ff9900; + } + } + } + + &-button { + // width: 80%; + background-color: #cd9035; + color: white; + &:hover{ + background-color: #a7743d; + color: white + } + &:focus{ + color: white; + } + } + + &-alerta-error { + width: 260px; + left: calc(50% - 130px); + top: calc(383px + 1.5em); + } +} diff --git a/src/app/login/login.component.ts b/src/app/login/login.component.ts new file mode 100644 index 0000000..511679c --- /dev/null +++ b/src/app/login/login.component.ts @@ -0,0 +1,38 @@ +import { Component, OnInit } from '@angular/core'; +import { LoginService } from './login.service'; +import { Router } from '@angular/router'; + +@Component({ + templateUrl: './login.component.html', + styleUrls: ['./login.component.scss'], + providers: [LoginService] +}) +export class LoginComponent implements OnInit { + + loginLoading: boolean = false; + usuario: object = {}; + + constructor(private loginService: LoginService, private router: Router) { } + + ngOnInit() { + + let glnPrevius = localStorage.getItem('gln') + if (glnPrevius) { + this.usuario['gln'] = glnPrevius; + } + } + + ingresar() { + + this.loginLoading = true; + this.loginService.getLogin(this.usuario).subscribe(login => { + if(login['data'] == 'ok') { + localStorage.setItem('gln', this.usuario['gln']) + this.router.navigateByUrl('/home'); + } else { + alert('No se encontró la estación'); + this.loginLoading = false; + } + }); + } +} diff --git a/src/app/login/login.service.ts b/src/app/login/login.service.ts new file mode 100644 index 0000000..afd86ee --- /dev/null +++ b/src/app/login/login.service.ts @@ -0,0 +1,13 @@ +import { Injectable } from '@angular/core'; +import { HttpClient, HttpHeaders } from '@angular/common/http'; +import { AppSetings } from '../../etc/AppSetings'; + +@Injectable() +export class LoginService { + + constructor(private http: HttpClient) { } + + getLogin(json: object) { + return this.http.post(AppSetings.END_POINT + '/login', json); + }; +} diff --git a/src/etc/AppSetings.ts b/src/etc/AppSetings.ts new file mode 100644 index 0000000..4be5f56 --- /dev/null +++ b/src/etc/AppSetings.ts @@ -0,0 +1,3 @@ +export class AppSetings { + public static END_POINT='http://localhost:6060/gateway-debo'; +}