File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1212 </ div >
1313</ div >
1414
15- < button mat-raised-button color ="primary " class ="w-100 " (click) ="test() "> TEST</ button >
15+ <!-- button mat-raised-button color="primary" class="w-100" (click)="test()">TEST</button-- >
1616
17- < div *ngIf ="invoices.length > 0 " class ="row ">
17+ < div *ngIf ="invoices.length > 0 && !loading " class ="row ">
1818 < div class ="col-12 ">
1919 < table mat-table [dataSource] ="invoices " class ="mat-elevation-z8 w-100 " multiTemplateDataRows >
2020
@@ -56,4 +56,7 @@ <h5 class="mb-1"><b>Receptor:</b> {{element.nameRec}}</h5>
5656
5757 </ table >
5858 </ div >
59+ </ div >
60+ < div class ="row text-center " *ngIf ="loading ">
61+ < mat-spinner class ="mx-auto " diameter ="40 "> </ mat-spinner >
5962</ div >
Original file line number Diff line number Diff line change @@ -41,6 +41,8 @@ export class AfipComponent implements OnInit {
4141 expandedElement : InvoiceElement | null | undefined ;
4242 @ViewChild ( MatTable ) table : MatTable < InvoiceElement > | undefined ;
4343
44+ loading = false ;
45+
4446 constructor ( private barcodeScanner : BarcodeScanner , public dialog : MatDialog , private http : HttpClient ) { }
4547
4648 ngOnInit ( ) : void {
@@ -75,6 +77,7 @@ export class AfipComponent implements OnInit {
7577 }
7678
7779 async processQR ( t : string ) {
80+ this . loading = true ;
7881 const url = new URL ( t ) ;
7982 const p : any = url . searchParams . get ( 'p' ) ;
8083 let encode = p . replace ( / b \' ( .* ) \' / , '$1' ) . replace ( / \n / g, '' ) ;
@@ -91,15 +94,18 @@ export class AfipComponent implements OnInit {
9194 newinvoice . nameRec = dataR . Contribuyente . nombre ;
9295 this . invoices . push ( newinvoice ) ;
9396 localStorage . setItem ( 'invoices' , JSON . stringify ( this . invoices ) ) ;
97+ this . loading = false ;
9498 if ( this . table ) {
9599 this . table ! . renderRows ( ) ;
96100 }
97101 }
98102 } , ( err : any ) => {
103+ this . loading = false ;
99104 this . openDialog ( err ) ;
100105 } ) ;
101106 }
102107 } , ( err : any ) => {
108+ this . loading = false ;
103109 this . openDialog ( err ) ;
104110 } )
105111 } else {
Original file line number Diff line number Diff line change @@ -20,6 +20,7 @@ import { MatButtonModule } from '@angular/material/button';
2020import { MatTableModule } from '@angular/material/table' ;
2121import { MatIconModule } from '@angular/material/icon' ;
2222import { MatDialogModule } from '@angular/material/dialog' ;
23+ import { MatProgressSpinnerModule } from '@angular/material/progress-spinner' ;
2324
2425import { AfipComponent } from './afip/afip.component' ;
2526import { DialogContent } from './afip/afip.component' ;
@@ -47,7 +48,8 @@ const routes: Routes = [
4748 MatButtonModule ,
4849 MatTableModule ,
4950 MatIconModule ,
50- MatDialogModule
51+ MatDialogModule ,
52+ MatProgressSpinnerModule
5153 ] ,
5254 providers : [ BarcodeScanner , FileOpener ] ,
5355 bootstrap : [ AppComponent ]
You can’t perform that action at this time.
0 commit comments