Message in run report when It is being exported to S3 (#1788)

Co-authored-by: Jose Alberto Hernandez <alberto@blue-daemon.local>
This commit is contained in:
José Alberto Hernández
2023-07-19 08:58:08 -06:00
committed by GitHub
co-authored by Jose Alberto Hernandez
parent 2aef60ce93
commit dd4b37c060
5 changed files with 132 additions and 87 deletions
@@ -1,4 +1,6 @@
<div class="container" fxLayout="row" fxLayoutGap="3%"> <mat-card class="container">
<mat-card-content fxLayout="row" >
<mat-card fxFlex class="client-card" fxLayout="column" fxLayoutGap="2%"> <mat-card fxFlex class="client-card" fxLayout="column" fxLayoutGap="2%">
@@ -44,7 +46,8 @@
<div mat-list-item *ngFor="let client of clientMembers index as i"> <div mat-list-item *ngFor="let client of clientMembers index as i">
<span matLine class="p-t-10">{{client.displayName}}</span> <span matLine class="p-t-10">{{client.displayName}}</span>
<div fxFlex></div> <div fxFlex></div>
<button mat-icon-button color="warn" (click)="removeClient(i, client)" matTooltip="Remove Client from Group" matTooltipPosition="left"> <button mat-icon-button color="warn" (click)="removeClient(i, client)" matTooltip="Remove Client from Group"
matTooltipPosition="left">
<fa-icon icon="trash"></fa-icon> <fa-icon icon="trash"></fa-icon>
</button> </button>
</div> </div>
@@ -52,8 +55,12 @@
</mat-card> </mat-card>
<div fxLayout="row" fxLayout.xs="column" fxLayoutAlign="center" fxLayoutGap="5px"> </mat-card-content>
<button type="button" mat-raised-button [routerLink]="['../']">Back</button>
</div>
<mat-card-actions>
<div fxLayout="row" fxLayoutAlign="center" fxLayoutGap="2%" fxLayout.lt-md="column">
<button type="button" mat-raised-button color="primary" [routerLink]="['../..']">{{ 'Back' | translate }}</button>
</div> </div>
</mat-card-actions>
</mat-card>
@@ -15,6 +15,7 @@ import { SelectBase } from 'app/shared/form-dialog/formfield/model/select-base';
import { FormDialogComponent } from 'app/shared/form-dialog/form-dialog.component'; import { FormDialogComponent } from 'app/shared/form-dialog/form-dialog.component';
import { MatTableDataSource } from '@angular/material/table'; import { MatTableDataSource } from '@angular/material/table';
import { LoanTransactionType } from 'app/loans/models/loan-transaction-type.model'; import { LoanTransactionType } from 'app/loans/models/loan-transaction-type.model';
import { AlertService } from 'app/core/alert/alert.service';
/** Custom Dialogs */ /** Custom Dialogs */
@@ -57,6 +58,7 @@ export class ViewTransactionComponent implements OnInit {
* @param {MatDialog} dialog Dialog reference. * @param {MatDialog} dialog Dialog reference.
* @param {Dates} dateUtils Date Utils. * @param {Dates} dateUtils Date Utils.
* @param {SettingsService} settingsService Settings Service * @param {SettingsService} settingsService Settings Service
* @param {AlertService} alertService Alert Service
*/ */
constructor(private loansService: LoansService, constructor(private loansService: LoansService,
private route: ActivatedRoute, private route: ActivatedRoute,
@@ -64,12 +66,12 @@ export class ViewTransactionComponent implements OnInit {
private router: Router, private router: Router,
public dialog: MatDialog, public dialog: MatDialog,
private settingsService: SettingsService, private settingsService: SettingsService,
private organizationService: OrganizationService) { private organizationService: OrganizationService,
private alertService: AlertService) {
this.route.data.subscribe((data: { loansAccountTransaction: any }) => { this.route.data.subscribe((data: { loansAccountTransaction: any }) => {
this.transactionData = data.loansAccountTransaction; this.transactionData = data.loansAccountTransaction;
this.allowEdition = !this.transactionData.manuallyReversed && !this.allowTransactionEdition(this.transactionData.type.id); this.allowEdition = !this.transactionData.manuallyReversed && !this.allowTransactionEdition(this.transactionData.type.id);
this.allowUndo = !this.transactionData.manuallyReversed; this.allowUndo = !this.transactionData.manuallyReversed;
console.log(this.transactionData.type);
this.allowChargeback = this.allowChargebackTransaction(this.transactionData.type) && !this.transactionData.manuallyReversed; this.allowChargeback = this.allowChargebackTransaction(this.transactionData.type) && !this.transactionData.manuallyReversed;
let transactionsChargebackRelated = false; let transactionsChargebackRelated = false;
if (this.allowChargeback) { if (this.allowChargeback) {
@@ -187,6 +189,9 @@ export class ViewTransactionComponent implements OnInit {
this.loansService.executeLoansAccountTransactionsCommand(accountId, 'chargeback', payload, this.transactionData.id).subscribe(() => { this.loansService.executeLoansAccountTransactionsCommand(accountId, 'chargeback', payload, this.transactionData.id).subscribe(() => {
this.router.navigate(['../'], { relativeTo: this.route }); this.router.navigate(['../'], { relativeTo: this.route });
}); });
} else {
this.alertService.alert({ type: 'BusinessRule',
message: 'Chargeback amount must be lower or equal to: ' + this.amountRelationsAllowed });
} }
} }
}); });
@@ -1,7 +1,10 @@
<div *ngIf = "!hideOutput"> <div class="container">
<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'" fxLayoutAlign="end">
<button mat-raised-button color="primary" (click)="downloadCSV()" [disabled]="notExistsReportData"> <button mat-raised-button color="primary" (click)="downloadCSV()" [disabled]="notExistsReportData"
matToolTip="Export the data to CSV file">
Export CSV Export CSV
</button> </button>
</div> </div>
@@ -30,3 +33,21 @@
</div> </div>
</div> </div>
</div> </div>
<div class="alert" *ngIf="!hideOutput && toBeExportedToRepo">
<div class="message">
<i class="fa fa-exclamation-circle alert-check"></i>
The report request has been sent and the report will be exported to file repository
</div>
</div>
<div class="table-output" *ngIf="hideOutput">
<mat-progress-bar mode="indeterminate"></mat-progress-bar>
</div>
<div class="back-button" *ngIf="!hideOutput">
<button type="button" color="primary" mat-raised-button [routerLink]="['../..']">
<fa-icon icon="arrow-left" class="m-r-10"></fa-icon>Back</button>
</div>
</div>
@@ -11,3 +11,10 @@
margin-left: 5px; margin-left: 5px;
margin-right: 5px; margin-right: 5px;
} }
.back-button {
text-align: center;
margin-top: 25px;
max-height: 2%;
margin-bottom: 2%;
}
@@ -31,6 +31,7 @@ export class TableAndSmsComponent implements OnChanges {
/** Data to be converted into CSV file */ /** Data to be converted into CSV file */
csvData: any; csvData: any;
notExistsReportData = false; notExistsReportData = false;
toBeExportedToRepo = false;
/** Paginator for run-report table. */ /** Paginator for run-report table. */
@ViewChild(MatPaginator) paginator: MatPaginator; @ViewChild(MatPaginator) paginator: MatPaginator;
@@ -53,8 +54,11 @@ export class TableAndSmsComponent implements OnChanges {
} }
getRunReportData() { getRunReportData() {
const exportS3 = this.dataObject.formData.exportS3;
this.reportsService.getRunReportData(this.dataObject.report.name, this.dataObject.formData) this.reportsService.getRunReportData(this.dataObject.report.name, this.dataObject.formData)
.subscribe( (res: any) => { .subscribe( (res: any) => {
this.toBeExportedToRepo = exportS3;
if (!this.toBeExportedToRepo) {
this.csvData = res.data; this.csvData = res.data;
this.notExistsReportData = (res.data.length === 0); this.notExistsReportData = (res.data.length === 0);
this.setOutputTable(res.data); this.setOutputTable(res.data);
@@ -62,6 +66,7 @@ export class TableAndSmsComponent implements OnChanges {
this.columnTypes.push(header.columnDisplayType); this.columnTypes.push(header.columnDisplayType);
this.displayedColumns.push(header.columnName); this.displayedColumns.push(header.columnName);
}); });
}
this.hideOutput = false; this.hideOutput = false;
}); });
} }