build: Use prettier for typescript

Stop ignoring .ts files in prettier and fix existing issues.
This commit is contained in:
Ralph Hopman
2025-01-15 11:59:30 +00:00
committed by Adam Saghy
parent 9d6cf1514a
commit cac1d11ad7
1812 changed files with 22516 additions and 16862 deletions
@@ -8,9 +8,8 @@ describe('ActivateRecurringDepositsAccountComponent', () => {
beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [ ActivateRecurringDepositsAccountComponent ]
})
.compileComponents();
declarations: [ActivateRecurringDepositsAccountComponent]
}).compileComponents();
}));
beforeEach(() => {
@@ -17,7 +17,6 @@ import { Dates } from 'app/core/utils/dates';
styleUrls: ['./activate-recurring-deposits-account.component.scss']
})
export class ActivateRecurringDepositsAccountComponent implements OnInit {
/** Minimum date allowed. */
minDate = new Date(2000, 0, 1);
/** Maximum date allowed. */
@@ -35,12 +34,14 @@ export class ActivateRecurringDepositsAccountComponent implements OnInit {
* @param {Router} router Router
* @param {SavingsService} savingsService Savings Service
*/
constructor(private formBuilder: UntypedFormBuilder,
constructor(
private formBuilder: UntypedFormBuilder,
private recurringDepositsService: RecurringDepositsService,
private dateUtils: Dates,
private route: ActivatedRoute,
private router: Router,
private settingsService: SettingsService) {
private settingsService: SettingsService
) {
this.accountId = this.route.parent.snapshot.params['recurringDepositAccountId'];
}
@@ -57,7 +58,10 @@ export class ActivateRecurringDepositsAccountComponent implements OnInit {
*/
createActivateRecurringDepositsAccountForm() {
this.activateRecurringDepositsAccountForm = this.formBuilder.group({
'activatedOnDate': ['', Validators.required]
activatedOnDate: [
'',
Validators.required
]
});
}
@@ -71,15 +75,20 @@ export class ActivateRecurringDepositsAccountComponent implements OnInit {
const dateFormat = this.settingsService.dateFormat;
const prevActivatedOnDate: Date = this.activateRecurringDepositsAccountForm.value.activatedOnDate;
if (activateRecurringDepositsAccountFormData.activatedOnDate instanceof Date) {
activateRecurringDepositsAccountFormData.activatedOnDate = this.dateUtils.formatDate(prevActivatedOnDate, dateFormat);
activateRecurringDepositsAccountFormData.activatedOnDate = this.dateUtils.formatDate(
prevActivatedOnDate,
dateFormat
);
}
const data = {
...activateRecurringDepositsAccountFormData,
dateFormat,
locale
};
this.recurringDepositsService.executeRecurringDepositsAccountCommand(this.accountId, 'activate', data).subscribe(() => {
this.router.navigate(['../../'], { relativeTo: this.route });
});
this.recurringDepositsService
.executeRecurringDepositsAccountCommand(this.accountId, 'activate', data)
.subscribe(() => {
this.router.navigate(['../../'], { relativeTo: this.route });
});
}
}
@@ -8,9 +8,8 @@ describe('AddChargeRecurringDepositsAccountComponent', () => {
beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [ AddChargeRecurringDepositsAccountComponent ]
})
.compileComponents();
declarations: [AddChargeRecurringDepositsAccountComponent]
}).compileComponents();
}));
beforeEach(() => {
@@ -18,7 +18,6 @@ import { SettingsService } from 'app/settings/settings.service';
styleUrls: ['./add-charge-recurring-deposits-account.component.scss']
})
export class AddChargeRecurringDepositsAccountComponent implements OnInit {
/** Minimum Due Date allowed. */
minDate = new Date(2000, 0, 1);
/** Maximum Due Date allowed. */
@@ -64,7 +63,7 @@ export class AddChargeRecurringDepositsAccountComponent implements OnInit {
}
buildDependencies() {
this.recurringDepositsChargeForm.controls.chargeId.valueChanges.subscribe(chargeId => {
this.recurringDepositsChargeForm.controls.chargeId.valueChanges.subscribe((chargeId) => {
this.savingsService.getChargeTemplate(chargeId).subscribe((data: any) => {
this.chargeDetails = data;
const chargeTimeType = data.chargeTimeType.id;
@@ -85,14 +84,17 @@ export class AddChargeRecurringDepositsAccountComponent implements OnInit {
this.recurringDepositsChargeForm.removeControl('feeOnMonthDay');
}
if (chargeTimeType.value === 'Monthly Fee') {
this.recurringDepositsChargeForm.addControl('feeInterval', new UntypedFormControl(data.feeInterval, Validators.required));
this.recurringDepositsChargeForm.addControl(
'feeInterval',
new UntypedFormControl(data.feeInterval, Validators.required)
);
} else {
this.recurringDepositsChargeForm.removeControl('feeInterval');
}
this.recurringDepositsChargeForm.patchValue({
'amount': data.amount,
'chargeCalculationType': data.chargeCalculationType.id,
'chargeTimeType': data.chargeTimeType.id
amount: data.amount,
chargeCalculationType: data.chargeCalculationType.id,
chargeTimeType: data.chargeTimeType.id
});
});
});
@@ -103,10 +105,16 @@ export class AddChargeRecurringDepositsAccountComponent implements OnInit {
*/
createRecurringDepositsChargeForm() {
this.recurringDepositsChargeForm = this.formBuilder.group({
'chargeId': ['', Validators.required],
'amount': ['', Validators.required],
'chargeCalculationType': [{ value: '', disabled: true }],
'chargeTimeType': [{ value: '', disabled: true }]
chargeId: [
'',
Validators.required
],
amount: [
'',
Validators.required
],
chargeCalculationType: [{ value: '', disabled: true }],
chargeTimeType: [{ value: '', disabled: true }]
});
}
@@ -140,5 +148,4 @@ export class AddChargeRecurringDepositsAccountComponent implements OnInit {
this.router.navigate(['../../'], { relativeTo: this.route });
});
}
}
@@ -8,9 +8,8 @@ describe('ApproveRecurringDepositsAccountComponent', () => {
beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [ ApproveRecurringDepositsAccountComponent ]
})
.compileComponents();
declarations: [ApproveRecurringDepositsAccountComponent]
}).compileComponents();
}));
beforeEach(() => {
@@ -17,7 +17,6 @@ import { Dates } from 'app/core/utils/dates';
styleUrls: ['./approve-recurring-deposits-account.component.scss']
})
export class ApproveRecurringDepositsAccountComponent implements OnInit {
/** Minimum date allowed. */
minDate = new Date(2000, 0, 1);
/** Maximum date allowed. */
@@ -35,12 +34,14 @@ export class ApproveRecurringDepositsAccountComponent implements OnInit {
* @param {Router} router Router
* @param {SettingsService} settingsService Settings Service
*/
constructor(private formBuilder: UntypedFormBuilder,
constructor(
private formBuilder: UntypedFormBuilder,
private recurringDepositsService: RecurringDepositsService,
private dateUtils: Dates,
private route: ActivatedRoute,
private router: Router,
private settingsService: SettingsService) {
private settingsService: SettingsService
) {
this.accountId = this.route.parent.snapshot.params['recurringDepositAccountId'];
}
@@ -57,8 +58,11 @@ export class ApproveRecurringDepositsAccountComponent implements OnInit {
*/
createApproveRecurringDepositsAccountForm() {
this.approveRecurringDepositsAccountForm = this.formBuilder.group({
'approvedOnDate': ['', Validators.required],
'note': ['']
approvedOnDate: [
'',
Validators.required
],
note: ['']
});
}
@@ -72,16 +76,20 @@ export class ApproveRecurringDepositsAccountComponent implements OnInit {
const dateFormat = this.settingsService.dateFormat;
const prevApprovedOnDate: Date = this.approveRecurringDepositsAccountForm.value.approvedOnDate;
if (approveRecurringDepositsAccountFormData.approvedOnDate instanceof Date) {
approveRecurringDepositsAccountFormData.approvedOnDate = this.dateUtils.formatDate(prevApprovedOnDate, dateFormat);
approveRecurringDepositsAccountFormData.approvedOnDate = this.dateUtils.formatDate(
prevApprovedOnDate,
dateFormat
);
}
const data = {
...approveRecurringDepositsAccountFormData,
dateFormat,
locale
};
this.recurringDepositsService.executeRecurringDepositsAccountCommand(this.accountId, 'approve', data).subscribe(() => {
this.router.navigate(['../../'], { relativeTo: this.route });
});
this.recurringDepositsService
.executeRecurringDepositsAccountCommand(this.accountId, 'approve', data)
.subscribe(() => {
this.router.navigate(['../../'], { relativeTo: this.route });
});
}
}
@@ -8,9 +8,8 @@ describe('CloseRecurringDepositsAccountComponent', () => {
beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [ CloseRecurringDepositsAccountComponent ]
})
.compileComponents();
declarations: [CloseRecurringDepositsAccountComponent]
}).compileComponents();
}));
beforeEach(() => {
@@ -17,7 +17,6 @@ import { Dates } from 'app/core/utils/dates';
styleUrls: ['./close-recurring-deposits-account.component.scss']
})
export class CloseRecurringDepositsAccountComponent implements OnInit {
/** Maturity Amount */
maturityAmount: any;
/** On Account Closure Options */
@@ -76,16 +75,25 @@ export class CloseRecurringDepositsAccountComponent implements OnInit {
*/
createcloseRecurringDepositForm() {
this.closeRecurringDepositForm = this.formBuilder.group({
'closedOnDate': [new Date(), Validators.required],
'maturityAmount': [{ value: this.maturityAmount, disabled: true}],
'onAccountClosureId': ['', Validators.required],
'paymentTypeId': ['', Validators.required],
'accountNumber': '',
'chequeNumber': '',
'routingCode': '',
'receiptNumber': '',
'bankNumber': '',
'note': ''
closedOnDate: [
new Date(),
Validators.required
],
maturityAmount: [{ value: this.maturityAmount, disabled: true }],
onAccountClosureId: [
'',
Validators.required
],
paymentTypeId: [
'',
Validators.required
],
accountNumber: '',
chequeNumber: '',
routingCode: '',
receiptNumber: '',
bankNumber: '',
note: ''
});
}
@@ -93,7 +101,7 @@ export class CloseRecurringDepositsAccountComponent implements OnInit {
* Toggles the display of payment details
*/
toggleDisplay() {
this.showPaymentDetails = !(this.showPaymentDetails);
this.showPaymentDetails = !this.showPaymentDetails;
}
/**
@@ -112,9 +120,10 @@ export class CloseRecurringDepositsAccountComponent implements OnInit {
dateFormat,
locale
};
this.recurringDepositsService.executeRecurringDepositsAccountCommand(this.accountId, 'close', data).subscribe(() => {
this.router.navigate(['../../'], { relativeTo: this.route });
});
this.recurringDepositsService
.executeRecurringDepositsAccountCommand(this.accountId, 'close', data)
.subscribe(() => {
this.router.navigate(['../../'], { relativeTo: this.route });
});
}
}
@@ -8,9 +8,8 @@ describe('DepositRecurringDepositsAccountComponent', () => {
beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [ DepositRecurringDepositsAccountComponent ]
})
.compileComponents();
declarations: [DepositRecurringDepositsAccountComponent]
}).compileComponents();
}));
beforeEach(() => {
@@ -18,7 +18,6 @@ import { Currency } from 'app/shared/models/general.model';
styleUrls: ['./deposit-recurring-deposits-account.component.scss']
})
export class DepositRecurringDepositsAccountComponent implements OnInit {
@Input() currency: Currency;
/** Transactions Amount */
@@ -41,7 +40,7 @@ export class DepositRecurringDepositsAccountComponent implements OnInit {
action: string;
actionName: string;
transactionCommand: string;
transactionType: { deposit: boolean, withdrawal: boolean } = { deposit: false, withdrawal: false };
transactionType: { deposit: boolean; withdrawal: boolean } = { deposit: false, withdrawal: false };
/**
* Retrieves action details transactions template data from `resolve`
@@ -62,7 +61,10 @@ export class DepositRecurringDepositsAccountComponent implements OnInit {
this.route.data.subscribe((data: { recurringDepositsAccountActionData: any }) => {
this.transactionAmount = data.recurringDepositsAccountActionData.amount;
this.paymentTypes = data.recurringDepositsAccountActionData.paymentTypeOptions;
if (data.recurringDepositsAccountActionData.outstandingChargeAmount && data.recurringDepositsAccountActionData.outstandingChargeAmount > 0) {
if (
data.recurringDepositsAccountActionData.outstandingChargeAmount &&
data.recurringDepositsAccountActionData.outstandingChargeAmount > 0
) {
this.outstandingChargeAmount = data.recurringDepositsAccountActionData.outstandingChargeAmount;
this.transactionAmount = this.transactionAmount + this.outstandingChargeAmount;
}
@@ -84,10 +86,19 @@ export class DepositRecurringDepositsAccountComponent implements OnInit {
*/
createdepositRecurringDepositForm() {
this.depositRecurringDepositForm = this.formBuilder.group({
'transactionDate': [new Date(), Validators.required],
'transactionAmount': [0.0, Validators.required],
'paymentTypeId': ['', Validators.required],
'note': ''
transactionDate: [
new Date(),
Validators.required
],
transactionAmount: [
0.0,
Validators.required
],
paymentTypeId: [
'',
Validators.required
],
note: ''
});
}
@@ -115,7 +126,7 @@ export class DepositRecurringDepositsAccountComponent implements OnInit {
* Toggles the display of payment details
*/
toggleDisplay() {
this.showPaymentDetails = !(this.showPaymentDetails);
this.showPaymentDetails = !this.showPaymentDetails;
}
/**
@@ -137,9 +148,10 @@ export class DepositRecurringDepositsAccountComponent implements OnInit {
delete data['note'];
data['transactionAmount'] = data['transactionAmount'] * 1;
this.recurringDepositsService.executeRecurringDepositsAccountCommand(this.accountId, this.action, data).subscribe(() => {
this.router.navigate(['../../'], { relativeTo: this.route });
});
this.recurringDepositsService
.executeRecurringDepositsAccountCommand(this.accountId, this.action, data)
.subscribe(() => {
this.router.navigate(['../../'], { relativeTo: this.route });
});
}
}
@@ -8,9 +8,8 @@ describe('PrematureCloseRecurringDepositAccountComponent', () => {
beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [ PrematureCloseRecurringDepositAccountComponent ]
})
.compileComponents();
declarations: [PrematureCloseRecurringDepositAccountComponent]
}).compileComponents();
}));
beforeEach(() => {
@@ -18,7 +18,6 @@ import { Dates } from 'app/core/utils/dates';
styleUrls: ['./premature-close-recurring-deposit-account.component.scss']
})
export class PrematureCloseRecurringDepositAccountComponent implements OnInit {
/** Minimum date allowed. */
minDate = new Date(2000, 0, 1);
/** Maximum date allowed. */
@@ -36,12 +35,14 @@ export class PrematureCloseRecurringDepositAccountComponent implements OnInit {
* @param {Router} router Router
* @param {SettingsService} settingsService Settings Service
*/
constructor(private formBuilder: UntypedFormBuilder,
constructor(
private formBuilder: UntypedFormBuilder,
private recurringDepositsService: RecurringDepositsService,
private dateUtils: Dates,
private route: ActivatedRoute,
private router: Router,
private settingsService: SettingsService, ) {
private settingsService: SettingsService
) {
this.accountId = this.route.parent.snapshot.params['recurringDepositAccountId'];
}
@@ -58,7 +59,10 @@ export class PrematureCloseRecurringDepositAccountComponent implements OnInit {
*/
createprematureCloseRecurringDepositsAccountForm() {
this.prematureCloseRecurringDepositsAccountForm = this.formBuilder.group({
'closedOnDate': ['', Validators.required]
closedOnDate: [
'',
Validators.required
]
});
}
@@ -72,16 +76,20 @@ export class PrematureCloseRecurringDepositAccountComponent implements OnInit {
const dateFormat = this.settingsService.dateFormat;
const prevClosedOnDate: Date = this.prematureCloseRecurringDepositsAccountForm.value.closedOnDate;
if (prematureCloseRecurringDepositsAccountFormData.closedOnDate instanceof Date) {
prematureCloseRecurringDepositsAccountFormData.closedOnDate = this.dateUtils.formatDate(prevClosedOnDate, dateFormat);
prematureCloseRecurringDepositsAccountFormData.closedOnDate = this.dateUtils.formatDate(
prevClosedOnDate,
dateFormat
);
}
const data = {
...prematureCloseRecurringDepositsAccountFormData,
dateFormat,
locale
};
this.recurringDepositsService.executeRecurringDepositsAccountCommand(this.accountId, 'prematureClose', data).subscribe(() => {
this.router.navigate(['../../'], { relativeTo: this.route });
});
this.recurringDepositsService
.executeRecurringDepositsAccountCommand(this.accountId, 'prematureClose', data)
.subscribe(() => {
this.router.navigate(['../../'], { relativeTo: this.route });
});
}
}
@@ -8,9 +8,8 @@ describe('RecurringDepositsAccountActionsComponent', () => {
beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [ RecurringDepositsAccountActionsComponent ]
})
.compileComponents();
declarations: [RecurringDepositsAccountActionsComponent]
}).compileComponents();
}));
beforeEach(() => {
@@ -8,35 +8,34 @@ import { Currency } from 'app/shared/models/general.model';
styleUrls: ['./recurring-deposits-account-actions.component.scss']
})
export class RecurringDepositsAccountActionsComponent {
/** Flag object to store possible actions and render appropriate UI to the user */
actions: {
'Activate': boolean
'Undo Activation': boolean
'Undo Approval': boolean
'Approve': boolean
'Reject': boolean
'Withdrawn by Client': boolean
'Add Charge': boolean
'Premature Close': boolean
'Close': boolean
'Deposit': boolean
'Withdrawal': boolean
Activate: boolean;
'Undo Activation': boolean;
'Undo Approval': boolean;
Approve: boolean;
Reject: boolean;
'Withdrawn by Client': boolean;
'Add Charge': boolean;
'Premature Close': boolean;
Close: boolean;
Deposit: boolean;
Withdrawal: boolean;
} = {
'Activate': false,
'Undo Activation': false,
'Undo Approval': false,
'Approve': false,
'Reject': false,
'Withdrawn by Client': false,
'Add Charge': false,
'Premature Close': false,
'Close': false,
'Deposit': false,
'Withdrawal': false
};
Activate: false,
'Undo Activation': false,
'Undo Approval': false,
Approve: false,
Reject: false,
'Withdrawn by Client': false,
'Add Charge': false,
'Premature Close': false,
Close: false,
Deposit: false,
Withdrawal: false
};
currency: Currency;
currency: Currency;
/**
* @param {ActivatedRoute} route Activated Route
@@ -50,5 +49,4 @@ export class RecurringDepositsAccountActionsComponent {
const name = this.route.snapshot.params['name'];
this.actions[name] = true;
}
}
@@ -8,9 +8,8 @@ describe('RejectRecurringDepositsAccountComponent', () => {
beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [ RejectRecurringDepositsAccountComponent ]
})
.compileComponents();
declarations: [RejectRecurringDepositsAccountComponent]
}).compileComponents();
}));
beforeEach(() => {
@@ -8,7 +8,6 @@ import { RecurringDepositsService } from '../../recurring-deposits.service';
import { SettingsService } from 'app/settings/settings.service';
import { Dates } from 'app/core/utils/dates';
/**
* Reject Recurring Deposits Account Component
*/
@@ -18,7 +17,6 @@ import { Dates } from 'app/core/utils/dates';
styleUrls: ['./reject-recurring-deposits-account.component.scss']
})
export class RejectRecurringDepositsAccountComponent implements OnInit {
/** Minimum date allowed. */
minDate = new Date(2000, 0, 1);
/** Maximum date allowed. */
@@ -36,12 +34,14 @@ export class RejectRecurringDepositsAccountComponent implements OnInit {
* @param {Router} router Router
* @param {SettingsService} settingsService Settings Service
*/
constructor(private formBuilder: UntypedFormBuilder,
constructor(
private formBuilder: UntypedFormBuilder,
private recurringDepositsService: RecurringDepositsService,
private dateUtils: Dates,
private route: ActivatedRoute,
private router: Router,
private settingsService: SettingsService) {
private settingsService: SettingsService
) {
this.accountId = this.route.parent.snapshot.params['recurringDepositAccountId'];
}
@@ -58,8 +58,11 @@ export class RejectRecurringDepositsAccountComponent implements OnInit {
*/
createRejectRecurringDepositsAccountForm() {
this.rejectRecurringDepositsAccountForm = this.formBuilder.group({
'rejectedOnDate': ['', Validators.required],
'note': ['']
rejectedOnDate: [
'',
Validators.required
],
note: ['']
});
}
@@ -80,9 +83,10 @@ export class RejectRecurringDepositsAccountComponent implements OnInit {
dateFormat,
locale
};
this.recurringDepositsService.executeRecurringDepositsAccountCommand(this.accountId, 'reject', data).subscribe(() => {
this.router.navigate(['../../'], { relativeTo: this.route });
});
this.recurringDepositsService
.executeRecurringDepositsAccountCommand(this.accountId, 'reject', data)
.subscribe(() => {
this.router.navigate(['../../'], { relativeTo: this.route });
});
}
}
@@ -8,9 +8,8 @@ describe('UndoApprovalRecurringDepositsAccountComponent', () => {
beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [ UndoApprovalRecurringDepositsAccountComponent ]
})
.compileComponents();
declarations: [UndoApprovalRecurringDepositsAccountComponent]
}).compileComponents();
}));
beforeEach(() => {
@@ -15,7 +15,6 @@ import { RecurringDepositsService } from '../../recurring-deposits.service';
styleUrls: ['./undo-approval-recurring-deposits-account.component.scss']
})
export class UndoApprovalRecurringDepositsAccountComponent implements OnInit {
/** Undo Approval Recurring Deposits Account form. */
undoApprovalRecurringDepositsAccountForm: UntypedFormGroup;
/** Recurring Deposits Account Id */
@@ -30,10 +29,12 @@ export class UndoApprovalRecurringDepositsAccountComponent implements OnInit {
* @param {ActivatedRoute} route Activated Route
* @param {Router} router Router
*/
constructor(private formBuilder: UntypedFormBuilder,
constructor(
private formBuilder: UntypedFormBuilder,
private recurringDepositsService: RecurringDepositsService,
private route: ActivatedRoute,
private router: Router) {
private router: Router
) {
this.undoCommand = 'undoapproval'; // Default command
this.undoAction = this.route.snapshot.params['name'];
if (this.undoAction === 'Undo Activation') {
@@ -54,7 +55,7 @@ export class UndoApprovalRecurringDepositsAccountComponent implements OnInit {
*/
createUndoApprovalRecurringDepositsAccountForm() {
this.undoApprovalRecurringDepositsAccountForm = this.formBuilder.group({
'note': ['']
note: ['']
});
}
@@ -64,17 +65,20 @@ export class UndoApprovalRecurringDepositsAccountComponent implements OnInit {
*/
submit() {
const data = {
...this.undoApprovalRecurringDepositsAccountForm.value,
...this.undoApprovalRecurringDepositsAccountForm.value
};
if (this.undoAction === 'Undo Activation') {
this.recurringDepositsService.executeRecurringDepositsAccountCommand(this.accountId, this.undoCommand, data).subscribe(() => {
this.router.navigate(['../../'], { relativeTo: this.route });
});
this.recurringDepositsService
.executeRecurringDepositsAccountCommand(this.accountId, this.undoCommand, data)
.subscribe(() => {
this.router.navigate(['../../'], { relativeTo: this.route });
});
} else {
this.recurringDepositsService.executeRecurringDepositsAccountCommand(this.accountId, 'undoapproval', data).subscribe(() => {
this.router.navigate(['../../'], { relativeTo: this.route });
});
this.recurringDepositsService
.executeRecurringDepositsAccountCommand(this.accountId, 'undoapproval', data)
.subscribe(() => {
this.router.navigate(['../../'], { relativeTo: this.route });
});
}
}
}
@@ -8,9 +8,8 @@ describe('WithdrawByClientRecurringDepositsAccountComponent', () => {
beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [ WithdrawByClientRecurringDepositsAccountComponent ]
})
.compileComponents();
declarations: [WithdrawByClientRecurringDepositsAccountComponent]
}).compileComponents();
}));
beforeEach(() => {
@@ -16,7 +16,6 @@ import { SettingsService } from 'app/settings/settings.service';
styleUrls: ['./withdraw-by-client-recurring-deposits-account.component.scss']
})
export class WithdrawByClientRecurringDepositsAccountComponent implements OnInit {
/** Minimum date allowed. */
minDate = new Date(2000, 0, 1);
/** Maximum date allowed. */
@@ -34,12 +33,14 @@ export class WithdrawByClientRecurringDepositsAccountComponent implements OnInit
* @param {Router} router Router
* @param {SettingsService} settingsService Settings Service
*/
constructor(private formBuilder: UntypedFormBuilder,
constructor(
private formBuilder: UntypedFormBuilder,
private recurringDepositsService: RecurringDepositsService,
private dateUtils: Dates,
private route: ActivatedRoute,
private router: Router,
private settingsService: SettingsService) {
private settingsService: SettingsService
) {
this.accountId = this.route.parent.snapshot.params['recurringDepositAccountId'];
}
@@ -56,8 +57,11 @@ export class WithdrawByClientRecurringDepositsAccountComponent implements OnInit
*/
createWithdrawRecurringDepositsAccountForm() {
this.withdrawRecurringDepositsAccountForm = this.formBuilder.group({
'withdrawnOnDate': ['', Validators.required],
'note': ['']
withdrawnOnDate: [
'',
Validators.required
],
note: ['']
});
}
@@ -71,16 +75,20 @@ export class WithdrawByClientRecurringDepositsAccountComponent implements OnInit
const dateFormat = this.settingsService.dateFormat;
const prevWithdrawnOnDate: Date = this.withdrawRecurringDepositsAccountForm.value.withdrawnOnDate;
if (withdrawRecurringDepositsAccountFormData.withdrawnOnDate instanceof Date) {
withdrawRecurringDepositsAccountFormData.withdrawnOnDate = this.dateUtils.formatDate(prevWithdrawnOnDate, dateFormat);
withdrawRecurringDepositsAccountFormData.withdrawnOnDate = this.dateUtils.formatDate(
prevWithdrawnOnDate,
dateFormat
);
}
const data = {
...withdrawRecurringDepositsAccountFormData,
dateFormat,
locale
};
this.recurringDepositsService.executeRecurringDepositsAccountCommand(this.accountId, 'withdrawnByApplicant', data).subscribe(() => {
this.router.navigate(['../../'], { relativeTo: this.route });
});
this.recurringDepositsService
.executeRecurringDepositsAccountCommand(this.accountId, 'withdrawnByApplicant', data)
.subscribe(() => {
this.router.navigate(['../../'], { relativeTo: this.route });
});
}
}