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('MakeAccountTransfersComponent', () => {
|
||||
|
||||
beforeEach(async(() => {
|
||||
TestBed.configureTestingModule({
|
||||
declarations: [ MakeAccountTransfersComponent ]
|
||||
})
|
||||
.compileComponents();
|
||||
declarations: [MakeAccountTransfersComponent]
|
||||
}).compileComponents();
|
||||
}));
|
||||
|
||||
beforeEach(() => {
|
||||
|
||||
+44
-23
@@ -9,7 +9,6 @@ import { SettingsService } from 'app/settings/settings.service';
|
||||
import { ClientsService } from 'app/clients/clients.service';
|
||||
import { Dates } from 'app/core/utils/dates';
|
||||
|
||||
|
||||
/**
|
||||
* Create account transfers
|
||||
*/
|
||||
@@ -19,7 +18,6 @@ import { Dates } from 'app/core/utils/dates';
|
||||
styleUrls: ['./make-account-transfers.component.scss']
|
||||
})
|
||||
export class MakeAccountTransfersComponent implements OnInit, AfterViewInit {
|
||||
|
||||
/** Standing Instructions Data */
|
||||
accountTransferTemplateData: any;
|
||||
/** Minimum date allowed. */
|
||||
@@ -55,13 +53,15 @@ export class MakeAccountTransfersComponent implements OnInit, AfterViewInit {
|
||||
* @param {SettingsService} settingsService Settings Service
|
||||
* @param {ClientsService} clientsService Clients Service
|
||||
*/
|
||||
constructor(private formBuilder: UntypedFormBuilder,
|
||||
constructor(
|
||||
private formBuilder: UntypedFormBuilder,
|
||||
private route: ActivatedRoute,
|
||||
private router: Router,
|
||||
private accountTransfersService: AccountTransfersService,
|
||||
private dateUtils: Dates,
|
||||
private settingsService: SettingsService,
|
||||
private clientsService: ClientsService) {
|
||||
private clientsService: ClientsService
|
||||
) {
|
||||
this.route.data.subscribe((data: { accountTransferTemplate: any }) => {
|
||||
this.accountTransferTemplateData = data.accountTransferTemplate;
|
||||
this.setParams();
|
||||
@@ -98,13 +98,34 @@ export class MakeAccountTransfersComponent implements OnInit, AfterViewInit {
|
||||
*/
|
||||
createMakeAccountTransferForm() {
|
||||
this.makeAccountTransferForm = this.formBuilder.group({
|
||||
'toOfficeId': ['', Validators.required],
|
||||
'toClientId': ['', Validators.required],
|
||||
'toAccountType': ['', Validators.required],
|
||||
'toAccountId': ['', Validators.required],
|
||||
'transferAmount': [this.accountTransferTemplateData.transferAmount, Validators.required],
|
||||
'transferDate': [this.settingsService.businessDate, Validators.required],
|
||||
'transferDescription': ['', Validators.required],
|
||||
toOfficeId: [
|
||||
'',
|
||||
Validators.required
|
||||
],
|
||||
toClientId: [
|
||||
'',
|
||||
Validators.required
|
||||
],
|
||||
toAccountType: [
|
||||
'',
|
||||
Validators.required
|
||||
],
|
||||
toAccountId: [
|
||||
'',
|
||||
Validators.required
|
||||
],
|
||||
transferAmount: [
|
||||
this.accountTransferTemplateData.transferAmount,
|
||||
Validators.required
|
||||
],
|
||||
transferDate: [
|
||||
this.settingsService.businessDate,
|
||||
Validators.required
|
||||
],
|
||||
transferDescription: [
|
||||
'',
|
||||
Validators.required
|
||||
]
|
||||
});
|
||||
}
|
||||
|
||||
@@ -118,17 +139,19 @@ export class MakeAccountTransfersComponent implements OnInit, AfterViewInit {
|
||||
/** Executes on change of various select options */
|
||||
changeEvent() {
|
||||
const formValue = this.refineObject(this.makeAccountTransferForm.value);
|
||||
this.accountTransfersService.newAccountTranferResource(this.id, this.accountTypeId, formValue).subscribe((response: any) => {
|
||||
this.accountTransferTemplateData = response;
|
||||
this.toClientTypeData = response.toClientOptions;
|
||||
this.setOptions();
|
||||
});
|
||||
this.accountTransfersService
|
||||
.newAccountTranferResource(this.id, this.accountTypeId, formValue)
|
||||
.subscribe((response: any) => {
|
||||
this.accountTransferTemplateData = response;
|
||||
this.toClientTypeData = response.toClientOptions;
|
||||
this.setOptions();
|
||||
});
|
||||
}
|
||||
|
||||
/** Refine Object
|
||||
* Removes the object param with null or '' values
|
||||
*/
|
||||
refineObject(dataObj: { [x: string]: any; transferAmount: any; transferDate: any; transferDescription: any; }) {
|
||||
refineObject(dataObj: { [x: string]: any; transferAmount: any; transferDate: any; transferDescription: any }) {
|
||||
delete dataObj.transferAmount;
|
||||
delete dataObj.transferDate;
|
||||
delete dataObj.transferDescription;
|
||||
@@ -151,10 +174,9 @@ export class MakeAccountTransfersComponent implements OnInit, AfterViewInit {
|
||||
ngAfterViewInit() {
|
||||
this.makeAccountTransferForm.controls.toClientId.valueChanges.subscribe((value: string) => {
|
||||
if (value.length >= 2) {
|
||||
this.clientsService.getFilteredClients('displayName', 'ASC', true, value)
|
||||
.subscribe((data: any) => {
|
||||
this.clientsData = data.pageItems;
|
||||
});
|
||||
this.clientsService.getFilteredClients('displayName', 'ASC', true, value).subscribe((data: any) => {
|
||||
this.clientsData = data.pageItems;
|
||||
});
|
||||
this.changeEvent();
|
||||
}
|
||||
});
|
||||
@@ -176,7 +198,7 @@ export class MakeAccountTransfersComponent implements OnInit, AfterViewInit {
|
||||
const dateFormat = this.settingsService.dateFormat;
|
||||
const locale = this.settingsService.language.code;
|
||||
const makeAccountTransferData = {
|
||||
... this.makeAccountTransferForm.value,
|
||||
...this.makeAccountTransferForm.value,
|
||||
transferDate: this.dateUtils.formatDate(this.makeAccountTransferForm.value.transferDate, dateFormat),
|
||||
dateFormat,
|
||||
locale,
|
||||
@@ -190,5 +212,4 @@ export class MakeAccountTransfersComponent implements OnInit, AfterViewInit {
|
||||
this.router.navigate(['../../transactions'], { relativeTo: this.route });
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user