File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11< div class ="row mb-2 ">
2- < div class ="col-6 ">
2+ < div class ="col-12 ">
33 < button mat-raised-button color ="primary " class ="w-100 " (click) ="scanQR() "> Escanear QR</ button >
44 </ div >
5+ </ div >
6+ < div class ="row mb-2 ">
7+ < div class ="col-6 ">
8+ < button mat-raised-button color ="warn " class ="w-100 " (click) ="removeInvoices() " [disabled] ="invoices.length == 0 "> Eliminar Facturas</ button >
9+ </ div >
510 < div class ="col-6 ">
611 < button mat-raised-button color ="accent " class ="w-100 " (click) ="exportToCSV() " [disabled] ="invoices.length == 0 "> Exportar</ button >
712 </ div >
Original file line number Diff line number Diff line change @@ -35,6 +35,12 @@ export class AfipComponent implements OnInit {
3535 constructor ( private barcodeScanner : BarcodeScanner ) { }
3636
3737 ngOnInit ( ) : void {
38+ let inv = localStorage . getItem ( 'invoices' ) ;
39+ if ( inv ) {
40+ if ( JSON . parse ( inv ) . length > 0 ) {
41+ this . invoices = JSON . parse ( inv ) ;
42+ }
43+ }
3844 }
3945
4046 scanQR ( ) {
@@ -54,6 +60,11 @@ export class AfipComponent implements OnInit {
5460 this . processQR ( urlText ) ;
5561 }
5662
63+ removeInvoices ( ) : void {
64+ this . invoices . length = 0 ;
65+ localStorage . setItem ( 'invoices' , JSON . stringify ( this . invoices ) ) ;
66+ }
67+
5768 processQR ( t : string ) {
5869 const url = new URL ( t ) ;
5970 const p : any = url . searchParams . get ( 'p' ) ;
@@ -63,6 +74,7 @@ export class AfipComponent implements OnInit {
6374 console . log ( obj ) ;
6475 if ( url . host === 'www.afip.gob.ar' || url . host === 'afip.gob.ar' ) {
6576 this . invoices . push ( this . processQrFeAr ( obj ) ) ;
77+ localStorage . setItem ( 'invoices' , JSON . stringify ( this . invoices ) ) ;
6678 console . log ( this . invoices ) ;
6779 if ( this . table ) {
6880 this . table ! . renderRows ( ) ;
Original file line number Diff line number Diff line change @@ -16,6 +16,9 @@ import { BarcodeScanner } from '@awesome-cordova-plugins/barcode-scanner/ngx';
1616import { MatToolbarModule } from '@angular/material/toolbar' ;
1717import { MatButtonModule } from '@angular/material/button' ;
1818import { MatTableModule } from '@angular/material/table' ;
19+ import { MatIconModule } from '@angular/material/icon' ;
20+ import { MatDialogModule } from '@angular/material/dialog' ;
21+
1922import { AfipComponent } from './afip/afip.component' ;
2023
2124const routes : Routes = [
@@ -37,7 +40,9 @@ const routes: Routes = [
3740 RouterModule . forRoot ( routes ) ,
3841 MatToolbarModule ,
3942 MatButtonModule ,
40- MatTableModule
43+ MatTableModule ,
44+ MatIconModule ,
45+ MatDialogModule
4146 ] ,
4247 providers : [ BarcodeScanner ] ,
4348 bootstrap : [ AppComponent ]
You can’t perform that action at this time.
0 commit comments