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
@@ -26,7 +26,11 @@ const routes: Routes = [
children: [
{
path: 'create-standing-instructions',
data: { title: 'Create Standing Instructions', breadcrumb: 'Create Standing Instructions', routeParamBreadcrumb: 'Create Standing Instructions' },
data: {
title: 'Create Standing Instructions',
breadcrumb: 'Create Standing Instructions',
routeParamBreadcrumb: 'Create Standing Instructions'
},
component: CreateStandingInstructionsComponent,
resolve: {
standingIntructionsTemplate: StandingInstructionsTemplateResolver
@@ -42,7 +46,11 @@ const routes: Routes = [
},
{
path: 'list-standing-instructions',
data: { title: 'List Standing Instructions', breadcrumb: 'List Standing Instructions', routeParamBreadcrumb: 'List Standing Instructions' },
data: {
title: 'List Standing Instructions',
breadcrumb: 'List Standing Instructions',
routeParamBreadcrumb: 'List Standing Instructions'
},
component: ListStandingInstructionsComponent,
resolve: {
standingIntructionsTemplate: StandingInstructionsTemplateResolver
@@ -71,29 +79,33 @@ const routes: Routes = [
data: { title: 'View Standing Instructions', breadcrumb: 'view', routeParamBreadcrumb: false },
component: ViewStandingInstructionsComponent,
resolve: {
standingInstructionsData: ViewStandingInstructionsResolver,
},
standingInstructionsData: ViewStandingInstructionsResolver
}
},
{
path: 'edit',
data: { title: 'Edit Standing Instructions', breadcrumb: 'edit', routeParamBreadcrumb: false },
component: EditStandingInstructionsComponent,
resolve: {
standingInstructionsDataAndTemplate: StandingInstructionsDataAndTemplateResolver,
},
standingInstructionsDataAndTemplate: StandingInstructionsDataAndTemplateResolver
}
},
{
path: 'list-account-transactions',
data: { title: 'List Account Transactions', breadcrumb: 'List Account Transactions', routeParamBreadcrumb: 'List Account Transactions' },
data: {
title: 'List Account Transactions',
breadcrumb: 'List Account Transactions',
routeParamBreadcrumb: 'List Account Transactions'
},
component: ListTransactionsComponent,
resolve: {
listTransactionData: ListTransactionsResolver
}
},
}
]
},
}
]
},
}
];
@NgModule({
imports: [RouterModule.forChild(routes)],
@@ -108,5 +120,4 @@ const routes: Routes = [
ViewAccountTransferResolver
]
})
export class AccountTransfersRoutingModule { }
export class AccountTransfersRoutingModule {}
@@ -21,7 +21,12 @@ import { ViewAccountTransferComponent } from './view-account-transfer/view-accou
* All components related to Account Transfers functions should be declared here.
*/
@NgModule({
imports: [SharedModule, PipesModule, DirectivesModule, AccountTransfersRoutingModule],
imports: [
SharedModule,
PipesModule,
DirectivesModule,
AccountTransfersRoutingModule
],
declarations: [
ViewStandingInstructionsComponent,
EditStandingInstructionsComponent,
@@ -31,6 +36,6 @@ import { ViewAccountTransferComponent } from './view-account-transfer/view-accou
ListTransactionsComponent,
ViewAccountTransferComponent
],
providers: [ ]
providers: []
})
export class AccountTransfersModule { }
export class AccountTransfersModule {}
@@ -12,8 +12,7 @@ import { Observable } from 'rxjs';
providedIn: 'root'
})
export class AccountTransfersService {
constructor(private http: HttpClient) { }
constructor(private http: HttpClient) {}
/**
* @params standingInstructionsId
@@ -33,10 +32,16 @@ export class AccountTransfersService {
return this.http.put(`/standinginstructions/${standinginstructionsId}`, data, { params: httpParams });
}
getStandingInstructionsTemplate(clientId: any, officeId: any, accountTypeId: string, formValue?: any): Observable<any> {
let httpParams = new HttpParams().set('fromAccountType', accountTypeId)
.set('fromClientId', clientId)
.set('fromOfficeId', officeId);
getStandingInstructionsTemplate(
clientId: any,
officeId: any,
accountTypeId: string,
formValue?: any
): Observable<any> {
let httpParams = new HttpParams()
.set('fromAccountType', accountTypeId)
.set('fromClientId', clientId)
.set('fromOfficeId', officeId);
if (formValue) {
const propNames = Object.getOwnPropertyNames(formValue);
for (let i = 0; i < propNames.length; i++) {
@@ -52,8 +57,7 @@ export class AccountTransfersService {
}
newAccountTranferResource(id: any, accountTypeId: any, formValue?: any): Observable<any> {
let httpParams = new HttpParams().set('fromAccountId', id)
.set('fromAccountType', accountTypeId);
let httpParams = new HttpParams().set('fromAccountId', id).set('fromAccountType', accountTypeId);
if (formValue) {
const propNames = Object.getOwnPropertyNames(formValue);
for (let i = 0; i < propNames.length; i++) {
@@ -62,7 +66,6 @@ export class AccountTransfersService {
}
}
return this.http.get(`/accounttransfers/template`, { params: httpParams });
}
createAccountTransfer(data: any): Observable<any> {
@@ -94,18 +97,17 @@ export class AccountTransfersService {
return this.http.delete(`/standinginstructions/${id}`, { params: httpParams });
}
getStandingInstructionsTransactions(standingInstructionsId: any, dateFormat: any, locale: any) {
const httpParams = new HttpParams().set('associations', 'transactions')
.set('dateFormat', dateFormat)
.set('limit', '14')
.set('locale', locale)
.set('offset', '0');
const httpParams = new HttpParams()
.set('associations', 'transactions')
.set('dateFormat', dateFormat)
.set('limit', '14')
.set('locale', locale)
.set('offset', '0');
return this.http.get(`/standinginstructions/${standingInstructionsId}`, { params: httpParams });
}
getViewAccountTransferDetails(transferId: any): Observable<any> {
return this.http.get(`/accounttransfers/${transferId}`);
}
}
@@ -14,23 +14,24 @@ import { SettingsService } from 'app/settings/settings.service';
*/
@Injectable()
export class ListTransactionsResolver implements Resolve<Object> {
/**
* @param {AccountTransfersService} accountTransfersService Account Transfers service.
* @param {SettingsService} settingsService Settings Service.
*/
constructor(
private accountTransfersService: AccountTransfersService,
private settingsService: SettingsService
) {}
/**
* @param {AccountTransfersService} accountTransfersService Account Transfers service.
* @param {SettingsService} settingsService Settings Service.
*/
constructor(private accountTransfersService: AccountTransfersService,
private settingsService: SettingsService) { }
/**
* Returns the Standing Instructions Data.
* @param {ActivatedRouteSnapshot} route Route Snapshot
* @returns {Observable<any>}
*/
resolve(route: ActivatedRouteSnapshot): Observable<any> {
const id = route.parent.paramMap.get('standingInstructionsId');
const dateFormat = this.settingsService.dateFormat;
const locale = this.settingsService.language.code;
return this.accountTransfersService.getStandingInstructionsTransactions(id, dateFormat, locale);
}
/**
* Returns the Standing Instructions Data.
* @param {ActivatedRouteSnapshot} route Route Snapshot
* @returns {Observable<any>}
*/
resolve(route: ActivatedRouteSnapshot): Observable<any> {
const id = route.parent.paramMap.get('standingInstructionsId');
const dateFormat = this.settingsService.dateFormat;
const locale = this.settingsService.language.code;
return this.accountTransfersService.getStandingInstructionsTransactions(id, dateFormat, locale);
}
}
@@ -13,34 +13,32 @@ import { AccountTransfersService } from '../account-transfers.service';
*/
@Injectable()
export class MakeAccountTransferTemplateResolver implements Resolve<Object> {
accountTypeId: string;
id: any;
/**
* @param {accountTransfersService} AccountTransfersService Account Transfers service.
*/
constructor(private accountTransfersService: AccountTransfersService) {}
accountTypeId: string;
id: any;
/**
* @param {accountTransfersService} AccountTransfersService Account Transfers service.
*/
constructor(private accountTransfersService: AccountTransfersService) { }
/**
* Returns the Standing Instructions Data.
* @param {ActivatedRouteSnapshot} route Route Snapshot
* @returns {Observable<any>}
*/
resolve(route: ActivatedRouteSnapshot): Observable<any> {
const accountType = route.queryParamMap.get('accountType');
switch (accountType) {
case 'fromloans':
this.accountTypeId = '1';
this.id = route.queryParamMap.get('loanId');
break;
case 'fromsavings':
this.accountTypeId = '2';
this.id = route.queryParamMap.get('savingsId');
break;
default:
this.accountTypeId = '0';
}
return this.accountTransfersService.newAccountTranferResource(this.id, this.accountTypeId);
/**
* Returns the Standing Instructions Data.
* @param {ActivatedRouteSnapshot} route Route Snapshot
* @returns {Observable<any>}
*/
resolve(route: ActivatedRouteSnapshot): Observable<any> {
const accountType = route.queryParamMap.get('accountType');
switch (accountType) {
case 'fromloans':
this.accountTypeId = '1';
this.id = route.queryParamMap.get('loanId');
break;
case 'fromsavings':
this.accountTypeId = '2';
this.id = route.queryParamMap.get('savingsId');
break;
default:
this.accountTypeId = '0';
}
return this.accountTransfersService.newAccountTranferResource(this.id, this.accountTypeId);
}
}
@@ -13,20 +13,18 @@ import { AccountTransfersService } from '../account-transfers.service';
*/
@Injectable()
export class StandingInstructionsDataAndTemplateResolver implements Resolve<Object> {
/**
* @param {accountTransfersService} AccountTransfersService Account Transfers service.
*/
constructor(private accountTransfersService: AccountTransfersService) {}
/**
* @param {accountTransfersService} AccountTransfersService Account Transfers service.
*/
constructor(private accountTransfersService: AccountTransfersService) { }
/**
* Returns the Standing Instructions Data.
* @param {ActivatedRouteSnapshot} route Route Snapshot
* @returns {Observable<any>}
*/
resolve(route: ActivatedRouteSnapshot): Observable<any> {
const standingInstructionsId = route.parent.paramMap.get('standingInstructionsId');
return this.accountTransfersService.getStandingInstructionsDataAndTemplate(standingInstructionsId);
}
/**
* Returns the Standing Instructions Data.
* @param {ActivatedRouteSnapshot} route Route Snapshot
* @returns {Observable<any>}
*/
resolve(route: ActivatedRouteSnapshot): Observable<any> {
const standingInstructionsId = route.parent.paramMap.get('standingInstructionsId');
return this.accountTransfersService.getStandingInstructionsDataAndTemplate(standingInstructionsId);
}
}
@@ -13,34 +13,32 @@ import { AccountTransfersService } from '../account-transfers.service';
*/
@Injectable()
export class StandingInstructionsTemplateResolver implements Resolve<Object> {
accountTypeId: string;
accountTypeId: string;
/**
* @param {accountTransfersService} AccountTransfersService Account Transfers service.
*/
constructor(private accountTransfersService: AccountTransfersService) {}
/**
* @param {accountTransfersService} AccountTransfersService Account Transfers service.
*/
constructor(private accountTransfersService: AccountTransfersService) { }
/**
* Returns the Standing Instructions Data.
* @param {ActivatedRouteSnapshot} route Route Snapshot
* @returns {Observable<any>}
*/
resolve(route: ActivatedRouteSnapshot): Observable<any> {
const officeId = route.queryParamMap.get('officeId');
const accountType = route.queryParamMap.get('accountType');
const clientId = route.parent.paramMap.get('clientId');
switch (accountType) {
case 'fromloans':
this.accountTypeId = '1';
break;
case 'fromsavings':
this.accountTypeId = '2';
break;
default:
this.accountTypeId = '0';
}
return this.accountTransfersService.getStandingInstructionsTemplate(clientId, officeId, this.accountTypeId);
/**
* Returns the Standing Instructions Data.
* @param {ActivatedRouteSnapshot} route Route Snapshot
* @returns {Observable<any>}
*/
resolve(route: ActivatedRouteSnapshot): Observable<any> {
const officeId = route.queryParamMap.get('officeId');
const accountType = route.queryParamMap.get('accountType');
const clientId = route.parent.paramMap.get('clientId');
switch (accountType) {
case 'fromloans':
this.accountTypeId = '1';
break;
case 'fromsavings':
this.accountTypeId = '2';
break;
default:
this.accountTypeId = '0';
}
return this.accountTransfersService.getStandingInstructionsTemplate(clientId, officeId, this.accountTypeId);
}
}
@@ -13,19 +13,17 @@ import { AccountTransfersService } from '../account-transfers.service';
*/
@Injectable()
export class ViewAccountTransferResolver implements Resolve<Object> {
/**
* @param {AccountTransfersService} AccountTransfersService Savings service.
*/
constructor(private accountTransfersService: AccountTransfersService) {}
/**
* @param {AccountTransfersService} AccountTransfersService Savings service.
*/
constructor(private accountTransfersService: AccountTransfersService) { }
/**
* Returns the View Account Transfer data.
* @returns {Observable<any>}
*/
resolve(route: ActivatedRouteSnapshot): Observable<any> {
const transferId = route.paramMap.get('transferid');
return this.accountTransfersService.getViewAccountTransferDetails(transferId);
}
/**
* Returns the View Account Transfer data.
* @returns {Observable<any>}
*/
resolve(route: ActivatedRouteSnapshot): Observable<any> {
const transferId = route.paramMap.get('transferid');
return this.accountTransfersService.getViewAccountTransferDetails(transferId);
}
}
@@ -13,20 +13,18 @@ import { AccountTransfersService } from '../account-transfers.service';
*/
@Injectable()
export class ViewStandingInstructionsResolver implements Resolve<Object> {
/**
* @param {accountTransfersService} AccountTransfersService Account Transfers service.
*/
constructor(private accountTransfersService: AccountTransfersService) {}
/**
* @param {accountTransfersService} AccountTransfersService Account Transfers service.
*/
constructor(private accountTransfersService: AccountTransfersService) { }
/**
* Returns the Standing Instructions Data.
* @param {ActivatedRouteSnapshot} route Route Snapshot
* @returns {Observable<any>}
*/
resolve(route: ActivatedRouteSnapshot): Observable<any> {
const standingInstructionsId = route.parent.paramMap.get('standingInstructionsId');
return this.accountTransfersService.getStandingInstructionsData(standingInstructionsId);
}
/**
* Returns the Standing Instructions Data.
* @param {ActivatedRouteSnapshot} route Route Snapshot
* @returns {Observable<any>}
*/
resolve(route: ActivatedRouteSnapshot): Observable<any> {
const standingInstructionsId = route.parent.paramMap.get('standingInstructionsId');
return this.accountTransfersService.getStandingInstructionsData(standingInstructionsId);
}
}
@@ -8,9 +8,8 @@ describe('CreateStandingInstructionsComponent', () => {
beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [ CreateStandingInstructionsComponent ]
})
.compileComponents();
declarations: [CreateStandingInstructionsComponent]
}).compileComponents();
}));
beforeEach(() => {
@@ -17,7 +17,6 @@ import { Dates } from 'app/core/utils/dates';
styleUrls: ['./create-standing-instructions.component.scss']
})
export class CreateStandingInstructionsComponent implements OnInit {
/** Standing Instructions Data */
standingIntructionsTemplate: any;
/** Minimum date allowed. */
@@ -45,7 +44,7 @@ export class CreateStandingInstructionsComponent implements OnInit {
/** From Account Data */
fromAccountData: any;
/** Destination Type Data */
destinationTypeData: { id: number; value: string; }[];
destinationTypeData: { id: number; value: string }[];
/** To Office Type Data */
toOfficeTypeData: any;
/** To Client Type Data */
@@ -76,12 +75,14 @@ export class CreateStandingInstructionsComponent implements OnInit {
* @param {SettingsService} settingsService Settings Service
* @param {Dates} dateUtils Date Utils
*/
constructor(private formBuilder: UntypedFormBuilder,
constructor(
private formBuilder: UntypedFormBuilder,
private route: ActivatedRoute,
private router: Router,
private accountTransfersService: AccountTransfersService,
private settingsService: SettingsService,
private dateUtils: Dates) {
private dateUtils: Dates
) {
this.route.data.subscribe((data: { standingIntructionsTemplate: any }) => {
this.standingIntructionsTemplate = data.standingIntructionsTemplate;
this.setParams();
@@ -113,7 +114,7 @@ export class CreateStandingInstructionsComponent implements OnInit {
this.createCreateStandingInstructionsForm();
this.buildDependencies();
this.createStandingInstructionsForm.patchValue({
'applicant': this.standingIntructionsTemplate.fromClient.displayName
applicant: this.standingIntructionsTemplate.fromClient.displayName
});
}
@@ -122,26 +123,83 @@ export class CreateStandingInstructionsComponent implements OnInit {
*/
createCreateStandingInstructionsForm() {
this.createStandingInstructionsForm = this.formBuilder.group({
'name': ['', Validators.required],
'applicant': [{ value: '', disabled: true }],
'transferType': ['', Validators.required],
'priority': ['', Validators.required],
'status': ['', Validators.required],
'fromAccountType': ['', Validators.required],
'fromAccountId': ['', Validators.required],
'destination': ['', Validators.required],
'toOfficeId': ['', Validators.required],
'toClientId': ['', Validators.required],
'toAccountType': ['', Validators.required],
'toAccountId': ['', Validators.required],
'instructionType': ['', Validators.required],
'amount': ['', Validators.required],
'validFrom': ['', Validators.required],
'validTill': ['', Validators.required],
'recurrenceType': ['', Validators.required],
'recurrenceInterval': ['', Validators.required],
'recurrenceFrequency': ['', Validators.required],
'recurrenceOnMonthDay': ['', Validators.required]
name: [
'',
Validators.required
],
applicant: [{ value: '', disabled: true }],
transferType: [
'',
Validators.required
],
priority: [
'',
Validators.required
],
status: [
'',
Validators.required
],
fromAccountType: [
'',
Validators.required
],
fromAccountId: [
'',
Validators.required
],
destination: [
'',
Validators.required
],
toOfficeId: [
'',
Validators.required
],
toClientId: [
'',
Validators.required
],
toAccountType: [
'',
Validators.required
],
toAccountId: [
'',
Validators.required
],
instructionType: [
'',
Validators.required
],
amount: [
'',
Validators.required
],
validFrom: [
'',
Validators.required
],
validTill: [
'',
Validators.required
],
recurrenceType: [
'',
Validators.required
],
recurrenceInterval: [
'',
Validators.required
],
recurrenceFrequency: [
'',
Validators.required
],
recurrenceOnMonthDay: [
'',
Validators.required
]
});
}
@@ -152,7 +210,10 @@ export class CreateStandingInstructionsComponent implements OnInit {
this.statusTypeData = this.standingIntructionsTemplate.statusOptions;
this.fromAccountTypeData = this.standingIntructionsTemplate.fromAccountTypeOptions;
this.fromAccountData = this.standingIntructionsTemplate.fromAccountOptions;
this.destinationTypeData = [{ id: 1, value: 'own account' }, { id: 2, value: 'with in bank' }];
this.destinationTypeData = [
{ id: 1, value: 'own account' },
{ id: 2, value: 'with in bank' }
];
this.toOfficeTypeData = this.standingIntructionsTemplate.toOfficeOptions;
this.toClientTypeData = this.standingIntructionsTemplate.toClientOptions;
this.toAccountTypeData = this.standingIntructionsTemplate.toAccountTypeOptions;
@@ -170,8 +231,8 @@ export class CreateStandingInstructionsComponent implements OnInit {
if (destination === 1) {
this.allowclientedit = false;
this.createStandingInstructionsForm.patchValue({
'toOfficeId': this.officeId,
'toClientId': this.clientId
toOfficeId: this.officeId,
toClientId: this.clientId
});
this.ToOfficeId = true;
this.ToClientId = true;
@@ -179,23 +240,24 @@ export class CreateStandingInstructionsComponent implements OnInit {
} else {
this.allowclientedit = true;
this.createStandingInstructionsForm.patchValue({
'toOfficeId': '',
'toClientId': ''
toOfficeId: '',
toClientId: ''
});
this.createStandingInstructionsForm.controls['toOfficeId'].enable();
this.createStandingInstructionsForm.controls['toClientId'].enable();
}
});
}
/** Executes on change of various select options */
changeEvent() {
const formValue = this.refineObject(this.createStandingInstructionsForm.value);
this.accountTransfersService.getStandingInstructionsTemplate(this.clientId, this.officeId, this.accountTypeId, formValue).subscribe((response: any) => {
this.standingIntructionsTemplate = response;
this.setOptions();
});
this.accountTransfersService
.getStandingInstructionsTemplate(this.clientId, this.officeId, this.accountTypeId, formValue)
.subscribe((response: any) => {
this.standingIntructionsTemplate = response;
this.setOptions();
});
}
/** Refine Object
@@ -219,7 +281,7 @@ export class CreateStandingInstructionsComponent implements OnInit {
const dateFormat = this.settingsService.dateFormat;
const locale = this.settingsService.language.code;
const standingInstructionData = {
... this.createStandingInstructionsForm.value,
...this.createStandingInstructionsForm.value,
dateFormat,
locale,
monthDayFormat: 'dd MMMM',
@@ -227,7 +289,10 @@ export class CreateStandingInstructionsComponent implements OnInit {
fromOfficeId: this.officeId,
validFrom: this.dateUtils.formatDate(this.createStandingInstructionsForm.value.validFrom, dateFormat),
validTill: this.dateUtils.formatDate(this.createStandingInstructionsForm.value.validTill, dateFormat),
recurrenceOnMonthDay: this.dateUtils.formatDate(this.createStandingInstructionsForm.value.recurrenceOnMonthDay, 'dd MMMM'),
recurrenceOnMonthDay: this.dateUtils.formatDate(
this.createStandingInstructionsForm.value.recurrenceOnMonthDay,
'dd MMMM'
)
};
delete standingInstructionData['destination'];
delete standingInstructionData['applicant'];
@@ -235,5 +300,4 @@ export class CreateStandingInstructionsComponent implements OnInit {
this.router.navigate(['../../'], { relativeTo: this.route });
});
}
}
@@ -8,9 +8,8 @@ describe('EditStandingInstructionsComponent', () => {
beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [ EditStandingInstructionsComponent ]
})
.compileComponents();
declarations: [EditStandingInstructionsComponent]
}).compileComponents();
}));
beforeEach(() => {
@@ -17,7 +17,6 @@ import { Dates } from 'app/core/utils/dates';
styleUrls: ['./edit-standing-instructions.component.scss']
})
export class EditStandingInstructionsComponent implements OnInit {
/** Standing Instructions Data */
standingInstructionsData: any;
/** Standing Instructions Id */
@@ -50,12 +49,14 @@ export class EditStandingInstructionsComponent implements OnInit {
* @param {SettingsService} settingsService Settings Service
* @param {Dates} dateUtils Date Utils
*/
constructor(private formBuilder: UntypedFormBuilder,
constructor(
private formBuilder: UntypedFormBuilder,
private route: ActivatedRoute,
private router: Router,
private accountTransfersService: AccountTransfersService,
private settingsService: SettingsService,
private dateUtils: Dates) {
private dateUtils: Dates
) {
this.route.data.subscribe((data: { standingInstructionsDataAndTemplate: any }) => {
this.standingInstructionsData = data.standingInstructionsDataAndTemplate;
this.standingInstructionsId = data.standingInstructionsDataAndTemplate.id;
@@ -77,26 +78,28 @@ export class EditStandingInstructionsComponent implements OnInit {
this.standingInstructionsData.recurrenceOnMonthDay.push(n);
}
this.editStandingInstructionsForm.patchValue({
'name': this.standingInstructionsData.name,
'applicant': this.standingInstructionsData.fromClient.displayName,
'type': this.standingInstructionsData.transferType.value,
'priority': this.standingInstructionsData.priority.id,
'status': this.standingInstructionsData.status.id,
'fromAccountType': this.standingInstructionsData.fromAccountType.value,
'fromAccount': this.standingInstructionsData.fromAccount.productName,
'destination': this.allowclientedit ? 'Within Bank' : 'Own Account',
'toOffice': this.standingInstructionsData.toOffice.name,
'toClientId': this.standingInstructionsData.toClient.displayName,
'toAccountType': this.standingInstructionsData.toAccountType.value,
'toAccount': this.standingInstructionsData.toAccount.productName,
'instructionType': this.standingInstructionsData.instructionType.id,
'amount': this.standingInstructionsData.amount,
'validFrom': this.standingInstructionsData.validFrom && new Date(this.standingInstructionsData.validFrom),
'validTill': this.standingInstructionsData.validTill && new Date(this.standingInstructionsData.validTill),
'recurrenceType': this.standingInstructionsData.recurrenceType.id,
'recurrenceInterval': this.standingInstructionsData.recurrenceInterval,
'recurrenceFrequency': this.standingInstructionsData.recurrenceFrequency.id,
'recurrenceOnMonthDay': this.standingInstructionsData.recurrenceOnMonthDay && new Date(this.standingInstructionsData.recurrenceOnMonthDay)
name: this.standingInstructionsData.name,
applicant: this.standingInstructionsData.fromClient.displayName,
type: this.standingInstructionsData.transferType.value,
priority: this.standingInstructionsData.priority.id,
status: this.standingInstructionsData.status.id,
fromAccountType: this.standingInstructionsData.fromAccountType.value,
fromAccount: this.standingInstructionsData.fromAccount.productName,
destination: this.allowclientedit ? 'Within Bank' : 'Own Account',
toOffice: this.standingInstructionsData.toOffice.name,
toClientId: this.standingInstructionsData.toClient.displayName,
toAccountType: this.standingInstructionsData.toAccountType.value,
toAccount: this.standingInstructionsData.toAccount.productName,
instructionType: this.standingInstructionsData.instructionType.id,
amount: this.standingInstructionsData.amount,
validFrom: this.standingInstructionsData.validFrom && new Date(this.standingInstructionsData.validFrom),
validTill: this.standingInstructionsData.validTill && new Date(this.standingInstructionsData.validTill),
recurrenceType: this.standingInstructionsData.recurrenceType.id,
recurrenceInterval: this.standingInstructionsData.recurrenceInterval,
recurrenceFrequency: this.standingInstructionsData.recurrenceFrequency.id,
recurrenceOnMonthDay:
this.standingInstructionsData.recurrenceOnMonthDay &&
new Date(this.standingInstructionsData.recurrenceOnMonthDay)
});
}
@@ -105,26 +108,41 @@ export class EditStandingInstructionsComponent implements OnInit {
*/
createEditStandingInstructionsForm() {
this.editStandingInstructionsForm = this.formBuilder.group({
'name': [{value: '', disabled: true}],
'applicant': [{ value: '', disabled: true }],
'type': [{ value: '', disabled: true }],
'priority': ['', Validators.required],
'status': ['', Validators.required],
'fromAccountType': [{ value: '', disabled: true }],
'fromAccount': [{ value: '', disabled: true }],
'destination': [{ value: '', disabled: true }],
'toOffice': [{ value: '', disabled: true }],
'toClientId': [{ value: '', disabled: true }],
'toAccountType': [{ value: '', disabled: true }],
'toAccount': [{ value: '', disabled: true }],
'instructionType': '',
'amount': '',
'validFrom': ['', Validators.required],
'validTill': ['', Validators.required],
'recurrenceType': ['', Validators.required],
'recurrenceInterval': '',
'recurrenceFrequency': '',
'recurrenceOnMonthDay': ''
name: [{ value: '', disabled: true }],
applicant: [{ value: '', disabled: true }],
type: [{ value: '', disabled: true }],
priority: [
'',
Validators.required
],
status: [
'',
Validators.required
],
fromAccountType: [{ value: '', disabled: true }],
fromAccount: [{ value: '', disabled: true }],
destination: [{ value: '', disabled: true }],
toOffice: [{ value: '', disabled: true }],
toClientId: [{ value: '', disabled: true }],
toAccountType: [{ value: '', disabled: true }],
toAccount: [{ value: '', disabled: true }],
instructionType: '',
amount: '',
validFrom: [
'',
Validators.required
],
validTill: [
'',
Validators.required
],
recurrenceType: [
'',
Validators.required
],
recurrenceInterval: '',
recurrenceFrequency: '',
recurrenceOnMonthDay: ''
});
}
@@ -147,19 +165,23 @@ export class EditStandingInstructionsComponent implements OnInit {
dateFormat,
instructionType: this.editStandingInstructionsForm.value.instructionType,
locale,
monthDayFormat: 'dd MMMM',
monthDayFormat: 'dd MMMM',
priority: this.editStandingInstructionsForm.value.priority,
recurrenceFrequency: this.editStandingInstructionsForm.value.recurrenceFrequency,
recurrenceInterval: this.editStandingInstructionsForm.value.recurrenceInterval,
recurrenceOnMonthDay: this.dateUtils.formatDate(this.editStandingInstructionsForm.value.recurrenceOnMonthDay, 'dd MMMM'),
recurrenceType: this.editStandingInstructionsForm.value.recurrenceType,
status: this.editStandingInstructionsForm.value.status,
recurrenceFrequency: this.editStandingInstructionsForm.value.recurrenceFrequency,
recurrenceInterval: this.editStandingInstructionsForm.value.recurrenceInterval,
recurrenceOnMonthDay: this.dateUtils.formatDate(
this.editStandingInstructionsForm.value.recurrenceOnMonthDay,
'dd MMMM'
),
recurrenceType: this.editStandingInstructionsForm.value.recurrenceType,
status: this.editStandingInstructionsForm.value.status,
validFrom: this.dateUtils.formatDate(this.editStandingInstructionsForm.value.validFrom, dateFormat),
validTill: this.dateUtils.formatDate(this.editStandingInstructionsForm.value.validTill, dateFormat)
};
this.accountTransfersService.updateStandingInstructionsData(this.standingInstructionsId, standingInstructionData).subscribe((response: any) => {
this.router.navigate(['../view'], { relativeTo: this.route });
});
this.accountTransfersService
.updateStandingInstructionsData(this.standingInstructionsId, standingInstructionData)
.subscribe((response: any) => {
this.router.navigate(['../view'], { relativeTo: this.route });
});
}
}
@@ -8,9 +8,8 @@ describe('ListStandingInstructionsComponent', () => {
beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [ ListStandingInstructionsComponent ]
})
.compileComponents();
declarations: [ListStandingInstructionsComponent]
}).compileComponents();
}));
beforeEach(() => {
@@ -22,7 +22,6 @@ import { SettingsService } from 'app/settings/settings.service';
styleUrls: ['./list-standing-instructions.component.scss']
})
export class ListStandingInstructionsComponent {
/** Recurring Deposits Data */
standingIntructionsTemplateData: any;
/** Instructions Data */
@@ -50,14 +49,21 @@ export class ListStandingInstructionsComponent {
/** Data source for instructions table. */
dataSource = new MatTableDataSource();
/** Columns to be displayed in instructions table. */
displayedColumns: string[] = ['client', 'fromAccount', 'beneficiary', 'toAccount', 'amount', 'validity', 'actions'];
displayedColumns: string[] = [
'client',
'fromAccount',
'beneficiary',
'toAccount',
'amount',
'validity',
'actions'
];
/** Instruction Table Reference */
@ViewChild('instructionsTable', { static: true }) instructionTableRef: MatTable<Element>;
/** Paginator for centers table. */
@ViewChild(MatPaginator, { static: true }) paginator: MatPaginator;
/**
* Retrieves Standing Instructions Data from `resolve`.
* @param {ActivatedRoute} route Activated Route.
@@ -65,10 +71,12 @@ export class ListStandingInstructionsComponent {
* @param {SettingsService} settingsService Settings Service
* @param {AccountTransfersService} accountTransfersService Account Transfers Service
*/
constructor(private route: ActivatedRoute,
constructor(
private route: ActivatedRoute,
private accountTransfersService: AccountTransfersService,
private settingsService: SettingsService,
private dialog: MatDialog) {
private dialog: MatDialog
) {
this.route.data.subscribe((data: { standingIntructionsTemplate: any }) => {
this.standingIntructionsTemplateData = data.standingIntructionsTemplate;
if (data.standingIntructionsTemplate.fromClient) {
@@ -106,7 +114,7 @@ export class ListStandingInstructionsComponent {
const dateFormat = this.settingsService.dateFormat;
const locale = this.settingsService.language.code;
const searchData = {
clientId : this.standingIntructionsTemplateData.fromClient.id || this.fromClientId.value,
clientId: this.standingIntructionsTemplateData.fromClient.id || this.fromClientId.value,
clientName: this.standingIntructionsTemplateData.fromClient.displayName || this.clientNameControl.value,
locale,
dateFormat,
@@ -130,11 +138,8 @@ export class ListStandingInstructionsComponent {
});
deleteStandingInstructionDialogRef.afterClosed().subscribe((response: any) => {
if (response.delete) {
this.accountTransfersService.deleteStandingInstrucions(instructionId)
.subscribe(() => {});
this.accountTransfersService.deleteStandingInstrucions(instructionId).subscribe(() => {});
}
});
}
}
@@ -8,9 +8,8 @@ describe('ListTransactionsComponent', () => {
beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [ ListTransactionsComponent ]
})
.compileComponents();
declarations: [ListTransactionsComponent]
}).compileComponents();
}));
beforeEach(() => {
@@ -13,14 +13,17 @@ import { ActivatedRoute } from '@angular/router';
styleUrls: ['./list-transactions.component.scss']
})
export class ListTransactionsComponent {
/** List Transactions Data */
listTransactionData: any;
/** Data source for instructions table. */
dataSource = new MatTableDataSource();
/** Columns to be displayed in instructions table. */
displayedColumns: string[] = ['transactionDate', 'amount', 'notes', 'reversed'];
displayedColumns: string[] = [
'transactionDate',
'amount',
'notes',
'reversed'
];
/** Paginator for centers table. */
@ViewChild(MatPaginator, { static: true }) paginator: MatPaginator;
@@ -36,5 +39,4 @@ export class ListTransactionsComponent {
this.dataSource.paginator = this.paginator;
});
}
}
@@ -8,9 +8,8 @@ describe('MakeAccountTransfersComponent', () => {
beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [ MakeAccountTransfersComponent ]
})
.compileComponents();
declarations: [MakeAccountTransfersComponent]
}).compileComponents();
}));
beforeEach(() => {
@@ -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 });
});
}
}
@@ -8,9 +8,8 @@ describe('ViewAccountTransferComponent', () => {
beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [ ViewAccountTransferComponent ]
})
.compileComponents();
declarations: [ViewAccountTransferComponent]
}).compileComponents();
}));
beforeEach(() => {
@@ -9,15 +9,16 @@ import { ActivatedRoute } from '@angular/router';
styleUrls: ['./view-account-transfer.component.scss']
})
export class ViewAccountTransferComponent {
viewAccountTransferData: any;
/**
* Retrieves the view account transfer data from `resolve`.
* @param {ActivatedRoute} route Activated Route.
* @param {Location} location Location.
*/
constructor(private route: ActivatedRoute,
private location: Location) {
constructor(
private route: ActivatedRoute,
private location: Location
) {
this.route.data.subscribe((data: { viewAccountTransferData: any }) => {
this.viewAccountTransferData = data.viewAccountTransferData;
});
@@ -38,5 +39,4 @@ export class ViewAccountTransferComponent {
transactionColor(): string {
return this.viewAccountTransferData.reversed ? 'undo' : 'active';
}
}
@@ -8,9 +8,8 @@ describe('ViewStandingInstructionsComponent', () => {
beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [ ViewStandingInstructionsComponent ]
})
.compileComponents();
declarations: [ViewStandingInstructionsComponent]
}).compileComponents();
}));
beforeEach(() => {
@@ -8,7 +8,6 @@ import { ActivatedRoute } from '@angular/router';
styleUrls: ['./view-standing-instructions.component.scss']
})
export class ViewStandingInstructionsComponent {
/** Standing Instructions Data */
standingInstructionsData: any;
/** Allow Client Edit */
@@ -19,12 +18,11 @@ export class ViewStandingInstructionsComponent {
* @param {ActivatedRoute} route Activated Route.
*/
constructor(private route: ActivatedRoute) {
this.route.data.subscribe((data: { standingInstructionsData: any}) => {
this.route.data.subscribe((data: { standingInstructionsData: any }) => {
this.standingInstructionsData = data.standingInstructionsData;
if (this.standingInstructionsData.fromClient.id === this.standingInstructionsData.toClient.id) {
this.allowclientedit = false;
}
});
}
}