Create reports in Angular and Firebase

0

What to use to create reports with Angular and Firebase?

I have an application in the health area with Angular and Firebase, I'm getting in the reporting part of the system and would like alternatives in creating reports.

Reports should:

  • Be displayed online within the system and with the option to print.
  • Be downloaded in PDF for archiving and if necessary also print.
  • I would like to know what I can use to form reports with Angular and Firebase, I have been doing some research but nothing pleased me in such a way, because I would like something faster for development.

        
    asked by anonymous 06.02.2018 / 13:33

    1 answer

    0

    It had an application with angular and firebase too but it was a POS printed the requests as follows had a class or template for each type of request in that class had two methods one to draw the html that was going to be printed and the other to call the print window:

    // relatorioPrinter.model.ts
    
    export class RelatorioPrinter {
       public impressao: string;
    
       constructor(dados: any) {
           this.paint(dados);
       }
    
       public print(): void {
           const params = [
              '', 
              '_blank', 
              'height=ALTURA_DO PDF,width=LARGURA_DO_PDF'
           ]
    
           const popup = window.open(...params);
    
           popup.document.open();
           popup.document.write(this.impressao);
           popup.document.close();
       }
    
       public paint(dados: any): void {
           this.impressao = '<!DOCTYPE html>
                          <html>
                            <head>
                               <style>
                               /* SEU ESTILO AQUI */
                               </style>
                            </head>
                            <body onload="window.print()">';
    
            this.impressao += 'SEU HTML AQUI ${dados.SEUS_DADOS_AQUI}';
            this.impressao += '</body></html>';
       }
    }
    

    To use was simple:

    // exemplo.component.ts
    
    import { Component } from '@angular/core';
    import { RelatorioPrinter } from 'app/models/relatorioPrinter';
    
    @Component({
        selector: 'app-exemplo',
        templateUrl: './exemplo.component.html'
     })
     export class ExemploComponent {
        public printer: RelatorioPrinter; 
    
        public constructor() { 
            const seuDados = {};
            this.printer = new RelatorioPrinter(seuDados);
        }
     }
    

    Well then I needed a more robust solution to pack many reports etc ... but at the beginning this helped me a lot.

    I hope I have helped: D

        
    06.02.2018 / 14:13