Commit 0aa4d1f5292fefacd00d6d90ae35884b173b35e0
Exists in
master
Merge branch 'master' into 'master'
Master(efernandez) See merge request !5
Showing
5 changed files
Show diff stats
src/app/app-routing.module.ts
| 1 | import { NgModule } from '@angular/core'; | 1 | import { NgModule } from '@angular/core'; |
| 2 | import { Routes, RouterModule } from '@angular/router'; | 2 | import { Routes, RouterModule, Router, NavigationEnd} from '@angular/router'; |
| 3 | import { ComprobantesComponent } from './comprobantes/comprobantes.component'; | 3 | import { ComprobantesComponent } from './comprobantes/comprobantes.component'; |
| 4 | import { AppBotonera } from './botonera/botonera.component'; | 4 | import { AppBotonera } from './botonera/botonera.component'; |
| 5 | import { LoginComponent } from './login/login.component'; | 5 | import { LoginComponent } from './login/login.component'; |
| 6 | import { NgbModal } from '@ng-bootstrap/ng-bootstrap'; | ||
| 6 | 7 | ||
| 7 | const routes: Routes = [ | 8 | const routes: Routes = [ |
| 8 | { path: 'comprobantes', component: ComprobantesComponent, pathMatch: 'full' }, | 9 | { path: 'comprobantes', component: ComprobantesComponent, pathMatch: 'full' }, |
| 9 | { path: '', redirectTo: 'home', pathMatch: 'full' }, | 10 | { path: '', redirectTo: 'home', pathMatch: 'full' }, |
| 10 | { path: 'home', component: AppBotonera }, | 11 | { path: 'home', component: AppBotonera }, |
| 11 | { path: 'login', component: LoginComponent } | 12 | { path: 'login', component: LoginComponent } |
| 12 | ]; | 13 | ]; |
| 13 | 14 | ||
| 14 | @NgModule({ | 15 | @NgModule({ |
| 15 | imports: [RouterModule.forRoot(routes)], | 16 | imports: [RouterModule.forRoot(routes)], |
| 16 | exports: [RouterModule] | 17 | exports: [RouterModule] |
| 17 | }) | 18 | }) |
| 18 | export class AppRoutingModule { } | 19 | export class AppRoutingModule { |
| 20 | |||
| 21 | constructor(private router: Router, private modalService: NgbModal) { | ||
| 22 | |||
| 23 | router.events.subscribe(() => { | ||
| 24 | modalService.dismissAll(); | ||
| 25 | }) | ||
| 26 | } | ||
| 27 | |||
| 28 | } | ||
| 19 | 29 |
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 |
| 5 | class="col-12 col-sm numero-pedido text-center text-md-left border border-white align-middle ng-binding ng-scope"> | ||
| 5 | Recepción | 6 | Recepción |
| 6 | <button | 7 | <button class="btn btn-xs btn-outline-light float-right" type="button" (click)="busquedaComprobantes()" |
| 7 | class="btn btn-xs btn-outline-light float-right" | 8 | title="Buscar"> |
| 8 | type="button" | 9 | <i class="fa fa-search"></i> |
| 9 | (click)="busquedaComprobantes()" | ||
| 10 | title="Buscar" | ||
| 11 | > | ||
| 12 | <i class="fa fa-search"></i> | ||
| 13 | </button> | 10 | </button> |
| 14 | </div> | 11 | </div> |
| 15 | <div class="col-7 col-sm border border-white align-middle"> | 12 | <div class="col-7 col-sm border border-white align-middle"> |
| 16 | Fecha: | 13 | Fecha: |
| 17 | <span | 14 | <span ng-click="datepickerAbierto = true"> {{ fecha | date: 'dd/MM/yyyy' }}</span> |
| 18 | ng-click="datepickerAbierto = true" | ||
| 19 | > {{ fecha | date: 'dd/MM/yyyy' }}</span> | ||
| 20 | </div> | 15 | </div> |
| 21 | <div class="col-5 col-sm border border-white border-right-0 align-middle"> | 16 | <div class="col-5 col-sm border border-white border-right-0 align-middle"> |
| 22 | Hora: | 17 | Hora: |
| 23 | <span | 18 | <span ng-click="datepickerAbierto = true"> {{ fecha | date: 'shortTime'}}</span> |
| 24 | ng-click="datepickerAbierto = true" | ||
| 25 | > {{ fecha | date: 'shortTime'}}</span> | ||
| 26 | </div> | 19 | </div> |
| 27 | </div> | 20 | </div> |
| 28 | </div> | 21 | </div> |
| 29 | </div> | 22 | </div> |
| 30 | <div class="row"> | 23 | <div class="row"> |
| 31 | <form class="col-12 col-sm-10"> | 24 | <form class="col-12 col-sm-10"> |
| 32 | <div class="row border"> | 25 | <div class="row border" *ngIf="showCabecera"> |
| 33 | <div class="col-6 col-sm-3 d-flex"> | 26 | <div class="col-6 col-sm-3 d-flex"> |
| 34 | <strong>Letra Factura: </strong> | 27 | <strong>Letra Factura: </strong> |
| 35 | <label>{{cabecera['TIP']}}</label> | 28 | <label>{{cabecera['TIP']}}</label> |
| 36 | </div> | 29 | </div> |
| 37 | <div class="col-6 col-sm-3 d-flex"> | 30 | <div class="col-6 col-sm-3 d-flex"> |
| 38 | <strong>Tipo Factura: </strong> | 31 | <strong>Tipo Factura: </strong> |
| 39 | <label>{{cabecera['TCO']}}</label> | 32 | <label>{{cabecera['TCO']}}</label> |
| 40 | </div> | 33 | </div> |
| 41 | <div class="col-6 col-sm-3 d-flex"> | 34 | <div class="col-6 col-sm-3 d-flex"> |
| 42 | <strong>Sucursal: </strong> | 35 | <strong>Sucursal: </strong> |
| 43 | <label>{{cabecera['SUC']}}</label> | 36 | <label>{{cabecera['SUC']}}</label> |
| 44 | </div> | 37 | </div> |
| 45 | <div class="col-6 col-sm-3 d-flex"> | 38 | <div class="col-6 col-sm-3 d-flex"> |
| 46 | <strong>Número: </strong> | 39 | <strong>Número: </strong> |
| 47 | <label>{{cabecera['NCO']}}</label> | 40 | <label>{{cabecera['NCO']}}</label> |
| 48 | </div> | 41 | </div> |
| 49 | <div class="col-6 col-sm-3 d-flex"> | 42 | <div class="col-6 col-sm-3 d-flex"> |
| 50 | <strong>Cuit: </strong> | 43 | <strong>Cuit: </strong> |
| 51 | <label>{{cabecera['CUI']}}</label> | 44 | <label>{{cabecera['CUI']}}</label> |
| 52 | </div> | 45 | </div> |
| 53 | <div class="col-12 col-sm-6 d-flex"> | 46 | <div class="col-12 col-sm-6 d-flex"> |
| 54 | <strong>Nombre: </strong> | 47 | <strong>Nombre: </strong> |
| 55 | <label>{{cabecera['NOM']}}</label> | 48 | <label>{{cabecera['NOM']}}</label> |
| 56 | </div> | 49 | </div> |
| 57 | </div> | 50 | </div> |
| 58 | <div class="row border pr-2"> | 51 | <div> |
| 59 | <div class="col-4"> | 52 | <button type="button" class="btn btn-dark form-control" (click)="showCabecera = !showCabecera"> |
| 60 | <button | 53 | <i class="fa" [ngClass]="{'fa-chevron-down': !showCabecera, 'fa-chevron-up': showCabecera }"></i> |
| 61 | type="button" | ||
| 62 | class="btn btn-outline-secondary btn-sm" | ||
| 63 | [ngClass]="{'active': estadoArticulos == 'pendiente'}" | ||
| 64 | (click)="estadoArticulos = 'pendiente'; paginaActiva = 1; filter = '';"> | ||
| 65 | Pendientes ({{getCantidadArticulosByEstado('pendiente')}}) | ||
| 66 | </button> | 54 | </button> |
| 67 | </div> | 55 | </div> |
| 68 | <div class="col-4"> | 56 | <div class="row border pr-2"> |
| 69 | <button | 57 | <div class="col-6"> |
| 70 | type="button" | 58 | <button type="button" class="btn btn-outline-success btn-sm" |
| 71 | class="btn btn-outline-success btn-sm" | 59 | [ngClass]="{'active': estadoArticulos == 'modificado'}" |
| 72 | [ngClass]="{'active': estadoArticulos == 'aprobado'}" | 60 | (click)="estadoArticulos == 'modificado' ? estadoArticulos = undefined : estadoArticulos = 'modificado'; filter = '';"> |
| 73 | (click)="estadoArticulos = 'aprobado'; paginaActiva = 1; filter = '';"> | 61 | Modificados ({{getCantidadArticulosByEstado('modificado')}}) |
| 74 | Aprobados ({{getCantidadArticulosByEstado('aprobado')}}) | 62 | </button> |
| 75 | </button> | 63 | </div> |
| 64 | <div class="col-6"> | ||
| 65 | <button type="button" class="btn btn-outline-danger btn-sm" | ||
| 66 | [ngClass]="{'active': estadoArticulos == 'rechazado'}" | ||
| 67 | (click)="estadoArticulos == 'rechazado' ? estadoArticulos = undefined : estadoArticulos = 'rechazado'; filter = '';"> | ||
| 68 | Rechazados ({{getCantidadArticulosByEstado('rechazado')}}) | ||
| 69 | </button> | ||
| 70 | </div> | ||
| 76 | </div> | 71 | </div> |
| 77 | <div class="col-4"> | 72 | <div class="row"> |
| 78 | <button | 73 | <input type="text" class="form-control-sm col-12" placeholder="Busque producto por nombre, codigo" |
| 79 | type="button" | 74 | [(ngModel)]="filter" [ngModelOptions]="{standalone: true}" /> |
| 80 | class="btn btn-outline-danger btn-sm" | ||
| 81 | [ngClass]="{'active': estadoArticulos == 'rechazado'}" | ||
| 82 | (click)="estadoArticulos = 'rechazado'; paginaActiva = 1; filter = '';"> | ||
| 83 | Rechazados ({{getCantidadArticulosByEstado('rechazado')}}) | ||
| 84 | </button> | ||
| 85 | </div> | ||
| 86 | </div> | ||
| 87 | <div class="row"> | ||
| 88 | <input | ||
| 89 | type="text" | ||
| 90 | class="form-control-sm col-12" | ||
| 91 | placeholder="Busque producto por nombre, codigo" | ||
| 92 | [(ngModel)]="filter" | ||
| 93 | [ngModelOptions]="{standalone: true}"/> | ||
| 94 | </div> | 75 | </div> |
| 95 | <div class="row"> | 76 | <div class="row"> |
| 96 | <table class="table table-dark"> | 77 | <table class="table table-dark"> |
| 97 | <thead> | 78 | <thead> |
| 98 | <tr> | 79 | <tr> |
| 99 | <th *ngIf="estadoArticulos != 'rechazado'">Rechazar</th> | ||
| 100 | <th>Producto</th> | 80 | <th>Producto</th> |
| 101 | <th>Cantidad</th> | 81 | <th>Cantidad</th> |
| 102 | <th *ngIf="estadoArticulos != 'aprobado'">Aceptar</th> | 82 | <th></th> |
| 103 | </tr> | 83 | </tr> |
| 104 | </thead> | 84 | </thead> |
| 105 | <tbody> | 85 | <tbody class="scroll-tabla w-100 mb-5"> |
| 106 | <tr *ngFor="let articulo of getPaginaFiltro()" [ngClass]="{'bg-success': articulo.estado == 'aprobado'}"> | 86 | <tr *ngFor="let articulo of getPaginaFiltro();" class="row mx-0" [ngClass]="{'bg-danger': articulo.estado == 'rechazado'}"> |
| 107 | <th *ngIf="estadoArticulos != 'rechazado'"><button type="button" class="" (click)="articulo.estado = 'rechazado'"> | 87 | <td class="col-5">{{articulo.TIO.trim() || articulo.LI0}}</td> |
| 108 | <i class="fa fa-window-close"></i> | 88 | <td |
| 109 | </button></th> | 89 | class="col-5" |
| 110 | <th>{{articulo.TIO}}</th> | 90 | *ngIf="!articulo.input" |
| 111 | <th *ngIf="!articulo.input" (click)="articulo.input = true"> | 91 | (click)="articulo.estado != 'rechazado' ? articulo.input = true : false" |
| 112 | {{articulo.recibido ? articulo.recibido + '/' : ''}}{{articulo.CAN}}</th> | 92 | > |
| 113 | <th *ngIf="articulo.input"> | 93 | {{articulo.recibido ? articulo.recibido + '/' : ''}}{{articulo.CAN}} |
| 114 | <input | 94 | </td> |
| 115 | class="form-control-sm col-12" | 95 | <td *ngIf="articulo.input" class="col-5"> |
| 96 | <input | ||
| 97 | class="form-control-sm col-10" | ||
| 116 | type="number" | 98 | type="number" |
| 117 | (keyup.enter)="articulo.input = false" | 99 | (focus)="$event.target.select();" |
| 118 | [(ngModel)]="articulo.recibido" | 100 | (keyup.enter)="articulo.input = false; articulo.recibido = articulo.tempRecibido" |
| 119 | [ngModelOptions]="{standalone: true}" | 101 | [(ngModel)]="articulo.tempRecibido" |
| 120 | autofocus/> | 102 | [ngModelOptions]="{standalone: true}" autofocus/> |
| 121 | /{{articulo.CAN}} | 103 | /{{articulo.CAN}} |
| 122 | </th> | 104 | </td> |
| 123 | <th *ngIf="estadoArticulos != 'aprobado'"> | 105 | <td class="col-2" *ngIf="articulo.estado != 'rechazado'"> |
| 124 | <button type="button" class="" (click)="articulo.estado = 'aprobado'"> | 106 | <button type="button" |
| 125 | <i class="fa fa-check"></i> | 107 | (click)="articulo.estado = 'rechazado'"> |
| 126 | </button> | 108 | <i class="fa fa-window-close"></i> |
| 127 | </th> | 109 | </button> |
| 128 | </tr> | 110 | </td> |
| 129 | <tr> | 111 | <td class="col-2" *ngIf="articulo.estado == 'rechazado'"> |
| 130 | <th colspan="3" *ngIf="articulosFiltro.length == 0">Por el momento no hay elementos aquí</th> | 112 | <button type="button" (click)="articulo.estado = undefined"> |
| 131 | </tr> | 113 | <i class="fa fa-check"></i> |
| 132 | </tbody> | 114 | </button> |
| 133 | <tfoot> | 115 | </td> |
| 116 | </tr> | ||
| 117 | <tr> | ||
| 118 | <th colspan="3" *ngIf="articulosFiltro.length == 0">Por el momento no hay elementos aquí</th> | ||
| 119 | </tr> | ||
| 120 | </tbody> | ||
| 121 | <!-- <tfoot> | ||
| 134 | <nav *ngIf="articulosFiltro.length > 0" class="mr-auto position-absolute mb-5"> | 122 | <nav *ngIf="articulosFiltro.length > 0" class="mr-auto position-absolute mb-5"> |
| 135 | <ul class="pagination pagination-sm justify-content mb-0"> | 123 | <ul class="pagination pagination-sm justify-content mb-0"> |
| 136 | <li class="page-item" [ngClass]="{'disabled': paginaActiva == 1}"> | 124 | <li class="page-item" [ngClass]="{'disabled': paginaActiva == 1}"> |
| 137 | <a class="page-link" href="javascript:void();" (click)="paginaActiva = paginaActiva - 1"> | 125 | <a class="page-link" href="javascript:void();" (click)="paginaActiva = paginaActiva - 1"> |
| 138 | <span aria-hidden="true">«</span> | 126 | <span aria-hidden="true">«</span> |
| 139 | <span class="sr-only">Anterior</span> | 127 | <span class="sr-only">Anterior</span> |
| 140 | </a> | 128 | </a> |
| 141 | </li> | 129 | </li> |
| 142 | <li | 130 | <li |
| 143 | class="page-item" | 131 | class="page-item" |
| 144 | *ngFor="let pagina of paginas; index as i" | 132 | *ngFor="let pagina of paginas; index as i" |
| 145 | [ngClass]="{'active': pagina == paginaActiva}" | 133 | [ngClass]="{'active': pagina == paginaActiva}" |
| 146 | > | 134 | > |
| 147 | <a | 135 | <a |
| 148 | class="page-link" | 136 | class="page-link" |
| 149 | href="javascript:void();" | 137 | href="javascript:void();" |
| 150 | (click)="paginaActiva = pagina" | 138 | (click)="paginaActiva = pagina" |
| 151 | >{{pagina}}</a> | 139 | >{{pagina}}</a> |
src/app/comprobantes/comprobantes.component.scss
| 1 | .panel-informativo { | 1 | .panel-informativo { |
| 2 | background: #67615e; | 2 | background: #67615e; |
| 3 | color: #FFF; | 3 | color: #FFF; |
| 4 | min-height: 32px; | 4 | min-height: 32px; |
| 5 | .form-group { | 5 | .form-group { |
| 6 | margin-bottom: 5px; | 6 | margin-bottom: 5px; |
| 7 | } | 7 | } |
| 8 | .form-control-xs { | 8 | .form-control-xs { |
| 9 | height: calc(1.6rem); | 9 | height: calc(1.6rem); |
| 10 | padding: .25rem .5rem; | 10 | padding: .25rem .5rem; |
| 11 | font-size: .8rem; | 11 | font-size: .8rem; |
| 12 | line-height: 1.3; | 12 | line-height: 1.3; |
| 13 | border-radius: .2rem; | 13 | border-radius: .2rem; |
| 14 | } | 14 | } |
| 15 | .label { | 15 | .label { |
| 16 | font-size: .8em; | 16 | font-size: .8em; |
| 17 | } | 17 | } |
| 18 | .valor { | 18 | .valor { |
| 19 | font-size: .8em; | 19 | font-size: .8em; |
| 20 | } | 20 | } |
| 21 | 21 | ||
| 22 | .border{ | 22 | .border{ |
| 23 | border-width: 4px 2px !important; | 23 | border-width: 4px 2px !important; |
| 24 | } | 24 | } |
| 25 | 25 | ||
| 26 | .nota-pedido { | 26 | .nota-pedido { |
| 27 | @media (max-width: 576px) { | 27 | @media (max-width: 576px) { |
| 28 | text-align: center; | 28 | text-align: center; |
| 29 | } | 29 | } |
| 30 | } | 30 | } |
| 31 | 31 | ||
| 32 | } | 32 | } |
| 33 | .titulares>div{ | 33 | .titulares>div{ |
| 34 | display: flex; | 34 | display: flex; |
| 35 | line-height: 30px; | 35 | line-height: 30px; |
| 36 | h5{ | 36 | h5{ |
| 37 | line-height: 30px; | 37 | line-height: 30px; |
| 38 | } | 38 | } |
| 39 | button{ | 39 | button{ |
| 40 | margin: auto; | 40 | margin: auto; |
| 41 | margin-right: 0; | 41 | margin-right: 0; |
| 42 | } | 42 | } |
| 43 | 43 | ||
| 44 | @media(max-width: 992px){ | 44 | @media(max-width: 992px){ |
| 45 | border-top: none !important; | 45 | border-top: none !important; |
| 46 | border-right: none !important; | 46 | border-right: none !important; |
| 47 | border-left: none !important; | 47 | border-left: none !important; |
| 48 | border-bottom: 2px solid #FFF !important; | 48 | border-bottom: 2px solid #FFF !important; |
| 49 | &:last-child{ | 49 | &:last-child{ |
| 50 | border-left: 2px solid #FFF !important; | 50 | border-left: 2px solid #FFF !important; |
| 51 | } | 51 | } |
| 52 | &:first-child{ | 52 | &:first-child{ |
| 53 | border-top: 2px solid #FFF !important; | 53 | border-top: 2px solid #FFF !important; |
| 54 | } | 54 | } |
| 55 | } | 55 | } |
| 56 | } | ||
| 56 | } | ||
| 57 | |||
| 58 | .scroll-tabla { | ||
| 59 | position: absolute; | ||
| 60 | max-height: 200%; | ||
| 61 | overflow: auto; | ||
| 62 | background-color: #343a40; | ||
| 63 | } |
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 | import { Router } from '@angular/router'; |
| 6 | 6 | ||
| 7 | @Component({ | 7 | @Component({ |
| 8 | templateUrl: './comprobantes.component.html', | 8 | templateUrl: './comprobantes.component.html', |
| 9 | styleUrls: ['./comprobantes.component.scss'], | 9 | styleUrls: ['./comprobantes.component.scss'], |
| 10 | providers:[ ComprobanteService ] | 10 | providers:[ ComprobanteService ] |
| 11 | }) | 11 | }) |
| 12 | export class ComprobantesComponent implements OnInit { | 12 | export class ComprobantesComponent implements OnInit { |
| 13 | 13 | ||
| 14 | constructor( | 14 | constructor( |
| 15 | private modalService: NgbModal, | 15 | private modalService: NgbModal, |
| 16 | public comprobanteService: ComprobanteService, | 16 | public comprobanteService: ComprobanteService, |
| 17 | public router: Router) { } | 17 | public router: Router) { } |
| 18 | 18 | ||
| 19 | ngOnInit() { } | 19 | ngOnInit() { } |
| 20 | 20 | ||
| 21 | filter = ''; | 21 | filter = ''; |
| 22 | estadoArticulos = 'pendiente'; | 22 | estadoArticulos : string; |
| 23 | comprobantes = [1, 2, 3]; | 23 | tempRecibido = []; |
| 24 | cabecera = {}; | 24 | cabecera = {}; |
| 25 | cuerpo = []; | 25 | cuerpo = []; |
| 26 | articulosFiltro = []; | 26 | articulosFiltro = []; |
| 27 | paginaActiva = 1; | ||
| 28 | paginas = []; | ||
| 29 | saveLoading = false; | 27 | saveLoading = false; |
| 28 | showCabecera = true; | ||
| 30 | 29 | ||
| 31 | fecha = new Date(); | 30 | fecha = new Date(); |
| 32 | 31 | ||
| 33 | paginar() { | ||
| 34 | |||
| 35 | var cantPaginas = Math.ceil(this.articulosFiltro.length / 5); | ||
| 36 | this.paginas = []; | ||
| 37 | for (let i = 0; i < cantPaginas; i++) { | ||
| 38 | this.paginas.push(i + 1); | ||
| 39 | } | ||
| 40 | } | ||
| 41 | |||
| 42 | getPaginaFiltro() { | 32 | getPaginaFiltro() { |
| 43 | 33 | ||
| 44 | this.articulosFiltro = this.cuerpo.filter((articulo) => { | 34 | this.articulosFiltro = this.cuerpo.filter((articulo) => { |
| 45 | return articulo.estado == this.estadoArticulos && | ||
| 46 | (articulo.TIO.toLocaleUpperCase().includes(this.filter.toLocaleUpperCase()) || | ||
| 47 | articulo.codigoBarras == this.filter); | ||
| 48 | }); | ||
| 49 | 35 | ||
| 50 | this.paginar(); | 36 | var tio = articulo.TIO.trim().toLocaleUpperCase().includes(this.filter.toLocaleUpperCase()); |
| 37 | var lio = articulo.LI0.trim().toLocaleUpperCase().includes(this.filter.toLocaleUpperCase()); | ||
| 38 | var codigoBarras = articulo.codigoBarras == this.filter; | ||
| 39 | |||
| 40 | articulo.recibido && !articulo.estado ? articulo.estado = 'modificado' : false; | ||
| 41 | |||
| 42 | var estado = articulo.estado == this.estadoArticulos; | ||
| 43 | |||
| 44 | return (tio || lio || codigoBarras) && estado; | ||
| 45 | }); | ||
| 51 | 46 | ||
| 52 | return this.articulosFiltro.slice((this.paginaActiva - 1) * 5 , this.paginaActiva * 5); | 47 | return this.articulosFiltro; |
| 53 | } | 48 | } |
| 54 | 49 | ||
| 55 | getCantidadArticulosByEstado(estado: String) { | 50 | getCantidadArticulosByEstado(estado: String) { |
| 56 | return this.cuerpo.filter((articulo) => { | 51 | return this.cuerpo.filter((articulo) => { |
| 57 | return articulo.estado == estado; | 52 | return articulo.estado == estado; |
| 58 | }).length; | 53 | }).length; |
| 59 | } | 54 | } |
| 60 | 55 | ||
| 61 | guardarComprobante() { | 56 | guardarComprobante() { |
| 62 | 57 | ||
| 63 | if (this.getCantidadArticulosByEstado('pendiente')) { | 58 | if (this.getCantidadArticulosByEstado('pendiente')) { |
| 64 | alert('No deben quedar articulos pendientes'); | 59 | alert('No deben quedar articulos pendientes'); |
| 60 | return; | ||
| 65 | } | 61 | } |
| 66 | 62 | ||
| 63 | if (!this.cuerpo.length) { | ||
| 64 | alert('Debe seleccionar un comprobante'); | ||
| 65 | return; | ||
| 66 | } | ||
| 67 | |||
| 68 | this.saveLoading = true; | ||
| 69 | |||
| 67 | this.comprobanteService | 70 | this.comprobanteService |
| 68 | .saveComprobantes({cabecera: this.cabecera, cuerpo: this.cuerpo}) | 71 | .saveComprobantes({cabecera: this.cabecera, cuerpo: this.cuerpo}) |
| 69 | .subscribe(data => { | 72 | .subscribe(data => { |
| 73 | |||
| 70 | alert('Comprobante guardado con éxito'); | 74 | alert('Comprobante guardado con éxito'); |
| 75 | this.saveLoading = false; | ||
| 71 | this.router.navigateByUrl('/home'); | 76 | this.router.navigateByUrl('/home'); |
| 77 | |||
| 72 | }, err => { | 78 | }, err => { |
| 79 | |||
| 73 | alert('Algo salió mal'); | 80 | alert('Algo salió mal'); |
| 81 | this.saveLoading = false; | ||
| 74 | console.log(err); | 82 | console.log(err); |
src/etc/AppSetings.ts
| 1 | export class AppSetings { | 1 | export class AppSetings { |
| 2 | public static END_POINT='http://10.231.45.234:6060/gateway-debo'; | 2 | public static END_POINT='http://localhost:6060/gateway-debo'; |
| 3 | } | 3 | } |
| 4 | 4 |