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('EditTransactionComponent', () => {
|
||||
|
||||
beforeEach(async(() => {
|
||||
TestBed.configureTestingModule({
|
||||
declarations: [ EditTransactionComponent ]
|
||||
})
|
||||
.compileComponents();
|
||||
declarations: [EditTransactionComponent]
|
||||
}).compileComponents();
|
||||
}));
|
||||
|
||||
beforeEach(() => {
|
||||
|
||||
+29
-22
@@ -18,7 +18,6 @@ import { Currency } from 'app/shared/models/general.model';
|
||||
styleUrls: ['./edit-transaction.component.scss']
|
||||
})
|
||||
export class EditTransactionComponent implements OnInit {
|
||||
|
||||
/** Minimum Due Date allowed. */
|
||||
minDate = new Date(2000, 0, 1);
|
||||
/** Maximum Due Date allowed. */
|
||||
@@ -27,11 +26,11 @@ export class EditTransactionComponent implements OnInit {
|
||||
editTransactionForm: UntypedFormGroup;
|
||||
/** loans account transaction payment options. */
|
||||
paymentTypeOptions: {
|
||||
id: number,
|
||||
name: string,
|
||||
description: string,
|
||||
isCashPayment: boolean,
|
||||
position: number
|
||||
id: number;
|
||||
name: string;
|
||||
description: string;
|
||||
isCashPayment: boolean;
|
||||
position: number;
|
||||
}[];
|
||||
/** Flag to enable payment details fields. */
|
||||
showPaymentDetails: Boolean = false;
|
||||
@@ -50,12 +49,14 @@ export class EditTransactionComponent implements OnInit {
|
||||
* @param {Router} router Router for navigation.
|
||||
* @param {SettingsService} settingsService Settings Service
|
||||
*/
|
||||
constructor(private formBuilder: UntypedFormBuilder,
|
||||
private route: ActivatedRoute,
|
||||
private router: Router,
|
||||
private dateUtils: Dates,
|
||||
private loansService: LoansService,
|
||||
private settingsService: SettingsService) {
|
||||
constructor(
|
||||
private formBuilder: UntypedFormBuilder,
|
||||
private route: ActivatedRoute,
|
||||
private router: Router,
|
||||
private dateUtils: Dates,
|
||||
private loansService: LoansService,
|
||||
private settingsService: SettingsService
|
||||
) {
|
||||
this.route.data.subscribe((data: { loansAccountTransactionTemplate: any }) => {
|
||||
this.transactionTemplateData = data.loansAccountTransactionTemplate;
|
||||
if (data.loansAccountTransactionTemplate.currency) {
|
||||
@@ -73,10 +74,10 @@ export class EditTransactionComponent implements OnInit {
|
||||
this.maxDate = this.settingsService.businessDate;
|
||||
this.createEditTransactionForm();
|
||||
this.editTransactionForm.patchValue({
|
||||
'transactionDate': this.transactionTemplateData.date && new Date(this.transactionTemplateData.date),
|
||||
'transactionAmount': this.transactionTemplateData.amount,
|
||||
'externalId': this.transactionTemplateData.externalId,
|
||||
'paymentTypeId': this.transactionTemplateData.paymentTypeId
|
||||
transactionDate: this.transactionTemplateData.date && new Date(this.transactionTemplateData.date),
|
||||
transactionAmount: this.transactionTemplateData.amount,
|
||||
externalId: this.transactionTemplateData.externalId,
|
||||
paymentTypeId: this.transactionTemplateData.paymentTypeId
|
||||
});
|
||||
}
|
||||
|
||||
@@ -85,10 +86,16 @@ export class EditTransactionComponent implements OnInit {
|
||||
*/
|
||||
createEditTransactionForm() {
|
||||
this.editTransactionForm = this.formBuilder.group({
|
||||
'transactionDate': ['', Validators.required],
|
||||
'transactionAmount': ['', Validators.required],
|
||||
'externalId': [''],
|
||||
'paymentTypeId': [''],
|
||||
transactionDate: [
|
||||
'',
|
||||
Validators.required
|
||||
],
|
||||
transactionAmount: [
|
||||
'',
|
||||
Validators.required
|
||||
],
|
||||
externalId: [''],
|
||||
paymentTypeId: ['']
|
||||
});
|
||||
}
|
||||
|
||||
@@ -129,10 +136,10 @@ export class EditTransactionComponent implements OnInit {
|
||||
locale
|
||||
};
|
||||
data['transactionAmount'] = data['transactionAmount'] * 1;
|
||||
this.loansService.executeLoansAccountTransactionsCommand(this.loanAccountId, 'modify', data, this.transactionTemplateData.id)
|
||||
this.loansService
|
||||
.executeLoansAccountTransactionsCommand(this.loanAccountId, 'modify', data, this.transactionTemplateData.id)
|
||||
.subscribe((res: any) => {
|
||||
this.router.navigate(['../'], { relativeTo: this.route });
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
+2
-3
@@ -8,9 +8,8 @@ describe('ExportTransactionsComponent', () => {
|
||||
|
||||
beforeEach(async(() => {
|
||||
TestBed.configureTestingModule({
|
||||
declarations: [ ExportTransactionsComponent ]
|
||||
})
|
||||
.compileComponents();
|
||||
declarations: [ExportTransactionsComponent]
|
||||
}).compileComponents();
|
||||
}));
|
||||
|
||||
beforeEach(() => {
|
||||
|
||||
+24
-17
@@ -18,7 +18,6 @@ import { SettingsService } from 'app/settings/settings.service';
|
||||
styleUrls: ['./export-transactions.component.scss']
|
||||
})
|
||||
export class ExportTransactionsComponent implements OnInit {
|
||||
|
||||
/** Minimum date allowed. */
|
||||
minDate = new Date(2000, 0, 1);
|
||||
/** Maximum date allowed. */
|
||||
@@ -41,12 +40,14 @@ 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: { loanDetailsData: any }) => {
|
||||
this.loansAccountId = data.loanDetailsData.accountNo;
|
||||
});
|
||||
@@ -62,8 +63,14 @@ export class ExportTransactionsComponent implements OnInit {
|
||||
*/
|
||||
createTransactionsReportForm() {
|
||||
this.transactionsReportForm = this.formBuilder.group({
|
||||
'fromDate': ['', Validators.required],
|
||||
'toDate': [this.settingsService.businessDate, Validators.required],
|
||||
fromDate: [
|
||||
'',
|
||||
Validators.required
|
||||
],
|
||||
toDate: [
|
||||
this.settingsService.businessDate,
|
||||
Validators.required
|
||||
]
|
||||
});
|
||||
}
|
||||
|
||||
@@ -73,19 +80,19 @@ export class ExportTransactionsComponent implements OnInit {
|
||||
generate() {
|
||||
const dateFormat = this.settingsService.dateFormat;
|
||||
const data = {
|
||||
'output-type': 'PDF',
|
||||
R_startDate: this.dateUtils.formatDate(this.transactionsReportForm.value.fromDate, dateFormat),
|
||||
R_endDate: this.dateUtils.formatDate(this.transactionsReportForm.value.toDate, dateFormat),
|
||||
R_selectLoan: this.loansAccountId
|
||||
'output-type': 'PDF',
|
||||
R_startDate: this.dateUtils.formatDate(this.transactionsReportForm.value.fromDate, dateFormat),
|
||||
R_endDate: this.dateUtils.formatDate(this.transactionsReportForm.value.toDate, dateFormat),
|
||||
R_selectLoan: this.loansAccountId
|
||||
};
|
||||
this.reportsService.getPentahoRunReportData('Client Loan Account Schedule', data, 'default', 'en', dateFormat)
|
||||
.subscribe( (res: any) => {
|
||||
this.reportsService
|
||||
.getPentahoRunReportData('Client Loan Account Schedule', data, 'default', 'en', 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;
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -8,9 +8,8 @@ describe('ViewRecieptComponent', () => {
|
||||
|
||||
beforeEach(async(() => {
|
||||
TestBed.configureTestingModule({
|
||||
declarations: [ ViewRecieptComponent ]
|
||||
})
|
||||
.compileComponents();
|
||||
declarations: [ViewRecieptComponent]
|
||||
}).compileComponents();
|
||||
}));
|
||||
|
||||
beforeEach(() => {
|
||||
|
||||
@@ -12,7 +12,6 @@ import { ActivatedRoute } from '@angular/router';
|
||||
styleUrls: ['./view-reciept.component.scss']
|
||||
})
|
||||
export class ViewRecieptComponent implements OnInit {
|
||||
|
||||
/** trusted resource url for pentaho output */
|
||||
pentahoUrl: any;
|
||||
/** Transaction Reciept Data */
|
||||
@@ -23,8 +22,10 @@ export class ViewRecieptComponent implements OnInit {
|
||||
* @param {DomSanitizer} sanitizer DOM Sanitizer
|
||||
* @param {ActivatedRoute} route Activated Route
|
||||
*/
|
||||
constructor(private sanitizer: DomSanitizer,
|
||||
private route: ActivatedRoute) {
|
||||
constructor(
|
||||
private sanitizer: DomSanitizer,
|
||||
private route: ActivatedRoute
|
||||
) {
|
||||
this.route.data.subscribe((data: { loansTransactionReciept: any }) => {
|
||||
this.transactionRecieptData = data.loansTransactionReciept;
|
||||
});
|
||||
@@ -32,9 +33,8 @@ export class ViewRecieptComponent implements OnInit {
|
||||
|
||||
ngOnInit() {
|
||||
const contentType = this.transactionRecieptData.headers.get('Content-Type');
|
||||
const file = new Blob([this.transactionRecieptData.body], {type: contentType});
|
||||
const file = new Blob([this.transactionRecieptData.body], { type: contentType });
|
||||
const filecontent = URL.createObjectURL(file);
|
||||
this.pentahoUrl = this.sanitizer.bypassSecurityTrustResourceUrl(filecontent);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
+2
-3
@@ -8,9 +8,8 @@ describe('ViewTransactionComponent', () => {
|
||||
|
||||
beforeEach(async(() => {
|
||||
TestBed.configureTestingModule({
|
||||
declarations: [ ViewTransactionComponent ]
|
||||
})
|
||||
.compileComponents();
|
||||
declarations: [ViewTransactionComponent]
|
||||
}).compileComponents();
|
||||
}));
|
||||
|
||||
beforeEach(() => {
|
||||
|
||||
+60
-26
@@ -30,7 +30,6 @@ import { TranslateService } from '@ngx-translate/core';
|
||||
styleUrls: ['./view-transaction.component.scss']
|
||||
})
|
||||
export class ViewTransactionComponent implements OnInit {
|
||||
|
||||
/** Transaction data. */
|
||||
transactionData: any;
|
||||
transactionType: LoanTransactionType;
|
||||
@@ -45,7 +44,11 @@ export class ViewTransactionComponent implements OnInit {
|
||||
paymentTypeOptions: {}[] = [];
|
||||
transactionRelations = new MatTableDataSource();
|
||||
/** Columns to be displayed in Transaction Relations table. */
|
||||
displayedColumns: string[] = ['relationType', 'toTransaction', 'amount'];
|
||||
displayedColumns: string[] = [
|
||||
'relationType',
|
||||
'toTransaction',
|
||||
'amount'
|
||||
];
|
||||
isFullRelated = false;
|
||||
amountRelationsAllowed = 0;
|
||||
|
||||
@@ -62,7 +65,8 @@ export class ViewTransactionComponent implements OnInit {
|
||||
* @param {SettingsService} settingsService Settings Service
|
||||
* @param {AlertService} alertService Alert Service
|
||||
*/
|
||||
constructor(private loansService: LoansService,
|
||||
constructor(
|
||||
private loansService: LoansService,
|
||||
private route: ActivatedRoute,
|
||||
private dateUtils: Dates,
|
||||
private router: Router,
|
||||
@@ -70,17 +74,20 @@ export class ViewTransactionComponent implements OnInit {
|
||||
private translateService: TranslateService,
|
||||
private settingsService: SettingsService,
|
||||
private organizationService: OrganizationService,
|
||||
private alertService: AlertService) {
|
||||
private alertService: AlertService
|
||||
) {
|
||||
this.route.data.subscribe((data: { loansAccountTransaction: any }) => {
|
||||
this.transactionData = data.loansAccountTransaction;
|
||||
this.transactionType = this.transactionData.type;
|
||||
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.allowUndoTransaction(this.transactionData.manuallyReversed, this.transactionType);
|
||||
this.allowChargeback = this.allowChargebackTransaction(this.transactionType) && !this.transactionData.manuallyReversed;
|
||||
this.allowChargeback =
|
||||
this.allowChargebackTransaction(this.transactionType) && !this.transactionData.manuallyReversed;
|
||||
let transactionsChargebackRelated = false;
|
||||
if (this.transactionData.transactionRelations) {
|
||||
this.transactionRelations.data = this.transactionData.transactionRelations;
|
||||
this.existTransactionRelations = (this.transactionData.transactionRelations.length > 0);
|
||||
this.existTransactionRelations = this.transactionData.transactionRelations.length > 0;
|
||||
let amountRelations = 0;
|
||||
this.transactionData.transactionRelations.forEach((relation: any) => {
|
||||
if (relation.relationType === 'CHARGEBACK') {
|
||||
@@ -89,13 +96,17 @@ export class ViewTransactionComponent implements OnInit {
|
||||
}
|
||||
});
|
||||
this.amountRelationsAllowed = this.transactionData.amount - amountRelations;
|
||||
this.isFullRelated = (this.amountRelationsAllowed === 0);
|
||||
this.isFullRelated = this.amountRelationsAllowed === 0;
|
||||
this.allowChargeback = this.allowChargebackTransaction(this.transactionType) && !this.isFullRelated;
|
||||
}
|
||||
if (!this.allowChargeback) {
|
||||
this.allowEdition = false;
|
||||
}
|
||||
if ((this.existTransactionRelations && transactionsChargebackRelated) || this.transactionType.reAge || this.transactionType.reAmortize) {
|
||||
if (
|
||||
(this.existTransactionRelations && transactionsChargebackRelated) ||
|
||||
this.transactionType.reAge ||
|
||||
this.transactionType.reAmortize
|
||||
) {
|
||||
this.allowUndo = false;
|
||||
}
|
||||
});
|
||||
@@ -106,8 +117,10 @@ export class ViewTransactionComponent implements OnInit {
|
||||
|
||||
ngOnInit(): void {
|
||||
if (this.allowChargeback) {
|
||||
this.organizationService.getPaymentTypesWithCode().toPromise()
|
||||
.then(data => {
|
||||
this.organizationService
|
||||
.getPaymentTypesWithCode()
|
||||
.toPromise()
|
||||
.then((data) => {
|
||||
this.paymentTypeOptions = data;
|
||||
});
|
||||
}
|
||||
@@ -117,15 +130,24 @@ export class ViewTransactionComponent implements OnInit {
|
||||
* Allow edit, undo and chargeback actions
|
||||
*/
|
||||
allowTransactionEdition(transactionType: number): boolean {
|
||||
return (transactionType === 20
|
||||
|| transactionType === 21 || transactionType === 22
|
||||
|| transactionType === 23 || transactionType === 28);
|
||||
return (
|
||||
transactionType === 20 ||
|
||||
transactionType === 21 ||
|
||||
transactionType === 22 ||
|
||||
transactionType === 23 ||
|
||||
transactionType === 28
|
||||
);
|
||||
}
|
||||
|
||||
allowChargebackTransaction(transactionType: LoanTransactionType): boolean {
|
||||
return (transactionType.repayment || transactionType.interestPaymentWaiver
|
||||
|| transactionType.goodwillCredit || transactionType.payoutRefund
|
||||
|| transactionType.merchantIssuedRefund || transactionType.downPayment);
|
||||
return (
|
||||
transactionType.repayment ||
|
||||
transactionType.interestPaymentWaiver ||
|
||||
transactionType.goodwillCredit ||
|
||||
transactionType.payoutRefund ||
|
||||
transactionType.merchantIssuedRefund ||
|
||||
transactionType.downPayment
|
||||
);
|
||||
}
|
||||
|
||||
allowUndoTransaction(manuallyReversed: boolean, transactionType: LoanTransactionType): boolean {
|
||||
@@ -144,21 +166,31 @@ export class ViewTransactionComponent implements OnInit {
|
||||
undoTransaction() {
|
||||
const accountId = this.route.snapshot.params['loanId'];
|
||||
const undoTransactionAccountDialogRef = this.dialog.open(ConfirmationDialogComponent, {
|
||||
data: { heading: this.translateService.instant('labels.heading.Undo Transaction'), dialogContext: this.translateService.instant('labels.dialogContext.Are you sure you want undo the transaction') + `${this.transactionData.id}` }
|
||||
data: {
|
||||
heading: this.translateService.instant('labels.heading.Undo Transaction'),
|
||||
dialogContext:
|
||||
this.translateService.instant('labels.dialogContext.Are you sure you want undo the transaction') +
|
||||
`${this.transactionData.id}`
|
||||
}
|
||||
});
|
||||
undoTransactionAccountDialogRef.afterClosed().subscribe((response: { confirm: any }) => {
|
||||
if (response.confirm) {
|
||||
const locale = this.settingsService.language.code;
|
||||
const dateFormat = this.settingsService.dateFormat;
|
||||
const data = {
|
||||
transactionDate: this.dateUtils.formatDate(this.transactionData.date && new Date(this.transactionData.date), dateFormat),
|
||||
transactionDate: this.dateUtils.formatDate(
|
||||
this.transactionData.date && new Date(this.transactionData.date),
|
||||
dateFormat
|
||||
),
|
||||
transactionAmount: 0,
|
||||
dateFormat,
|
||||
locale
|
||||
};
|
||||
this.loansService.executeLoansAccountTransactionsCommand(accountId, 'undo', data, this.transactionData.id).subscribe(() => {
|
||||
this.router.navigate(['../'], { relativeTo: this.route });
|
||||
});
|
||||
this.loansService
|
||||
.executeLoansAccountTransactionsCommand(accountId, 'undo', data, this.transactionData.id)
|
||||
.subscribe(() => {
|
||||
this.router.navigate(['../'], { relativeTo: this.route });
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
@@ -183,6 +215,7 @@ export class ViewTransactionComponent implements OnInit {
|
||||
max: this.amountRelationsAllowed,
|
||||
order: 2
|
||||
})
|
||||
|
||||
];
|
||||
const data = {
|
||||
title: `Chargeback ${this.transactionType.value} Transaction`,
|
||||
@@ -199,9 +232,11 @@ export class ViewTransactionComponent implements OnInit {
|
||||
paymentTypeId: response.data.value.paymentTypeId,
|
||||
locale
|
||||
};
|
||||
this.loansService.executeLoansAccountTransactionsCommand(accountId, 'chargeback', payload, this.transactionData.id).subscribe(() => {
|
||||
this.router.navigate(['../'], { relativeTo: this.route });
|
||||
});
|
||||
this.loansService
|
||||
.executeLoansAccountTransactionsCommand(accountId, 'chargeback', payload, this.transactionData.id)
|
||||
.subscribe(() => {
|
||||
this.router.navigate(['../'], { relativeTo: this.route });
|
||||
});
|
||||
} else {
|
||||
this.alertService.alert({
|
||||
type: 'BusinessRule',
|
||||
@@ -225,5 +260,4 @@ export class ViewTransactionComponent implements OnInit {
|
||||
}
|
||||
return 'active';
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user