Export to XLS table reports

This commit is contained in:
Jose Alberto Hernandez
2024-01-05 17:05:50 +01:00
committed by Adam Saghy
parent 80b821838c
commit 546e59113f
16 changed files with 146 additions and 5 deletions
+95
View File
@@ -42,6 +42,7 @@
"rxjs": "6.6.2",
"tslib": "^2.0.0",
"vkbeautify": "^0.99.2",
"xlsx": "^0.18.5",
"zone.js": "0.11.6"
},
"devDependencies": {
@@ -4469,6 +4470,14 @@
"node": ">=8.9.0"
}
},
"node_modules/adler-32": {
"version": "1.3.1",
"resolved": "https://registry.npmjs.org/adler-32/-/adler-32-1.3.1.tgz",
"integrity": "sha512-ynZ4w/nUUv5rrsR8UUGoe1VC9hZj6V5hU9Qw1HlMDJGEJw5S7TfTErWTjMys6M7vr0YWcPqs3qAr4ss0nDfP+A==",
"engines": {
"node": ">=0.8"
}
},
"node_modules/adm-zip": {
"version": "0.5.10",
"resolved": "https://registry.npmjs.org/adm-zip/-/adm-zip-0.5.10.tgz",
@@ -5768,6 +5777,18 @@
"url": "https://github.com/sponsors/wooorm"
}
},
"node_modules/cfb": {
"version": "1.2.2",
"resolved": "https://registry.npmjs.org/cfb/-/cfb-1.2.2.tgz",
"integrity": "sha512-KfdUZsSOw19/ObEWasvBP/Ac4reZvAGauZhs6S/gqNhXhI7cKwvlH7ulj+dOEYnca4bm4SGo8C1bTAQvnTjgQA==",
"dependencies": {
"adler-32": "~1.3.0",
"crc-32": "~1.2.0"
},
"engines": {
"node": ">=0.8"
}
},
"node_modules/chalk": {
"version": "2.4.2",
"resolved": "https://registry.npmjs.org/chalk/-/chalk-2.4.2.tgz",
@@ -6212,6 +6233,14 @@
"integrity": "sha512-LXVLVEq0NNOqK/fLJo3d0kfzd4sxwn2/h67/02pjCjfKDxgx1i9QqpvtHD8CrBnSSwMw5+dy11O7FRX5mkO7Cg==",
"dev": true
},
"node_modules/codepage": {
"version": "1.15.0",
"resolved": "https://registry.npmjs.org/codepage/-/codepage-1.15.0.tgz",
"integrity": "sha512-3g6NUTPd/YtuuGrhMnOMRjFc+LJw/bnMp3+0r/Wcz3IXUuCosKRJvMphm5+Q+bvTVGcJJuRvVLuYba+WojaFaA==",
"engines": {
"node": ">=0.8"
}
},
"node_modules/collapse-white-space": {
"version": "1.0.6",
"resolved": "https://registry.npmjs.org/collapse-white-space/-/collapse-white-space-1.0.6.tgz",
@@ -6695,6 +6724,17 @@
"node": ">=10"
}
},
"node_modules/crc-32": {
"version": "1.2.2",
"resolved": "https://registry.npmjs.org/crc-32/-/crc-32-1.2.2.tgz",
"integrity": "sha512-ROmzCKrTnOwybPcJApAA6WBWij23HVfGVNKqqrZpuyZOHqK2CwHSvpGuyt/UNNvaIjEd8X5IFGp4Mh+Ie1IHJQ==",
"bin": {
"crc32": "bin/crc32.njs"
},
"engines": {
"node": ">=0.8"
}
},
"node_modules/create-require": {
"version": "1.1.1",
"resolved": "https://registry.npmjs.org/create-require/-/create-require-1.1.1.tgz",
@@ -9802,6 +9842,14 @@
"node": ">= 0.6"
}
},
"node_modules/frac": {
"version": "1.1.2",
"resolved": "https://registry.npmjs.org/frac/-/frac-1.1.2.tgz",
"integrity": "sha512-w/XBfkibaTl3YDqASwfDUqkna4Z2p9cFSr1aHDt0WoMTECnRfBOv2WArlZILlqgWlmdIlALXGpM2AOhEk5W3IA==",
"engines": {
"node": ">=0.8"
}
},
"node_modules/fraction.js": {
"version": "4.3.7",
"resolved": "https://registry.npmjs.org/fraction.js/-/fraction.js-4.3.7.tgz",
@@ -19057,6 +19105,17 @@
"integrity": "sha512-Oo+0REFV59/rz3gfJNKQiBlwfHaSESl1pcGyABQsnnIfWOFt6JNj5gCog2U6MLZ//IGYD+nA8nI+mTShREReaA==",
"dev": true
},
"node_modules/ssf": {
"version": "0.11.2",
"resolved": "https://registry.npmjs.org/ssf/-/ssf-0.11.2.tgz",
"integrity": "sha512-+idbmIXoYET47hH+d7dfm2epdOMUDjqcB4648sTZ+t2JwoyBFL/insLfB/racrDmsKB3diwsDA696pZMieAC5g==",
"dependencies": {
"frac": "~1.1.2"
},
"engines": {
"node": ">=0.8"
}
},
"node_modules/sshpk": {
"version": "1.18.0",
"resolved": "https://registry.npmjs.org/sshpk/-/sshpk-1.18.0.tgz",
@@ -22435,6 +22494,22 @@
"node": ">= 10.0.0"
}
},
"node_modules/wmf": {
"version": "1.0.2",
"resolved": "https://registry.npmjs.org/wmf/-/wmf-1.0.2.tgz",
"integrity": "sha512-/p9K7bEh0Dj6WbXg4JG0xvLQmIadrner1bi45VMJTfnbVHsc7yIajZyoSoK60/dtVBs12Fm6WkUI5/3WAVsNMw==",
"engines": {
"node": ">=0.8"
}
},
"node_modules/word": {
"version": "0.3.0",
"resolved": "https://registry.npmjs.org/word/-/word-0.3.0.tgz",
"integrity": "sha512-OELeY0Q61OXpdUfTp+oweA/vtLVg5VDOXh+3he3PNzLGG/y0oylSOC1xRVj0+l4vQ3tj/bB1HVHv1ocXkQceFA==",
"engines": {
"node": ">=0.8"
}
},
"node_modules/wrap-ansi": {
"version": "7.0.0",
"resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-7.0.0.tgz",
@@ -22588,6 +22663,26 @@
"integrity": "sha512-GojqklwG8gpzOVEVki5KudKNoq7MbbjYZCbyWzEz7tyPA7eleiE0+ePwOWQQRb5fm86rD3S8Tc0tSFf3AOv50w==",
"dev": true
},
"node_modules/xlsx": {
"version": "0.18.5",
"resolved": "https://registry.npmjs.org/xlsx/-/xlsx-0.18.5.tgz",
"integrity": "sha512-dmg3LCjBPHZnQp5/F/+nnTa+miPJxUXB6vtk42YjBBKayDNagxGEeIdWApkYPOf3Z3pm3k62Knjzp7lMeTEtFQ==",
"dependencies": {
"adler-32": "~1.3.0",
"cfb": "~1.2.1",
"codepage": "~1.15.0",
"crc-32": "~1.2.1",
"ssf": "~0.11.2",
"wmf": "~1.0.1",
"word": "~0.3.0"
},
"bin": {
"xlsx": "bin/xlsx.njs"
},
"engines": {
"node": ">=0.8"
}
},
"node_modules/xml": {
"version": "1.0.1",
"resolved": "https://registry.npmjs.org/xml/-/xml-1.0.1.tgz",
+2 -1
View File
@@ -36,13 +36,13 @@
"@angular/common": "14.3.0",
"@angular/compiler": "14.3.0",
"@angular/core": "14.3.0",
"@angular/flex-layout": "^14.0.0-beta.40",
"@angular/forms": "14.3.0",
"@angular/localize": "14.3.0",
"@angular/material": "14.2.7",
"@angular/platform-browser": "14.3.0",
"@angular/platform-browser-dynamic": "14.3.0",
"@angular/router": "14.3.0",
"@angular/flex-layout": "^14.0.0-beta.40",
"@ckeditor/ckeditor5-angular": "1.2.3",
"@ckeditor/ckeditor5-build-classic": "21.0.0",
"@fortawesome/angular-fontawesome": "0.11.1",
@@ -61,6 +61,7 @@
"rxjs": "6.6.2",
"tslib": "^2.0.0",
"vkbeautify": "^0.99.2",
"xlsx": "^0.18.5",
"zone.js": "0.11.6"
},
"devDependencies": {
@@ -2,15 +2,19 @@
<div *ngIf="!hideOutput && !toBeExportedToRepo">
<div class="m-b-10" *ngIf="dataObject.report.type === 'Table'" fxLayoutAlign="end">
<div class="m-b-10" *ngIf="dataObject.report.type === 'Table'" fxLayoutGap="25px" fxLayoutAlign="end">
<button mat-raised-button color="primary" (click)="exportFile()" [disabled]="notExistsReportData"
matToolTip="{{'labels.text.Export the data to CSV file' | translate}}">
{{'labels.buttons.Export CSV' | translate}}
</button>
<button mat-raised-button color="primary" (click)="exportToXLS()" [disabled]="notExistsReportData"
matToolTip="{{'labels.text.Export the data to XLS file' | translate}}">
{{'labels.buttons.Export XLS' | translate}}
</button>
</div>
<div class="table-output" [hidden]="notExistsReportData">
<table mat-table [dataSource]="dataSource">
<table id="report-table" mat-table [dataSource]="dataSource">
<div *ngFor="let column of displayedColumns index as i">
<ng-container [matColumnDef]="column">
<th mat-header-cell *matHeaderCellDef>{{column}}</th>
@@ -2,7 +2,7 @@
import { Component, Input, ViewChild, OnChanges } from '@angular/core';
import { MatPaginator } from '@angular/material/paginator';
import { MatTableDataSource } from '@angular/material/table';
import { DecimalPipe, NumberSymbol, getLocaleNumberSymbol } from '@angular/common';
import { DecimalPipe } from '@angular/common';
/** Custom Servies */
import { ReportsService } from '../../reports.service';
@@ -14,6 +14,8 @@ import { FormDialogComponent } from 'app/shared/form-dialog/form-dialog.componen
import { environment } from 'environments/environment';
import { ProgressBarService } from 'app/core/progress-bar/progress-bar.service';
import * as XLSX from 'xlsx';
/**
* Table and SMS Component
*/
@@ -135,6 +137,21 @@ export class TableAndSmsComponent implements OnChanges {
});
}
exportToXLS(): void {
const fileName = `${this.dataObject.report.name}.xlsx`;
const data = this.csvData.map((object: any) => {
const row = {};
for (let i = 0; i < this.displayedColumns.length; i++) {
row[this.displayedColumns[i]] = object.row[i];
}
return row;
});
const ws: XLSX.WorkSheet = XLSX.utils.json_to_sheet(data, {header: this.displayedColumns});
const wb: XLSX.WorkBook = XLSX.utils.book_new();
XLSX.utils.book_append_sheet(wb, ws, 'Report');
XLSX.writeFile(wb, fileName);
}
/**
* Generates the CSV file dynamically for run report data.
*/
+3 -1
View File
@@ -387,7 +387,8 @@
"Enable": "Umožnit",
"Expand All": "Rozšířit vše",
"Export": "Vývozní",
"Export CSV": "Export CSV",
"Export CSV": "Vývozní CSV",
"Export XLS": "Vývozní XLS",
"Foreclosure": "Exekuce",
"GLIM Loan Application": "Žádost o půjčku GLIM",
"GSIM Application": "Aplikace GSIM",
@@ -2426,6 +2427,7 @@
"Entity Data Table Checks": "Kontroly tabulky dat entit",
"Entity Data Table Checks Organization": "Definujte kontroly tabulky dat entit pro organizaci",
"Entity to Entity Mapping": "Mapování entity na entitu",
"Export output data to S3 repository": "Exportní výstupní data do úložiště S3",
"External Asset Owner": "Externí vlastník aktiv",
"External Events configuration, to enable or disable": "Konfigurace externích událostí pro povolení nebo zakázání publikování událostí",
"External Services": "Externí služby",
+2
View File
@@ -388,6 +388,7 @@
"Expand All": "Alle erweitern",
"Export": "Export",
"Export CSV": "CSV exportieren",
"Export XLS": "XLS exportieren",
"Foreclosure": "Zwangsvollstreckung",
"GLIM Loan Application": "GLIM-Kreditantrag",
"GSIM Application": "GSIM-Anwendung",
@@ -2425,6 +2426,7 @@
"Entity Data Table Checks": "Überprüfungen der Entitätsdatentabelle",
"Entity Data Table Checks Organization": "Definieren Sie Entitätsdatentabellenprüfungen für die Organisation",
"Entity to Entity Mapping": "Zuordnung von Entität zu Entität",
"Export output data to S3 repository": "Exportieren Sie Ausgabedaten in S3 Repository",
"External Asset Owner": "Externer Asset-Eigentümer",
"External Events configuration, to enable or disable": "Konfiguration externer Ereignisse, um die Ereignisveröffentlichung zu aktivieren oder zu deaktivieren",
"External Services": "Externe Dienste",
+2
View File
@@ -388,6 +388,7 @@
"Expand All": "Expand All",
"Export": "Export",
"Export CSV": "Export CSV",
"Export XLS": "Export XLS",
"Foreclosure": "Foreclosure",
"GLIM Loan Application": "GLIM Loan Application",
"GSIM Application": "GSIM Application",
@@ -2427,6 +2428,7 @@
"Entity Data Table Checks": "Entity Data Table Checks",
"Entity Data Table Checks Organization": "Define Entity Data Table Checks for Organization",
"Entity to Entity Mapping": "Entity to Entity Mapping",
"Export output data to S3 repository": "Export output data to S3 repository",
"External Asset Owner": "External Asset Owner",
"External Events configuration, to enable or disable": "External Events configuration, to enable or disable the event publication",
"External Services": "External Services",
+2
View File
@@ -388,6 +388,7 @@
"Expand All": "Expandir todo",
"Export": "Exportar",
"Export CSV": "Exportar CSV",
"Export XLS": "Exportar XLS",
"Foreclosure": "Juicio hipotecario",
"GLIM Loan Application": "Solicitud de Crédito GLIM",
"GSIM Application": "Aplicación GSIM",
@@ -2426,6 +2427,7 @@
"Entity Data Table Checks": "Verificaciones de la tabla de datos de la entidad",
"Entity Data Table Checks Organization": "Definir comprobaciones de la tabla de datos de la entidad para la organización",
"Entity to Entity Mapping": "Mapeo de entidad a entidad",
"Export output data to S3 repository": "Exportar datos de salida al repositorio S3",
"External Asset Owner": "Propietario de activos externos",
"External Events configuration, to enable or disable": "Configuración de Eventos Externos, para habilitar o deshabilitar la publicación de eventos",
"External Services": "Servicios externos",
+2
View File
@@ -388,6 +388,7 @@
"Expand All": "Développer tout",
"Export": "Exporter",
"Export CSV": "Exporter au format CSV",
"Export XLS": "Exporter au format XLS",
"Foreclosure": "Forclusion",
"GLIM Loan Application": "Demande de prêt GLIM",
"GSIM Application": "Demande GSIM",
@@ -2426,6 +2427,7 @@
"Entity Data Table Checks": "Vérifications du tableau de données d'entité",
"Entity Data Table Checks Organization": "Définir des contrôles de table de données d'entité pour l'organisation",
"Entity to Entity Mapping": "Mappage d’entité à entité",
"Export output data to S3 repository": "Exporter des données de sortie vers le référentiel S3",
"External Asset Owner": "Propriétaire de l'actif externe",
"External Events configuration, to enable or disable": "Configuration des événements externes, pour activer ou désactiver la publication des événements",
"External Services": "Services externes",
+2
View File
@@ -388,6 +388,7 @@
"Expand All": "Espandi tutto",
"Export": "Esportare",
"Export CSV": "Esporta CSV",
"Export XLS": "Esporta XLS",
"Foreclosure": "Pignoramento",
"GLIM Loan Application": "Richiesta di prestito GLIM",
"GSIM Application": "Applicazione GSMIM",
@@ -2426,6 +2427,7 @@
"Entity Data Table Checks": "Verifiche della tabella dei dati dell'entità",
"Entity Data Table Checks Organization": "Definire i controlli della tabella dei dati dell'entità per l'organizzazione",
"Entity to Entity Mapping": "Mappatura da entità a entità",
"Export output data to S3 repository": "Export Output Data in S3 Repository",
"External Asset Owner": "Proprietario della risorsa esterna",
"External Events configuration, to enable or disable": "Configurazione Eventi Esterni, per abilitare o disabilitare la pubblicazione degli eventi",
"External Services": "Servizi esterni",
+2
View File
@@ -388,6 +388,7 @@
"Expand All": "모두 확장",
"Export": "내보내다",
"Export CSV": "CSV 내보내기",
"Export XLS": "XLS 내보내기",
"Foreclosure": "유질",
"GLIM Loan Application": "GLIM 대출 신청",
"GSIM Application": "GSIM 애플리케이션",
@@ -2426,6 +2427,7 @@
"Entity Data Table Checks": "엔터티 데이터 테이블 확인",
"Entity Data Table Checks Organization": "조직에 대한 엔터티 데이터 테이블 검사 정의",
"Entity to Entity Mapping": "엔터티 간 매핑",
"Export output data to S3 repository": "출력 데이터를 S3 저장소로 내 보냅니다",
"External Asset Owner": "외부 자산 소유자",
"External Events configuration, to enable or disable": "이벤트 게시를 활성화 또는 비활성화하기 위한 외부 이벤트 구성",
"External Services": "외부 서비스",
+2
View File
@@ -388,6 +388,7 @@
"Expand All": "Išplėsti viską",
"Export": "Eksportuoti",
"Export CSV": "Eksportuoti CSV",
"Export XLS": "Eksportuoti XLS",
"Foreclosure": "Uždarymas",
"GLIM Loan Application": "GLIM paskolos paraiška",
"GSIM Application": "GSIM programa",
@@ -2426,6 +2427,7 @@
"Entity Data Table Checks": "Subjektų duomenų lentelės patikrinimai",
"Entity Data Table Checks Organization": "Apibrėžkite organizacijos objektų duomenų lentelės patikras",
"Entity to Entity Mapping": "Objekto atvaizdavimas",
"Export output data to S3 repository": "Eksportuoti išvesties duomenis į S3 saugyklą",
"External Asset Owner": "Išorinis turto savininkas",
"External Events configuration, to enable or disable": "Išorinių įvykių konfigūracija, norėdami įjungti arba išjungti įvykio publikavimą",
"External Services": "Išorės paslaugos",
+2
View File
@@ -388,6 +388,7 @@
"Expand All": "Paplašināt visu",
"Export": "Eksportēt",
"Export CSV": "Eksportēt CSV",
"Export XLS": "Eksportēt XLS",
"Foreclosure": "Preces ierobežošana",
"GLIM Loan Application": "GLIM aizdevuma pieteikums",
"GSIM Application": "GSIM lietojumprogramma",
@@ -2426,6 +2427,7 @@
"Entity Data Table Checks": "Entītijas datu tabulu pārbaudes",
"Entity Data Table Checks Organization": "Definējiet entītiju datu tabulu pārbaudes organizācijai",
"Entity to Entity Mapping": "Entītiju kartēšana",
"Export output data to S3 repository": "Eksporta izvades dati uz S3 repozitoriju",
"External Asset Owner": "Ārējais īpašuma īpašnieks",
"External Events configuration, to enable or disable": "Ārējo notikumu konfigurācija, lai iespējotu vai atspējotu notikuma publicēšanu",
"External Services": "Ārējie pakalpojumi",
+2
View File
@@ -388,6 +388,7 @@
"Expand All": "सबै विस्तार गर्नुहोस्",
"Export": "निर्यात गर्नुहोस्",
"Export CSV": "CSV निर्यात गर्नुहोस्",
"Export XLS": "XLS निर्यात गर्नुहोस्",
"Foreclosure": "फोरक्लोजर",
"GLIM Loan Application": "GLIM ऋण आवेदन",
"GSIM Application": "GSIM आवेदन",
@@ -2426,6 +2427,7 @@
"Entity Data Table Checks": "संस्था डेटा तालिका जाँच",
"Entity Data Table Checks Organization": "संगठनको लागि इकाई डेटा तालिका जाँचहरू परिभाषित गर्नुहोस्",
"Entity to Entity Mapping": "एकाई देखि इकाई म्यापिङ",
"Export output data to S3 repository": "S3 रिपोजिटरीमा आउटपुट डाटा निर्यात गर्नुहोस्",
"External Asset Owner": "बाह्य सम्पत्ति मालिक",
"External Events configuration, to enable or disable": "घटना प्रकाशन सक्षम वा असक्षम गर्न बाह्य घटना कन्फिगरेसन",
"External Services": "बाह्य सेवाहरू",
+2
View File
@@ -388,6 +388,7 @@
"Expand All": "Expandir todos",
"Export": "Exportar",
"Export CSV": "Exportar CSV",
"Export XLS": "Exportar XLS",
"Foreclosure": "Execução hipotecária",
"GLIM Loan Application": "Solicitação de empréstimo GLIM",
"GSIM Application": "Aplicação GSM",
@@ -2426,6 +2427,7 @@
"Entity Data Table Checks": "Verificações da tabela de dados da entidade",
"Entity Data Table Checks Organization": "Definir verificações da tabela de dados da entidade para a organização",
"Entity to Entity Mapping": "Mapeamento de entidade para entidade",
"Export output data to S3 repository": "Exportar dados de saída para o repositório S3",
"External Asset Owner": "Proprietário de ativo externo",
"External Events configuration, to enable or disable": "Configuração de Eventos Externos, para ativar ou desativar a publicação de eventos",
"External Services": "Serviços externos",
+2
View File
@@ -388,6 +388,7 @@
"Expand All": "Panua Yote",
"Export": "Hamisha",
"Export CSV": "Hamisha CSV",
"Export XLS": "Hamisha XLS",
"Foreclosure": "Foreclosure",
"GLIM Loan Application": "Maombi ya Mkopo wa GLIM",
"GSIM Application": "Maombi ya GSIM",
@@ -2426,6 +2427,7 @@
"Entity Data Table Checks": "Ukaguzi wa Jedwali la Data ya Huluki",
"Entity Data Table Checks Organization": "Bainisha Ukaguzi wa Jedwali la Data ya Huluki kwa Shirika",
"Entity to Entity Mapping": "Uchoraji wa Huluki kwa Huluki",
"Export output data to S3 repository": "Data ya pato la kuuza nje kwa hazina ya S3",
"External Asset Owner": "Mmiliki wa Mali ya Nje",
"External Events configuration, to enable or disable": "Usanidi wa Matukio ya Nje, ili kuwezesha au kuzima uchapishaji wa tukio",
"External Services": "Huduma za Nje",