build: Use prettier for typescript
Stop ignoring .ts files in prettier and fix existing issues.
This commit is contained in:
+2
-3
@@ -8,9 +8,8 @@ describe('ExportTransactionsComponent', () => {
|
||||
|
||||
beforeEach(async(() => {
|
||||
TestBed.configureTestingModule({
|
||||
declarations: [ ExportTransactionsComponent ]
|
||||
})
|
||||
.compileComponents();
|
||||
declarations: [ExportTransactionsComponent]
|
||||
}).compileComponents();
|
||||
}));
|
||||
|
||||
beforeEach(() => {
|
||||
|
||||
+33
-18
@@ -18,7 +18,6 @@ import { Dates } from 'app/core/utils/dates';
|
||||
styleUrls: ['./export-transactions.component.scss']
|
||||
})
|
||||
export class ExportTransactionsComponent implements OnInit {
|
||||
|
||||
/** Minimum date allowed. */
|
||||
minDate = new Date(2000, 0, 1);
|
||||
/** Maximum date allowed. */
|
||||
@@ -41,18 +40,19 @@ export class ExportTransactionsComponent implements OnInit {
|
||||
* @param {ActivatedRoute} route Activated Route
|
||||
* @param {SettingsService} settingsService Settings Service
|
||||
*/
|
||||
constructor(private sanitizer: DomSanitizer,
|
||||
private reportsService: ReportsService,
|
||||
private formBuilder: UntypedFormBuilder,
|
||||
private dateUtils: Dates,
|
||||
private route: ActivatedRoute,
|
||||
private settingsService: SettingsService) {
|
||||
constructor(
|
||||
private sanitizer: DomSanitizer,
|
||||
private reportsService: ReportsService,
|
||||
private formBuilder: UntypedFormBuilder,
|
||||
private dateUtils: Dates,
|
||||
private route: ActivatedRoute,
|
||||
private settingsService: SettingsService
|
||||
) {
|
||||
this.route.parent.parent.data.subscribe((data: { savingsAccountData: any }) => {
|
||||
this.savingsAccountId = data.savingsAccountData.accountNo;
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
ngOnInit() {
|
||||
this.maxDate = this.settingsService.businessDate;
|
||||
this.createTransactionsReportForm();
|
||||
@@ -63,8 +63,14 @@ export class ExportTransactionsComponent implements OnInit {
|
||||
*/
|
||||
createTransactionsReportForm() {
|
||||
this.transactionsReportForm = this.formBuilder.group({
|
||||
'fromDate': ['', Validators.required],
|
||||
'toDate': ['', Validators.required],
|
||||
fromDate: [
|
||||
'',
|
||||
Validators.required
|
||||
],
|
||||
toDate: [
|
||||
'',
|
||||
Validators.required
|
||||
]
|
||||
});
|
||||
}
|
||||
|
||||
@@ -73,19 +79,28 @@ export class ExportTransactionsComponent implements OnInit {
|
||||
*/
|
||||
generate() {
|
||||
const data = {
|
||||
'output-type': 'PDF',
|
||||
R_startDate: this.dateUtils.formatDate(this.transactionsReportForm.value.fromDate, this.settingsService.dateFormat),
|
||||
R_endDate: this.dateUtils.formatDate(this.transactionsReportForm.value.toDate, this.settingsService.dateFormat),
|
||||
R_savingsAccountId: this.savingsAccountId
|
||||
'output-type': 'PDF',
|
||||
R_startDate: this.dateUtils.formatDate(
|
||||
this.transactionsReportForm.value.fromDate,
|
||||
this.settingsService.dateFormat
|
||||
),
|
||||
R_endDate: this.dateUtils.formatDate(this.transactionsReportForm.value.toDate, this.settingsService.dateFormat),
|
||||
R_savingsAccountId: this.savingsAccountId
|
||||
};
|
||||
this.reportsService.getPentahoRunReportData('Client Saving Transactions', data, 'default', this.settingsService.language.code, this.settingsService.dateFormat)
|
||||
.subscribe( (res: any) => {
|
||||
this.reportsService
|
||||
.getPentahoRunReportData(
|
||||
'Client Saving Transactions',
|
||||
data,
|
||||
'default',
|
||||
this.settingsService.language.code,
|
||||
this.settingsService.dateFormat
|
||||
)
|
||||
.subscribe((res: any) => {
|
||||
const contentType = res.headers.get('Content-Type');
|
||||
const file = new Blob([res.body], {type: contentType});
|
||||
const file = new Blob([res.body], { type: contentType });
|
||||
const filecontent = URL.createObjectURL(file);
|
||||
this.pentahoUrl = this.sanitizer.bypassSecurityTrustResourceUrl(filecontent);
|
||||
this.hideOutput = false;
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
+2
-3
@@ -8,9 +8,8 @@ describe('TransactionsTabComponent', () => {
|
||||
|
||||
beforeEach(async(() => {
|
||||
TestBed.configureTestingModule({
|
||||
declarations: [ TransactionsTabComponent ]
|
||||
})
|
||||
.compileComponents();
|
||||
declarations: [TransactionsTabComponent]
|
||||
}).compileComponents();
|
||||
}));
|
||||
|
||||
beforeEach(() => {
|
||||
|
||||
+57
-22
@@ -6,7 +6,10 @@ import { MatSort } from '@angular/material/sort';
|
||||
import { MatTableDataSource } from '@angular/material/table';
|
||||
import { ActivatedRoute, Router } from '@angular/router';
|
||||
import { Dates } from 'app/core/utils/dates';
|
||||
import { SavingsAccountTransaction, SavingsAccountTransactionType } from 'app/savings/models/savings-account-transaction.model';
|
||||
import {
|
||||
SavingsAccountTransaction,
|
||||
SavingsAccountTransactionType
|
||||
} from 'app/savings/models/savings-account-transaction.model';
|
||||
import { SavingsService } from 'app/savings/savings.service';
|
||||
import { SettingsService } from 'app/settings/settings.service';
|
||||
import { UndoTransactionDialogComponent } from '../custom-dialogs/undo-transaction-dialog/undo-transaction-dialog.component';
|
||||
@@ -21,7 +24,6 @@ import { MatDialog } from '@angular/material/dialog';
|
||||
styleUrls: ['./transactions-tab.component.scss']
|
||||
})
|
||||
export class TransactionsTabComponent implements OnInit {
|
||||
|
||||
/** Savings Account Status */
|
||||
status: any;
|
||||
/** Transactions Data */
|
||||
@@ -30,7 +32,17 @@ export class TransactionsTabComponent implements OnInit {
|
||||
hideAccrualsParam: UntypedFormControl;
|
||||
hideReversedParam: UntypedFormControl;
|
||||
/** Columns to be displayed in transactions table. */
|
||||
displayedColumns: string[] = ['row', 'id', 'date', 'externalId', 'transactionType', 'debit', 'credit', 'balance', 'actions'];
|
||||
displayedColumns: string[] = [
|
||||
'row',
|
||||
'id',
|
||||
'date',
|
||||
'externalId',
|
||||
'transactionType',
|
||||
'debit',
|
||||
'credit',
|
||||
'balance',
|
||||
'actions'
|
||||
];
|
||||
/** Data source for transactions table. */
|
||||
dataSource: MatTableDataSource<any>;
|
||||
@ViewChild(MatPaginator, { static: true }) paginator: MatPaginator;
|
||||
@@ -44,12 +56,14 @@ export class TransactionsTabComponent implements OnInit {
|
||||
* Retrieves savings account data from `resolve`.
|
||||
* @param {ActivatedRoute} route Activated Route.
|
||||
*/
|
||||
constructor(private route: ActivatedRoute,
|
||||
private router: Router,
|
||||
private savingsService: SavingsService,
|
||||
private settingsService: SettingsService,
|
||||
private dialog: MatDialog,
|
||||
private dateUtils: Dates) {
|
||||
constructor(
|
||||
private route: ActivatedRoute,
|
||||
private router: Router,
|
||||
private savingsService: SavingsService,
|
||||
private settingsService: SettingsService,
|
||||
private dialog: MatDialog,
|
||||
private dateUtils: Dates
|
||||
) {
|
||||
this.route.parent.parent.data.subscribe((data: { savingsAccountData: any }) => {
|
||||
this.transactionsData = data.savingsAccountData.transactions;
|
||||
this.status = data.savingsAccountData.status.value;
|
||||
@@ -65,7 +79,7 @@ export class TransactionsTabComponent implements OnInit {
|
||||
|
||||
setTransactions(): void {
|
||||
this.dataSource = new MatTableDataSource(this.transactionsData);
|
||||
this.accountWithTransactions = (this.transactionsData && this.transactionsData.length > 0);
|
||||
this.accountWithTransactions = this.transactionsData && this.transactionsData.length > 0;
|
||||
this.dataSource.paginator = this.paginator;
|
||||
this.dataSource.sort = this.sort;
|
||||
}
|
||||
@@ -75,20 +89,30 @@ export class TransactionsTabComponent implements OnInit {
|
||||
* @param {any} transactionType Transaction Type
|
||||
*/
|
||||
isDebit(transactionType: SavingsAccountTransactionType) {
|
||||
return transactionType.withdrawal === true || transactionType.feeDeduction === true
|
||||
|| transactionType.overdraftInterest === true || transactionType.withholdTax === true;
|
||||
return (
|
||||
transactionType.withdrawal === true ||
|
||||
transactionType.feeDeduction === true ||
|
||||
transactionType.overdraftInterest === true ||
|
||||
transactionType.withholdTax === true
|
||||
);
|
||||
}
|
||||
|
||||
isAccrual(transactionType: SavingsAccountTransactionType): boolean {
|
||||
return (transactionType.accrual || transactionType.code === 'savingsAccountTransactionType.accrual');
|
||||
return transactionType.accrual || transactionType.code === 'savingsAccountTransactionType.accrual';
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks transaction status.
|
||||
*/
|
||||
checkStatus() {
|
||||
if (this.status === 'Active' || this.status === 'Closed' || this.status === 'Transfer in progress' ||
|
||||
this.status === 'Transfer on hold' || this.status === 'Premature Closed' || this.status === 'Matured') {
|
||||
if (
|
||||
this.status === 'Active' ||
|
||||
this.status === 'Closed' ||
|
||||
this.status === 'Transfer in progress' ||
|
||||
this.status === 'Transfer on hold' ||
|
||||
this.status === 'Premature Closed' ||
|
||||
this.status === 'Matured'
|
||||
) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
@@ -100,9 +124,17 @@ export class TransactionsTabComponent implements OnInit {
|
||||
*/
|
||||
showTransactions(transactionsData: SavingsAccountTransaction) {
|
||||
if (transactionsData.transfer) {
|
||||
this.router.navigate([`../transfer-funds/account-transfers/${transactionsData.transfer.id}`], { relativeTo: this.route });
|
||||
this.router.navigate([`../transfer-funds/account-transfers/${transactionsData.transfer.id}`], {
|
||||
relativeTo: this.route
|
||||
});
|
||||
} else {
|
||||
this.router.navigate([transactionsData.id, 'general'], { relativeTo: this.route });
|
||||
this.router.navigate(
|
||||
[
|
||||
transactionsData.id,
|
||||
'general'
|
||||
],
|
||||
{ relativeTo: this.route }
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -127,7 +159,7 @@ export class TransactionsTabComponent implements OnInit {
|
||||
|
||||
if (hideAccrual || hideReversed) {
|
||||
transactions = this.transactionsData.filter((t: SavingsAccountTransaction) => {
|
||||
return (!(hideReversed && t.reversed) && !(hideAccrual && t.transactionType.accrual));
|
||||
return !(hideReversed && t.reversed) && !(hideAccrual && t.transactionType.accrual);
|
||||
});
|
||||
}
|
||||
this.dataSource = new MatTableDataSource(transactions);
|
||||
@@ -159,9 +191,11 @@ export class TransactionsTabComponent implements OnInit {
|
||||
dateFormat,
|
||||
locale
|
||||
};
|
||||
this.savingsService.executeSavingsAccountTransactionsCommand(this.accountId, 'undo', data, transactionData.id).subscribe(() => {
|
||||
this.reload();
|
||||
});
|
||||
this.savingsService
|
||||
.executeSavingsAccountTransactionsCommand(this.accountId, 'undo', data, transactionData.id)
|
||||
.subscribe(() => {
|
||||
this.reload();
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
@@ -169,7 +203,8 @@ export class TransactionsTabComponent implements OnInit {
|
||||
private reload() {
|
||||
const clientId = this.route.parent.parent.snapshot.params['clientId'];
|
||||
const url: string = this.router.url;
|
||||
this.router.navigateByUrl(`/clients/${clientId}/savings-accounts`, { skipLocationChange: true })
|
||||
this.router
|
||||
.navigateByUrl(`/clients/${clientId}/savings-accounts`, { skipLocationChange: true })
|
||||
.then(() => this.router.navigate([url]));
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user