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('ClientAddressStepComponent', () => {
beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [ ClientAddressStepComponent ]
})
.compileComponents();
declarations: [ClientAddressStepComponent]
}).compileComponents();
}));
beforeEach(() => {
@@ -21,7 +21,6 @@ import { FormDialogComponent } from 'app/shared/form-dialog/form-dialog.componen
styleUrls: ['./client-address-step.component.scss']
})
export class ClientAddressStepComponent {
/** Client Address Field Config */
@Input() clientAddressFieldConfig: any;
/** Client Template */
@@ -34,8 +33,10 @@ export class ClientAddressStepComponent {
* @param {MatDialog} dialog Mat Dialog
* @param {TranslateService} translateService Translate Service.
*/
constructor(private dialog: MatDialog,
private translateService: TranslateService) {
constructor(
private dialog: MatDialog,
private translateService: TranslateService
) {
this.clientAddressData = [];
}
@@ -44,7 +45,12 @@ export class ClientAddressStepComponent {
*/
addAddress() {
const data = {
title: this.translateService.instant('labels.buttons.Add') + ' ' + this.translateService.instant('labels.catalogs.Client') + ' ' + this.translateService.instant('labels.heading.Address'),
title:
this.translateService.instant('labels.buttons.Add') +
' ' +
this.translateService.instant('labels.catalogs.Client') +
' ' +
this.translateService.instant('labels.heading.Address'),
formfields: this.getAddressFormFields()
};
const addAddressDialogRef = this.dialog.open(FormDialogComponent, { data, width: '50rem' });
@@ -69,7 +75,12 @@ export class ClientAddressStepComponent {
*/
editAddress(address: any, index: number) {
const data = {
title: this.translateService.instant('labels.buttons.Edit') + ' ' + this.translateService.instant('labels.catalogs.Client') + ' ' + this.translateService.instant('labels.heading.Address'),
title:
this.translateService.instant('labels.buttons.Edit') +
' ' +
this.translateService.instant('labels.catalogs.Client') +
' ' +
this.translateService.instant('labels.heading.Address'),
formfields: this.getAddressFormFields(address),
layout: { addButtonText: 'Edit' }
};
@@ -94,7 +105,9 @@ export class ClientAddressStepComponent {
*/
deleteAddress(address: any, index: number) {
const deleteAddressDialogRef = this.dialog.open(DeleteDialogComponent, {
data: { deleteContext: `${this.translateService.instant('labels.heading.Address')} ${this.translateService.instant('labels.inputs.Type')} : ${address.addressType} ${index}` }
data: {
deleteContext: `${this.translateService.instant('labels.heading.Address')} ${this.translateService.instant('labels.inputs.Type')} : ${address.addressType} ${index}`
}
});
deleteAddressDialogRef.afterClosed().subscribe((response: any) => {
if (response.delete) {
@@ -116,7 +129,7 @@ export class ClientAddressStepComponent {
* @param {any} address Address
*/
isFieldEnabled(fieldName: any) {
return (this.clientAddressFieldConfig.find((fieldObj: any) => fieldObj.field === fieldName))?.isEnabled;
return this.clientAddressFieldConfig.find((fieldObj: any) => fieldObj.field === fieldName)?.isEnabled;
}
/**
@@ -125,7 +138,7 @@ export class ClientAddressStepComponent {
* @param {any} address Address
*/
getSelectedValue(fieldName: any, fieldId: any) {
return (this.clientTemplate.address[0][fieldName].find((fieldObj: any) => fieldObj.id === fieldId));
return this.clientTemplate.address[0][fieldName].find((fieldObj: any) => fieldObj.id === fieldId);
}
/**
@@ -136,89 +149,135 @@ export class ClientAddressStepComponent {
let formfields: FormfieldBase[] = [];
for (let index = 0; index < this.clientTemplate.address[0].addressTypeIdOptions.length; index++) {
this.clientTemplate.address[0].addressTypeIdOptions[index].name = this.translateService.instant(`labels.catalogs.${this.clientTemplate.address[0].addressTypeIdOptions[index].name}`);
this.clientTemplate.address[0].addressTypeIdOptions[index].name = this.translateService.instant(
`labels.catalogs.${this.clientTemplate.address[0].addressTypeIdOptions[index].name}`
);
}
formfields.push(this.isFieldEnabled('addressType') ? new SelectBase({
controlName: 'addressTypeId',
label: this.translateService.instant('labels.inputs.Address Type'),
value: address ? address.addressTypeId : '',
options: { label: 'name', value: 'id', data: this.clientTemplate.address[0].addressTypeIdOptions },
order: 1,
required: true
}) : null);
formfields.push(this.isFieldEnabled('street') ? new InputBase({
controlName: 'street',
label: this.translateService.instant('labels.inputs.Street'),
value: address ? address.street : '',
type: 'text',
required: true,
order: 2
}) : null);
formfields.push(this.isFieldEnabled('addressLine1') ? new InputBase({
controlName: 'addressLine1',
label: this.translateService.instant('labels.inputs.Address Line') + ' 1',
value: address ? address.addressLine1 : '',
type: 'text',
order: 3
}) : null);
formfields.push(this.isFieldEnabled('addressLine2') ? new InputBase({
controlName: 'addressLine2',
label: this.translateService.instant('labels.inputs.Address Line') + ' 2',
value: address ? address.addressLine2 : '',
type: 'text',
order: 4
}) : null);
formfields.push(this.isFieldEnabled('addressLine3') ? new InputBase({
controlName: 'addressLine3',
label: this.translateService.instant('labels.inputs.Address Line') + ' 3',
value: address ? address.addressLine3 : '',
type: 'text',
order: 5
}) : null);
formfields.push(this.isFieldEnabled('townVillage') ? new InputBase({
controlName: 'townVillage',
label: this.translateService.instant('labels.inputs.Town / Village'),
value: address ? address.townVillage : '',
type: 'text',
order: 6
}) : null);
formfields.push(this.isFieldEnabled('city') ? new InputBase({
controlName: 'city',
label: this.translateService.instant('labels.inputs.City'),
value: address ? address.city : '',
type: 'text',
order: 7
}) : null);
formfields.push(this.isFieldEnabled('stateProvinceId') ? new SelectBase({
controlName: 'stateProvinceId',
label: this.translateService.instant('labels.inputs.State / Province'),
value: address ? address.stateProvinceId : '',
options: { label: 'name', value: 'id', data: this.clientTemplate.address[0].stateProvinceIdOptions },
order: 8
}) : null);
formfields.push(this.isFieldEnabled('countyDistrict') ? new InputBase({
controlName: 'countryDistrict',
label: this.translateService.instant('labels.inputs.Country District'),
value: address ? address.countyDistrict : '',
type: 'text',
order: 11
}) : null);
formfields.push(this.isFieldEnabled('countryId') ? new SelectBase({
controlName: 'countryId',
label: this.translateService.instant('labels.inputs.Country'),
value: address ? address.countryId : '',
options: { label: 'name', value: 'id', data: this.clientTemplate.address[0].countryIdOptions },
order: 10
}) : null);
formfields.push(this.isFieldEnabled('postalCode') ? new InputBase({
controlName: 'postalCode',
label: this.translateService.instant('labels.inputs.Postal Code'),
value: address ? address.postalCode : '',
type: 'text',
order: 11
}) : null);
formfields = formfields.filter(field => field !== null);
formfields.push(
this.isFieldEnabled('addressType')
? new SelectBase({
controlName: 'addressTypeId',
label: this.translateService.instant('labels.inputs.Address Type'),
value: address ? address.addressTypeId : '',
options: { label: 'name', value: 'id', data: this.clientTemplate.address[0].addressTypeIdOptions },
order: 1,
required: true
})
: null
);
formfields.push(
this.isFieldEnabled('street')
? new InputBase({
controlName: 'street',
label: this.translateService.instant('labels.inputs.Street'),
value: address ? address.street : '',
type: 'text',
required: true,
order: 2
})
: null
);
formfields.push(
this.isFieldEnabled('addressLine1')
? new InputBase({
controlName: 'addressLine1',
label: this.translateService.instant('labels.inputs.Address Line') + ' 1',
value: address ? address.addressLine1 : '',
type: 'text',
order: 3
})
: null
);
formfields.push(
this.isFieldEnabled('addressLine2')
? new InputBase({
controlName: 'addressLine2',
label: this.translateService.instant('labels.inputs.Address Line') + ' 2',
value: address ? address.addressLine2 : '',
type: 'text',
order: 4
})
: null
);
formfields.push(
this.isFieldEnabled('addressLine3')
? new InputBase({
controlName: 'addressLine3',
label: this.translateService.instant('labels.inputs.Address Line') + ' 3',
value: address ? address.addressLine3 : '',
type: 'text',
order: 5
})
: null
);
formfields.push(
this.isFieldEnabled('townVillage')
? new InputBase({
controlName: 'townVillage',
label: this.translateService.instant('labels.inputs.Town / Village'),
value: address ? address.townVillage : '',
type: 'text',
order: 6
})
: null
);
formfields.push(
this.isFieldEnabled('city')
? new InputBase({
controlName: 'city',
label: this.translateService.instant('labels.inputs.City'),
value: address ? address.city : '',
type: 'text',
order: 7
})
: null
);
formfields.push(
this.isFieldEnabled('stateProvinceId')
? new SelectBase({
controlName: 'stateProvinceId',
label: this.translateService.instant('labels.inputs.State / Province'),
value: address ? address.stateProvinceId : '',
options: { label: 'name', value: 'id', data: this.clientTemplate.address[0].stateProvinceIdOptions },
order: 8
})
: null
);
formfields.push(
this.isFieldEnabled('countyDistrict')
? new InputBase({
controlName: 'countryDistrict',
label: this.translateService.instant('labels.inputs.Country District'),
value: address ? address.countyDistrict : '',
type: 'text',
order: 11
})
: null
);
formfields.push(
this.isFieldEnabled('countryId')
? new SelectBase({
controlName: 'countryId',
label: this.translateService.instant('labels.inputs.Country'),
value: address ? address.countryId : '',
options: { label: 'name', value: 'id', data: this.clientTemplate.address[0].countryIdOptions },
order: 10
})
: null
);
formfields.push(
this.isFieldEnabled('postalCode')
? new InputBase({
controlName: 'postalCode',
label: this.translateService.instant('labels.inputs.Postal Code'),
value: address ? address.postalCode : '',
type: 'text',
order: 11
})
: null
);
formfields = formfields.filter((field) => field !== null);
return formfields;
}
@@ -228,5 +287,4 @@ export class ClientAddressStepComponent {
get address() {
return { address: this.clientAddressData ? this.clientAddressData : [] };
}
}
@@ -8,9 +8,8 @@ describe('ClientDatatableStepComponent', () => {
beforeEach(async () => {
await TestBed.configureTestingModule({
declarations: [ ClientDatatableStepComponent ]
})
.compileComponents();
declarations: [ClientDatatableStepComponent]
}).compileComponents();
});
beforeEach(() => {
@@ -16,9 +16,11 @@ export class ClientDatatableStepComponent implements OnInit {
datatableInputs: any = [];
constructor(private formBuilder: UntypedFormBuilder,
constructor(
private formBuilder: UntypedFormBuilder,
private settingsService: SettingsService,
private datatableService: Datatables) { }
private datatableService: Datatables
) {}
ngOnInit(): void {
this.datatableInputs = this.datatableService.filterSystemColumns(this.datatableData.columnHeaderData);
@@ -70,13 +72,13 @@ export class ClientDatatableStepComponent implements OnInit {
const dateFormat = this.settingsService.dateFormat;
const datatableDataValues = this.datatableForm.value;
const data = this.datatableService.buildPayload(this.datatableInputs, datatableDataValues, dateFormat,
{ locale: this.settingsService.language.code });
const data = this.datatableService.buildPayload(this.datatableInputs, datatableDataValues, dateFormat, {
locale: this.settingsService.language.code
});
return {
registeredTableName: this.datatableData.registeredTableName,
data: data
};
}
}
@@ -8,9 +8,8 @@ describe('ClientFamilyMemberDialogComponent', () => {
beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [ ClientFamilyMemberDialogComponent ]
})
.compileComponents();
declarations: [ClientFamilyMemberDialogComponent]
}).compileComponents();
}));
beforeEach(() => {
@@ -16,7 +16,6 @@ import { Dates } from 'app/core/utils/dates';
styleUrls: ['./client-family-member-dialog.component.scss']
})
export class ClientFamilyMemberDialogComponent implements OnInit {
/** Maximum Due Date allowed. */
maxDate = new Date();
@@ -30,28 +29,30 @@ export class ClientFamilyMemberDialogComponent implements OnInit {
* @param {any} data Dialog Data
* @param {SettingsService} settingsService Setting service
*/
constructor(public dialogRef: MatDialogRef<ClientFamilyMemberDialogComponent>,
private formBuilder: UntypedFormBuilder,
private dateUtils: Dates,
@Inject(MAT_DIALOG_DATA) public data: any,
private settingsService: SettingsService) { }
constructor(
public dialogRef: MatDialogRef<ClientFamilyMemberDialogComponent>,
private formBuilder: UntypedFormBuilder,
private dateUtils: Dates,
@Inject(MAT_DIALOG_DATA) public data: any,
private settingsService: SettingsService
) {}
ngOnInit() {
this.maxDate = this.settingsService.businessDate;
this.createFamilyMemberForm();
if (this.data.context === 'Edit') {
this.familyMemberForm.patchValue({
'firstName': this.data.member.firstName,
'middleName': this.data.member.middleName,
'lastName': this.data.member.lastName,
'qualification': this.data.member.qualification,
'age': this.data.member.age,
'isDependent': this.data.member.isDependent,
'relationshipId': this.data.member.relationshipId,
'genderId': this.data.member.genderId,
'professionId': this.data.member.professionId,
'maritalStatusId': this.data.member.maritalStatusId,
'dateOfBirth': this.data.member.dateOfBirth && new Date(this.data.member.dateOfBirth)
firstName: this.data.member.firstName,
middleName: this.data.member.middleName,
lastName: this.data.member.lastName,
qualification: this.data.member.qualification,
age: this.data.member.age,
isDependent: this.data.member.isDependent,
relationshipId: this.data.member.relationshipId,
genderId: this.data.member.genderId,
professionId: this.data.member.professionId,
maritalStatusId: this.data.member.maritalStatusId,
dateOfBirth: this.data.member.dateOfBirth && new Date(this.data.member.dateOfBirth)
});
}
}
@@ -61,17 +62,35 @@ export class ClientFamilyMemberDialogComponent implements OnInit {
*/
createFamilyMemberForm() {
this.familyMemberForm = this.formBuilder.group({
'firstName': ['', Validators.required],
'middleName': [''],
'lastName': ['', Validators.required],
'qualification': [''],
'age': ['', Validators.required],
'isDependent': [''],
'relationshipId': ['', Validators.required],
'genderId': ['', Validators.required],
'professionId': [''],
'maritalStatusId': [''],
'dateOfBirth': ['', Validators.required]
firstName: [
'',
Validators.required
],
middleName: [''],
lastName: [
'',
Validators.required
],
qualification: [''],
age: [
'',
Validators.required
],
isDependent: [''],
relationshipId: [
'',
Validators.required
],
genderId: [
'',
Validators.required
],
professionId: [''],
maritalStatusId: [''],
dateOfBirth: [
'',
Validators.required
]
});
}
@@ -97,5 +116,4 @@ export class ClientFamilyMemberDialogComponent implements OnInit {
}
return familyMember;
}
}
@@ -8,9 +8,8 @@ describe('ClientFamilyMembersStepComponent', () => {
beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [ ClientFamilyMembersStepComponent ]
})
.compileComponents();
declarations: [ClientFamilyMembersStepComponent]
}).compileComponents();
}));
beforeEach(() => {
@@ -16,7 +16,6 @@ import { ClientFamilyMemberDialogComponent } from './client-family-member-dialog
styleUrls: ['./client-family-members-step.component.scss']
})
export class ClientFamilyMembersStepComponent {
/** Cient Template */
@Input() clientTemplate: any;
/** Client Family Members */
@@ -26,8 +25,10 @@ export class ClientFamilyMembersStepComponent {
* @param {MatDialog} dialog Mat Dialog
* @param {TranslateService} translateService Translate Service.
*/
constructor(public dialog: MatDialog,
private translateService: TranslateService) { }
constructor(
public dialog: MatDialog,
private translateService: TranslateService
) {}
/**
* Adds a family member.
@@ -36,7 +37,7 @@ export class ClientFamilyMembersStepComponent {
const addFamilyMemberDialogRef = this.dialog.open(ClientFamilyMemberDialogComponent, {
data: {
context: this.translateService.instant('labels.buttons.Add'),
options: this.clientTemplate.familyMemberOptions,
options: this.clientTemplate.familyMemberOptions
},
width: '50rem'
});
@@ -57,7 +58,7 @@ export class ClientFamilyMembersStepComponent {
data: {
context: 'Edit',
member: member,
options: this.clientTemplate.familyMemberOptions,
options: this.clientTemplate.familyMemberOptions
},
width: '50rem'
});
@@ -88,5 +89,4 @@ export class ClientFamilyMembersStepComponent {
get familyMembers() {
return { familyMembers: this.clientFamilyMembers };
}
}
@@ -8,9 +8,8 @@ describe('ClientGeneralStepComponent', () => {
beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [ ClientGeneralStepComponent ]
})
.compileComponents();
declarations: [ClientGeneralStepComponent]
}).compileComponents();
}));
beforeEach(() => {
@@ -16,7 +16,6 @@ import { SettingsService } from 'app/settings/settings.service';
styleUrls: ['./client-general-step.component.scss']
})
export class ClientGeneralStepComponent implements OnInit {
@Output() legalFormChangeEvent = new EventEmitter<{ legalForm: number }>();
/** Minimum date allowed. */
@@ -54,10 +53,12 @@ export class ClientGeneralStepComponent implements OnInit {
* @param {SettingsService} settingsService Setting service
* @param {ClientsService} clientService Client service
*/
constructor(private formBuilder: UntypedFormBuilder,
private dateUtils: Dates,
private settingsService: SettingsService,
private clientService: ClientsService) {
constructor(
private formBuilder: UntypedFormBuilder,
private dateUtils: Dates,
private settingsService: SettingsService,
private clientService: ClientsService
) {
this.setClientForm();
}
@@ -72,21 +73,33 @@ export class ClientGeneralStepComponent implements OnInit {
*/
setClientForm() {
this.createClientForm = this.formBuilder.group({
'officeId': ['', Validators.required],
'staffId': [''],
'legalFormId': ['', Validators.required],
'isStaff': [false],
'active': [false],
'addSavings': [false],
'accountNo': [''],
'externalId': [''],
'genderId': [''],
'mobileNo': [''],
'emailAddress': ['', Validators.email],
'dateOfBirth': [''],
'clientTypeId': [''],
'clientClassificationId': [''],
'submittedOnDate': [this.settingsService.businessDate, Validators.required]
officeId: [
'',
Validators.required
],
staffId: [''],
legalFormId: [
'',
Validators.required
],
isStaff: [false],
active: [false],
addSavings: [false],
accountNo: [''],
externalId: [''],
genderId: [''],
mobileNo: [''],
emailAddress: [
'',
Validators.email
],
dateOfBirth: [''],
clientTypeId: [''],
clientClassificationId: [''],
submittedOnDate: [
this.settingsService.businessDate,
Validators.required
]
});
}
@@ -114,21 +127,42 @@ export class ClientGeneralStepComponent implements OnInit {
if (legalFormId === 1) {
this.createClientForm.removeControl('fullname');
this.createClientForm.removeControl('clientNonPersonDetails');
this.createClientForm.addControl('firstname', new UntypedFormControl('', [Validators.required, Validators.pattern('(^[A-z]).*')]));
this.createClientForm.addControl(
'firstname',
new UntypedFormControl('', [
Validators.required,
Validators.pattern('(^[A-z]).*')])
);
this.createClientForm.addControl('middlename', new UntypedFormControl('', Validators.pattern('(^[A-z]).*')));
this.createClientForm.addControl('lastname', new UntypedFormControl('', [Validators.required, Validators.pattern('(^[A-z]).*')]));
this.createClientForm.addControl(
'lastname',
new UntypedFormControl('', [
Validators.required,
Validators.pattern('(^[A-z]).*')])
);
} else {
this.createClientForm.removeControl('firstname');
this.createClientForm.removeControl('middlename');
this.createClientForm.removeControl('lastname');
this.createClientForm.addControl('fullname', new UntypedFormControl('', [Validators.required, Validators.pattern('(^[A-z]).*')]));
this.createClientForm.addControl('clientNonPersonDetails', this.formBuilder.group({
'constitutionId': ['', Validators.required],
'incorpValidityTillDate': [''],
'incorpNumber': [''],
'mainBusinessLineId': [''],
'remarks': ['']
}));
this.createClientForm.addControl(
'fullname',
new UntypedFormControl('', [
Validators.required,
Validators.pattern('(^[A-z]).*')])
);
this.createClientForm.addControl(
'clientNonPersonDetails',
this.formBuilder.group({
constitutionId: [
'',
Validators.required
],
incorpValidityTillDate: [''],
incorpNumber: [''],
mainBusinessLineId: [''],
remarks: ['']
})
);
}
});
this.createClientForm.get('legalFormId').patchValue(1);
@@ -189,5 +223,4 @@ export class ClientGeneralStepComponent implements OnInit {
}
return generalDetails;
}
}
@@ -8,9 +8,8 @@ describe('ClientPreviewStepComponent', () => {
beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [ ClientPreviewStepComponent ]
})
.compileComponents();
declarations: [ClientPreviewStepComponent]
}).compileComponents();
}));
beforeEach(() => {
@@ -10,7 +10,6 @@ import { Component, Output, EventEmitter, Input } from '@angular/core';
styleUrls: ['./client-preview-step.component.scss']
})
export class ClientPreviewStepComponent {
/** Client Address field configuration */
@Input() clientAddressFieldConfig: any;
/** Client Template */
@@ -21,7 +20,7 @@ export class ClientPreviewStepComponent {
/** Form submission event */
@Output() submitEvent = new EventEmitter();
constructor() { }
constructor() {}
/**
* Utilized in address preview.
@@ -30,7 +29,7 @@ export class ClientPreviewStepComponent {
* @param {any} fieldId Field Id
*/
getSelectedValue(fieldName: any, fieldId: any) {
return (this.clientTemplate.address[0][fieldName].find((fieldObj: any) => fieldObj.id === fieldId));
return this.clientTemplate.address[0][fieldName].find((fieldObj: any) => fieldObj.id === fieldId);
}
/**
@@ -38,7 +37,6 @@ export class ClientPreviewStepComponent {
* @param {any} fieldName Field Name
*/
isFieldEnabled(fieldName: any) {
return (this.clientAddressFieldConfig.find((fieldObj: any) => fieldObj.field === fieldName))?.isEnabled;
return this.clientAddressFieldConfig.find((fieldObj: any) => fieldObj.field === fieldName)?.isEnabled;
}
}
+223 -212
View File
@@ -48,225 +48,236 @@ import { ClientDataAndTemplateResolver } from './common-resolvers/client-and-tem
import { ClientCollateralResolver } from './common-resolvers/client-collateral.resolver';
const routes: Routes = [
Route.withShell([{
path: 'clients',
data: { title: 'Clients', breadcrumb: 'Clients', routeParamBreadcrumb: false },
children: [
{
path: '',
component: ClientsComponent
},
{
path: 'create',
data: { title: 'Create Client', breadcrumb: 'Create Client', routeParamBreadcrumb: false },
component: CreateClientComponent,
resolve: {
clientAddressFieldConfig: ClientAddressFieldConfigurationResolver,
clientTemplate: ClientTemplateResolver
}
},
{
path: ':clientId',
component: ClientsViewComponent,
data: { title: 'Clients View', routeParamBreadcrumb: 'clientId' },
resolve: {
clientViewData: ClientViewResolver,
clientTemplateData: ClientTemplateResolver,
clientDatatables: ClientDatatablesResolver
Route.withShell([
{
path: 'clients',
data: { title: 'Clients', breadcrumb: 'Clients', routeParamBreadcrumb: false },
children: [
{
path: '',
component: ClientsComponent
},
children: [
{
path: '',
redirectTo: 'general',
pathMatch: 'full'
{
path: 'create',
data: { title: 'Create Client', breadcrumb: 'Create Client', routeParamBreadcrumb: false },
component: CreateClientComponent,
resolve: {
clientAddressFieldConfig: ClientAddressFieldConfigurationResolver,
clientTemplate: ClientTemplateResolver
}
},
{
path: ':clientId',
component: ClientsViewComponent,
data: { title: 'Clients View', routeParamBreadcrumb: 'clientId' },
resolve: {
clientViewData: ClientViewResolver,
clientTemplateData: ClientTemplateResolver,
clientDatatables: ClientDatatablesResolver
},
{
path: 'general',
component: GeneralTabComponent,
data: { title: 'General', breadcrumb: 'General', routeParamBreadcrumb: false },
resolve: {
clientAccountsData: ClientAccountsResolver,
clientChargesData: ClientChargesResolver,
clientCollateralData: ClientCollateralResolver
}
},
{
path: 'address',
component: AddressTabComponent,
data: { title: 'Address', breadcrumb: 'Address', routeParamBreadcrumb: false },
resolve: {
clientAddressFieldConfig: ClientAddressFieldConfigurationResolver,
clientAddressTemplateData: ClientAddressTemplateResolver,
clientAddressData: ClientAddressResolver
}
},
{
path: 'family-members',
data: { title: 'Family Members', breadcrumb: 'Family Members', routeParamBreadcrumb: false },
children: [
{
path: '',
component: FamilyMembersTabComponent,
resolve: {
clientFamilyMembers: ClientFamilyMembersResolver
}
},
{
path: 'add',
component: AddFamilyMemberComponent,
data: { title: 'Add', breadcrumb: 'Add', routeParamBreadcrumb: false },
resolve: {
clientTemplate: ClientTemplateResolver
}
},
{
path: ':familyMemberId',
children: [{
path: 'edit',
component: EditFamilyMemberComponent,
data: { title: 'Family Member View', routeParamBreadcrumb: 'familyMemberId' },
resolve: {
clientTemplate: ClientTemplateResolver,
editFamilyMember: ClientFamilyMemberResolver
}
}]
}
]
},
{
path: 'identities',
component: IdentitiesTabComponent,
data: { title: 'Identities', breadcrumb: 'Identities', routeParamBreadcrumb: false },
resolve: {
clientIdentities: ClientIdentitiesResolver,
clientIdentifierTemplate: ClientIdentifierTemplateResolver
}
},
{
path: 'documents',
component: DocumentsTabComponent,
data: { title: 'Documents', breadcrumb: 'Documents', routeParamBreadcrumb: false },
resolve: {
clientDocuments: ClientDocumentsResolver
}
},
{
path: 'notes',
component: NotesTabComponent,
data: { title: 'Notes', breadcrumb: 'Notes', routeParamBreadcrumb: false },
resolve: {
clientNotes: ClientNotesResolver
}
},
{
path: 'datatables',
children: [{
path: ':datatableName',
component: DatatableTabComponent,
data: { title: 'Data Table View', routeParamBreadcrumb: 'datatableName' },
children: [
{
path: '',
redirectTo: 'general',
pathMatch: 'full'
},
{
path: 'general',
component: GeneralTabComponent,
data: { title: 'General', breadcrumb: 'General', routeParamBreadcrumb: false },
resolve: {
clientDatatable: ClientDatatableResolver
clientAccountsData: ClientAccountsResolver,
clientChargesData: ClientChargesResolver,
clientCollateralData: ClientCollateralResolver
}
}]
}
]
},
]
},
{
path: 'clients',
data: { title: 'Clients', breadcrumb: 'Clients', routeParamBreadcrumb: false },
children: [
{
path: ':clientId',
data: { title: 'Clients View', routeParamBreadcrumb: 'clientId' },
resolve: {
clientViewData: ClientViewResolver
},
children: [
{
path: 'edit',
data: { title: 'Edit Client', breadcrumb: 'Edit', routeParamBreadcrumb: false },
component: EditClientComponent,
resolve: {
clientDataAndTemplate: ClientDataAndTemplateResolver
}
},
{
path: 'actions/:name',
data: { title: 'Client Actions', routeParamBreadcrumb: 'name' },
component: ClientActionsComponent,
resolve: {
clientActionData: ClientActionsResolver
}
},
{
path: 'charges',
children: [
{
path: 'overview',
data: { title: 'Charges Overview', breadcrumb: 'Charges Overview' },
component: ChargesOverviewComponent,
resolve: {
clientChargesData: ClientChargeOverviewResolver
}
},
{
path: ':chargeId',
data: { title: 'Charges', routeParamBreadcrumb: 'chargeId' },
children: [
{
path: '',
component: ViewChargeComponent,
resolve: {
clientChargeData: ClientChargeViewResolver
}
},
{
path: 'pay',
data: { title: 'Pay Charge', routeParamBreadcrumb: false },
component: ClientPayChargesComponent,
resolve: {
transactionData: ClientTransactionPayResolver
}
},
{
path: 'address',
component: AddressTabComponent,
data: { title: 'Address', breadcrumb: 'Address', routeParamBreadcrumb: false },
resolve: {
clientAddressFieldConfig: ClientAddressFieldConfigurationResolver,
clientAddressTemplateData: ClientAddressTemplateResolver,
clientAddressData: ClientAddressResolver
}
},
{
path: 'family-members',
data: { title: 'Family Members', breadcrumb: 'Family Members', routeParamBreadcrumb: false },
children: [
{
path: '',
component: FamilyMembersTabComponent,
resolve: {
clientFamilyMembers: ClientFamilyMembersResolver
}
]
},
{
path: 'add',
component: AddFamilyMemberComponent,
data: { title: 'Add', breadcrumb: 'Add', routeParamBreadcrumb: false },
resolve: {
clientTemplate: ClientTemplateResolver
}
},
{
path: ':familyMemberId',
children: [
{
path: 'edit',
component: EditFamilyMemberComponent,
data: { title: 'Family Member View', routeParamBreadcrumb: 'familyMemberId' },
resolve: {
clientTemplate: ClientTemplateResolver,
editFamilyMember: ClientFamilyMemberResolver
}
}
]
}
]
},
{
path: 'identities',
component: IdentitiesTabComponent,
data: { title: 'Identities', breadcrumb: 'Identities', routeParamBreadcrumb: false },
resolve: {
clientIdentities: ClientIdentitiesResolver,
clientIdentifierTemplate: ClientIdentifierTemplateResolver
}
]
},
{
path: 'documents',
component: DocumentsTabComponent,
data: { title: 'Documents', breadcrumb: 'Documents', routeParamBreadcrumb: false },
resolve: {
clientDocuments: ClientDocumentsResolver
}
},
{
path: 'notes',
component: NotesTabComponent,
data: { title: 'Notes', breadcrumb: 'Notes', routeParamBreadcrumb: false },
resolve: {
clientNotes: ClientNotesResolver
}
},
{
path: 'datatables',
children: [
{
path: ':datatableName',
component: DatatableTabComponent,
data: { title: 'Data Table View', routeParamBreadcrumb: 'datatableName' },
resolve: {
clientDatatable: ClientDatatableResolver
}
}
]
}
]
}
]
},
{
path: 'clients',
data: { title: 'Clients', breadcrumb: 'Clients', routeParamBreadcrumb: false },
children: [
{
path: ':clientId',
data: { title: 'Clients View', routeParamBreadcrumb: 'clientId' },
resolve: {
clientViewData: ClientViewResolver
},
{
path: 'loans-accounts',
loadChildren: () => import('../loans/loans.module').then(m => m.LoansModule)
},
{
path: 'client-collateral',
loadChildren: () => import('../collaterals/collaterals.module').then(m => m.CollateralsModule)
},
{
path: 'fixed-deposits-accounts',
loadChildren: () => import('../deposits/fixed-deposits/fixed-deposits.module').then(m => m.FixedDepositsModule)
},
{
path: 'savings-accounts',
loadChildren: () => import('../savings/savings.module').then(m => m.SavingsModule)
},
{
path: 'recurring-deposits-accounts',
loadChildren: () => import('../deposits/recurring-deposits/recurring-deposits.module').then(m => m.RecurringDepositsModule)
},
{
path: 'shares-accounts',
loadChildren: () => import('../shares/shares.module').then(m => m.SharesModule)
},
{
path: 'standing-instructions',
loadChildren: () => import('../account-transfers/account-transfers.module').then(m => m.AccountTransfersModule)
}
]
}
]
}
children: [
{
path: 'edit',
data: { title: 'Edit Client', breadcrumb: 'Edit', routeParamBreadcrumb: false },
component: EditClientComponent,
resolve: {
clientDataAndTemplate: ClientDataAndTemplateResolver
}
},
{
path: 'actions/:name',
data: { title: 'Client Actions', routeParamBreadcrumb: 'name' },
component: ClientActionsComponent,
resolve: {
clientActionData: ClientActionsResolver
}
},
{
path: 'charges',
children: [
{
path: 'overview',
data: { title: 'Charges Overview', breadcrumb: 'Charges Overview' },
component: ChargesOverviewComponent,
resolve: {
clientChargesData: ClientChargeOverviewResolver
}
},
{
path: ':chargeId',
data: { title: 'Charges', routeParamBreadcrumb: 'chargeId' },
children: [
{
path: '',
component: ViewChargeComponent,
resolve: {
clientChargeData: ClientChargeViewResolver
}
},
{
path: 'pay',
data: { title: 'Pay Charge', routeParamBreadcrumb: false },
component: ClientPayChargesComponent,
resolve: {
transactionData: ClientTransactionPayResolver
}
}
]
}
]
},
{
path: 'loans-accounts',
loadChildren: () => import('../loans/loans.module').then((m) => m.LoansModule)
},
{
path: 'client-collateral',
loadChildren: () => import('../collaterals/collaterals.module').then((m) => m.CollateralsModule)
},
{
path: 'fixed-deposits-accounts',
loadChildren: () =>
import('../deposits/fixed-deposits/fixed-deposits.module').then((m) => m.FixedDepositsModule)
},
{
path: 'savings-accounts',
loadChildren: () => import('../savings/savings.module').then((m) => m.SavingsModule)
},
{
path: 'recurring-deposits-accounts',
loadChildren: () =>
import('../deposits/recurring-deposits/recurring-deposits.module').then(
(m) => m.RecurringDepositsModule
)
},
{
path: 'shares-accounts',
loadChildren: () => import('../shares/shares.module').then((m) => m.SharesModule)
},
{
path: 'standing-instructions',
loadChildren: () =>
import('../account-transfers/account-transfers.module').then((m) => m.AccountTransfersModule)
}
]
}
]
}
])
];
@NgModule({
@@ -297,4 +308,4 @@ const routes: Routes = [
ClientCollateralResolver
]
})
export class ClientsRoutingModule { }
export class ClientsRoutingModule {}
@@ -8,9 +8,8 @@ describe('AddressTabComponent', () => {
beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [ AddressTabComponent ]
})
.compileComponents();
declarations: [AddressTabComponent]
}).compileComponents();
}));
beforeEach(() => {
@@ -22,7 +22,6 @@ import { ClientsService } from '../../clients.service';
styleUrls: ['./address-tab.component.scss']
})
export class AddressTabComponent {
/** Client Address Data */
clientAddressData: any;
/** Client Address Field Config */
@@ -38,20 +37,20 @@ export class AddressTabComponent {
* @param {MatDialog} dialog Mat Dialog
* @param {TranslateService} translateService Translate Service.
*/
constructor(private route: ActivatedRoute,
private clientService: ClientsService,
private dialog: MatDialog,
private translateService: TranslateService) {
this.route.data.subscribe((data: {
clientAddressData: any,
clientAddressFieldConfig: any,
clientAddressTemplateData: any
}) => {
this.clientAddressData = data.clientAddressData;
this.clientAddressFieldConfig = data.clientAddressFieldConfig;
this.clientAddressTemplate = data.clientAddressTemplateData;
this.clientId = this.route.parent.snapshot.paramMap.get('clientId');
});
constructor(
private route: ActivatedRoute,
private clientService: ClientsService,
private dialog: MatDialog,
private translateService: TranslateService
) {
this.route.data.subscribe(
(data: { clientAddressData: any; clientAddressFieldConfig: any; clientAddressTemplateData: any }) => {
this.clientAddressData = data.clientAddressData;
this.clientAddressFieldConfig = data.clientAddressFieldConfig;
this.clientAddressTemplate = data.clientAddressTemplateData;
this.clientId = this.route.parent.snapshot.paramMap.get('clientId');
}
);
}
/**
@@ -59,20 +58,26 @@ export class AddressTabComponent {
*/
addAddress() {
const data = {
title: this.translateService.instant('labels.buttons.Add') + ' ' + this.translateService.instant('labels.catalogs.Client') + ' ' + this.translateService.instant('labels.heading.Address'),
title:
this.translateService.instant('labels.buttons.Add') +
' ' +
this.translateService.instant('labels.catalogs.Client') +
' ' +
this.translateService.instant('labels.heading.Address'),
formfields: this.getAddressFormFields('add')
};
const addAddressDialogRef = this.dialog.open(FormDialogComponent, { data });
addAddressDialogRef.afterClosed().subscribe((response: any) => {
if (response.data) {
this.clientService.createClientAddress(this.clientId, response.data.value.addressType, response.data.value).subscribe((res: any) => {
const addressData = response.data.value;
addressData.addressId = res.resourceId;
addressData.addressType = this.getSelectedValue('addressTypeIdOptions', addressData.addressType).name;
addressData.isActive = false;
this.clientAddressData.push(addressData);
});
this.clientService
.createClientAddress(this.clientId, response.data.value.addressType, response.data.value)
.subscribe((res: any) => {
const addressData = response.data.value;
addressData.addressId = res.resourceId;
addressData.addressType = this.getSelectedValue('addressTypeIdOptions', addressData.addressType).name;
addressData.isActive = false;
this.clientAddressData.push(addressData);
});
}
});
}
@@ -84,7 +89,12 @@ export class AddressTabComponent {
*/
editAddress(address: any, index: number) {
const data = {
title: this.translateService.instant('labels.buttons.Edit') + ' ' + this.translateService.instant('labels.catalogs.Client') + ' ' + this.translateService.instant('labels.heading.Address'),
title:
this.translateService.instant('labels.buttons.Edit') +
' ' +
this.translateService.instant('labels.catalogs.Client') +
' ' +
this.translateService.instant('labels.heading.Address'),
formfields: this.getAddressFormFields('edit', address),
layout: { addButtonText: 'Edit' }
};
@@ -94,11 +104,13 @@ export class AddressTabComponent {
const addressData = response.data.value;
addressData.addressId = address.addressId;
addressData.isActive = address.isActive;
this.clientService.editClientAddress(this.clientId, address.addressTypeId, addressData).subscribe((res: any) => {
addressData.addressTypeId = address.addressTypeId;
addressData.addressType = address.addressType;
this.clientAddressData[index] = addressData;
});
this.clientService
.editClientAddress(this.clientId, address.addressTypeId, addressData)
.subscribe((res: any) => {
addressData.addressTypeId = address.addressTypeId;
addressData.addressType = address.addressType;
this.clientAddressData[index] = addressData;
});
}
});
}
@@ -109,8 +121,8 @@ export class AddressTabComponent {
*/
toggleAddress(address: any) {
const addressData = {
'addressId': address.addressId,
'isActive': address.isActive ? false : true
addressId: address.addressId,
isActive: address.isActive ? false : true
};
this.clientService.editClientAddress(this.clientId, address.addressTypeId, addressData).subscribe(() => {
address.isActive = address.isActive ? false : true;
@@ -122,7 +134,7 @@ export class AddressTabComponent {
* @param {any} fieldName Field Name
*/
isFieldEnabled(fieldName: any) {
return (this.clientAddressFieldConfig.find((fieldObj: any) => fieldObj.field === fieldName))?.isEnabled;
return this.clientAddressFieldConfig.find((fieldObj: any) => fieldObj.field === fieldName)?.isEnabled;
}
/**
@@ -131,7 +143,7 @@ export class AddressTabComponent {
* @param {any} fieldId Field Id
*/
getSelectedValue(fieldName: any, fieldId: any) {
return (this.clientAddressTemplate[fieldName].find((fieldObj: any) => fieldObj.id === fieldId));
return this.clientAddressTemplate[fieldName].find((fieldObj: any) => fieldObj.id === fieldId);
}
/**
@@ -143,91 +155,136 @@ export class AddressTabComponent {
let formfields: FormfieldBase[] = [];
for (let index = 0; index < this.clientAddressTemplate.addressTypeIdOptions.length; index++) {
this.clientAddressTemplate.addressTypeIdOptions[index].name = this.translateService.instant(`labels.catalogs.${this.clientAddressTemplate.addressTypeIdOptions[index].name}`);
this.clientAddressTemplate.addressTypeIdOptions[index].name = this.translateService.instant(
`labels.catalogs.${this.clientAddressTemplate.addressTypeIdOptions[index].name}`
);
}
if (formType === 'add') {
formfields.push(this.isFieldEnabled('addressType') ? new SelectBase({
controlName: 'addressType',
label: this.translateService.instant('labels.inputs.Address Type'),
value: address ? address.addressType : '',
options: { label: 'name', value: 'id', data: this.clientAddressTemplate.addressTypeIdOptions },
order: 1
}) : null);
formfields.push(
this.isFieldEnabled('addressType')
? new SelectBase({
controlName: 'addressType',
label: this.translateService.instant('labels.inputs.Address Type'),
value: address ? address.addressType : '',
options: { label: 'name', value: 'id', data: this.clientAddressTemplate.addressTypeIdOptions },
order: 1
})
: null
);
}
formfields.push(this.isFieldEnabled('street') ? new InputBase({
controlName: 'street',
label: this.translateService.instant('labels.inputs.Street'),
value: address ? address.street : '',
type: 'text',
required: false,
order: 2
}) : null);
formfields.push(this.isFieldEnabled('addressLine1') ? new InputBase({
controlName: 'addressLine1',
label: this.translateService.instant('labels.inputs.Address Line') + ' 1',
value: address ? address.addressLine1 : '',
type: 'text',
order: 3
}) : null);
formfields.push(this.isFieldEnabled('addressLine2') ? new InputBase({
controlName: 'addressLine2',
label: this.translateService.instant('labels.inputs.Address Line') + ' 2',
value: address ? address.addressLine2 : '',
type: 'text',
order: 4
}) : null);
formfields.push(this.isFieldEnabled('addressLine3') ? new InputBase({
controlName: 'addressLine3',
label: this.translateService.instant('labels.inputs.Address Line') + ' 3',
value: address ? address.addressLine3 : '',
type: 'text',
order: 5
}) : null);
formfields.push(this.isFieldEnabled('townVillage') ? new InputBase({
controlName: 'townVillage',
label: this.translateService.instant('labels.inputs.Town / Village'),
value: address ? address.townVillage : '',
type: 'text',
order: 6
}) : null);
formfields.push(this.isFieldEnabled('city') ? new InputBase({
controlName: 'city',
label: this.translateService.instant('labels.inputs.City'),
value: address ? address.city : '',
type: 'text',
order: 7
}) : null);
formfields.push(this.isFieldEnabled('stateProvinceId') ? new SelectBase({
controlName: 'stateProvinceId',
label: this.translateService.instant('labels.inputs.State / Province'),
value: address ? address.stateProvinceId : '',
options: { label: 'name', value: 'id', data: this.clientAddressTemplate.stateProvinceIdOptions },
order: 8
}) : null);
formfields.push(this.isFieldEnabled('countyDistrict') ? new InputBase({
controlName: 'countryDistrict',
label: this.translateService.instant('labels.inputs.State / Province'),
value: address ? address.countyDistrict : '',
type: 'text',
order: 11
}) : null);
formfields.push(this.isFieldEnabled('countryId') ? new SelectBase({
controlName: 'countryId',
label: this.translateService.instant('labels.inputs.Country'),
value: address ? address.countryId : '',
options: { label: 'name', value: 'id', data: this.clientAddressTemplate.countryIdOptions },
order: 10
}) : null);
formfields.push(this.isFieldEnabled('postalCode') ? new InputBase({
controlName: 'postalCode',
label: this.translateService.instant('labels.inputs.Postal Code'),
value: address ? address.postalCode : '',
type: 'text',
order: 11
}) : null);
formfields = formfields.filter(field => field !== null);
formfields.push(
this.isFieldEnabled('street')
? new InputBase({
controlName: 'street',
label: this.translateService.instant('labels.inputs.Street'),
value: address ? address.street : '',
type: 'text',
required: false,
order: 2
})
: null
);
formfields.push(
this.isFieldEnabled('addressLine1')
? new InputBase({
controlName: 'addressLine1',
label: this.translateService.instant('labels.inputs.Address Line') + ' 1',
value: address ? address.addressLine1 : '',
type: 'text',
order: 3
})
: null
);
formfields.push(
this.isFieldEnabled('addressLine2')
? new InputBase({
controlName: 'addressLine2',
label: this.translateService.instant('labels.inputs.Address Line') + ' 2',
value: address ? address.addressLine2 : '',
type: 'text',
order: 4
})
: null
);
formfields.push(
this.isFieldEnabled('addressLine3')
? new InputBase({
controlName: 'addressLine3',
label: this.translateService.instant('labels.inputs.Address Line') + ' 3',
value: address ? address.addressLine3 : '',
type: 'text',
order: 5
})
: null
);
formfields.push(
this.isFieldEnabled('townVillage')
? new InputBase({
controlName: 'townVillage',
label: this.translateService.instant('labels.inputs.Town / Village'),
value: address ? address.townVillage : '',
type: 'text',
order: 6
})
: null
);
formfields.push(
this.isFieldEnabled('city')
? new InputBase({
controlName: 'city',
label: this.translateService.instant('labels.inputs.City'),
value: address ? address.city : '',
type: 'text',
order: 7
})
: null
);
formfields.push(
this.isFieldEnabled('stateProvinceId')
? new SelectBase({
controlName: 'stateProvinceId',
label: this.translateService.instant('labels.inputs.State / Province'),
value: address ? address.stateProvinceId : '',
options: { label: 'name', value: 'id', data: this.clientAddressTemplate.stateProvinceIdOptions },
order: 8
})
: null
);
formfields.push(
this.isFieldEnabled('countyDistrict')
? new InputBase({
controlName: 'countryDistrict',
label: this.translateService.instant('labels.inputs.State / Province'),
value: address ? address.countyDistrict : '',
type: 'text',
order: 11
})
: null
);
formfields.push(
this.isFieldEnabled('countryId')
? new SelectBase({
controlName: 'countryId',
label: this.translateService.instant('labels.inputs.Country'),
value: address ? address.countryId : '',
options: { label: 'name', value: 'id', data: this.clientAddressTemplate.countryIdOptions },
order: 10
})
: null
);
formfields.push(
this.isFieldEnabled('postalCode')
? new InputBase({
controlName: 'postalCode',
label: this.translateService.instant('labels.inputs.Postal Code'),
value: address ? address.postalCode : '',
type: 'text',
order: 11
})
: null
);
formfields = formfields.filter((field) => field !== null);
return formfields;
}
}
@@ -13,19 +13,17 @@ import { ClientsService } from '../../../clients.service';
*/
@Injectable()
export class ClientChargeOverviewResolver implements Resolve<Object> {
/**
* @param {ClientsService} ClientsService Clients service.
*/
constructor(private clientsService: ClientsService) {}
/**
* @param {ClientsService} ClientsService Clients service.
*/
constructor(private clientsService: ClientsService) { }
/**
* Returns the Client Charge data.
* @returns {Observable<any>}
*/
resolve(route: ActivatedRouteSnapshot): Observable<any> {
const clientId = route.parent.params.clientId;
return this.clientsService.getAllClientCharges(clientId);
}
/**
* Returns the Client Charge data.
* @returns {Observable<any>}
*/
resolve(route: ActivatedRouteSnapshot): Observable<any> {
const clientId = route.parent.params.clientId;
return this.clientsService.getAllClientCharges(clientId);
}
}
@@ -8,9 +8,8 @@ describe('ChargesOverviewComponent', () => {
beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [ ChargesOverviewComponent ]
})
.compileComponents();
declarations: [ChargesOverviewComponent]
}).compileComponents();
}));
beforeEach(() => {
@@ -14,9 +14,15 @@ import { ActivatedRoute } from '@angular/router';
styleUrls: ['./charges-overview.component.scss']
})
export class ChargesOverviewComponent implements OnInit {
/** Columns to be displayed in charge overview table. */
displayedColumns: string[] = ['name', 'dueAsOf', 'due', 'paid', 'waived', 'outstanding'];
displayedColumns: string[] = [
'name',
'dueAsOf',
'due',
'paid',
'waived',
'outstanding'
];
/** Data source for charge overview table. */
dataSource: MatTableDataSource<any>;
/** Charge Overview data */
@@ -30,10 +36,12 @@ export class ChargesOverviewComponent implements OnInit {
* @param {ActivatedRoute} route Activated Route.
* @param {MatDialog} dialog Dialog reference.
*/
constructor(private route: ActivatedRoute,
public dialog: MatDialog) {
this.route.data.subscribe((data: { clientChargesData: any }) => {
this.chargeOverviewData = data.clientChargesData;
constructor(
private route: ActivatedRoute,
public dialog: MatDialog
) {
this.route.data.subscribe((data: { clientChargesData: any }) => {
this.chargeOverviewData = data.clientChargesData;
});
}
@@ -48,5 +56,4 @@ export class ChargesOverviewComponent implements OnInit {
this.dataSource = new MatTableDataSource(this.chargeOverviewData.pageItems);
this.dataSource.paginator = this.paginator;
}
}
@@ -8,9 +8,8 @@ describe('ClientPayChargesComponent', () => {
beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [ ClientPayChargesComponent ]
})
.compileComponents();
declarations: [ClientPayChargesComponent]
}).compileComponents();
}));
beforeEach(() => {
@@ -17,7 +17,6 @@ import { SettingsService } from 'app/settings/settings.service';
styleUrls: ['./client-pay-charges.component.scss']
})
export class ClientPayChargesComponent implements OnInit {
/** Transaction Form. */
transactionForm: any;
/** Transaction Data. */
@@ -25,14 +24,14 @@ export class ClientPayChargesComponent implements OnInit {
/** Minimum Date allowed. */
minDate = new Date(2000, 0, 1);
/**
* Retrieves the charge data from `resolve`.
* @param {ClientService} clientService Products Service.
* @param {FormBuilder} formBuilder Form Builder.
* @param {ActivatedRoute} route Activated Route.
* @param {Router} router Router for navigation.
* @param {SettingsService} settingsService Setting service
*/
/**
* Retrieves the charge data from `resolve`.
* @param {ClientService} clientService Products Service.
* @param {FormBuilder} formBuilder Form Builder.
* @param {ActivatedRoute} route Activated Route.
* @param {Router} router Router for navigation.
* @param {SettingsService} settingsService Setting service
*/
constructor(
private clientsService: ClientsService,
private formBuilder: UntypedFormBuilder,
@@ -55,8 +54,14 @@ export class ClientPayChargesComponent implements OnInit {
*/
setTransactionForm() {
this.transactionForm = this.formBuilder.group({
'amount': [this.transactionData.amount, Validators.required],
'transactionDate': [new Date(), Validators.required]
amount: [
this.transactionData.amount,
Validators.required
],
transactionDate: [
new Date(),
Validators.required
]
});
}
@@ -77,8 +82,13 @@ export class ClientPayChargesComponent implements OnInit {
locale
};
this.clientsService.payClientCharge(this.transactionData.clientId, this.transactionData.id, data).subscribe(() => {
this.router.navigate(['../../..', 'general'], { relativeTo: this.route });
this.router.navigate(
[
'../../..',
'general'
],
{ relativeTo: this.route }
);
});
}
}
@@ -8,9 +8,8 @@ describe('ViewChargeComponent', () => {
beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [ ViewChargeComponent ]
})
.compileComponents();
declarations: [ViewChargeComponent]
}).compileComponents();
}));
beforeEach(() => {
@@ -12,30 +12,38 @@ import { ClientsService } from 'app/clients/clients.service';
styleUrls: ['./view-charge.component.scss']
})
export class ViewChargeComponent {
/** Charge Data. */
chargeData: any;
/** Mat Table Column defs. */
viewChargeTableColumns: string[] = ['id', 'officeName', 'type', 'transactionDate', 'amount', 'actions'];
viewChargeTableColumns: string[] = [
'id',
'officeName',
'type',
'transactionDate',
'amount',
'actions'
];
/**
* Retrieves the selected job data from `resolve`.
* @param {ActivatedRoute} route Activated Route.
* @param {Router} router Router for navigation.
*/
constructor(private route: ActivatedRoute,
private router: Router,
private clientService: ClientsService) {
constructor(
private route: ActivatedRoute,
private router: Router,
private clientService: ClientsService
) {
this.route.data.subscribe((data: { clientChargeData: any }) => {
this.chargeData = data.clientChargeData;
});
}
}
/**
* Waive Charge.
*/
waiveCharge() {
const waiveChargeObj = { clientId: this.chargeData.clientId, resourceType: this.chargeData.id};
const waiveChargeObj = { clientId: this.chargeData.clientId, resourceType: this.chargeData.id };
this.clientService.waiveClientCharge(waiveChargeObj).subscribe(() => {
this.getChargeData();
});
@@ -45,7 +53,7 @@ export class ViewChargeComponent {
* Undo Transaction.
*/
undoTransaction(transactionId: any) {
const transactionData = { clientId: this.chargeData.clientId.toString(), transactionId: transactionId};
const transactionData = { clientId: this.chargeData.clientId.toString(), transactionId: transactionId };
this.clientService.undoTransaction(transactionData).subscribe(() => {
this.getChargeData();
});
@@ -65,8 +73,11 @@ export class ViewChargeComponent {
*/
deleteCharge() {
this.clientService.deleteCharge(this.chargeData.clientId, this.chargeData.id).subscribe(() => {
this.router.navigate(['../../clients', this.chargeData.clientId, 'general']);
this.router.navigate([
'../../clients',
this.chargeData.clientId,
'general'
]);
});
}
}
@@ -8,9 +8,8 @@ describe('AcceptClientTransferComponent', () => {
beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [ AcceptClientTransferComponent ]
})
.compileComponents();
declarations: [AcceptClientTransferComponent]
}).compileComponents();
}));
beforeEach(() => {
@@ -17,7 +17,6 @@ import { SettingsService } from 'app/settings/settings.service';
styleUrls: ['./accept-client-transfer.component.scss']
})
export class AcceptClientTransferComponent implements OnInit {
/** Accept Client Transfer form. */
acceptClientTransferForm: UntypedFormGroup;
/** Client Id */
@@ -33,12 +32,14 @@ export class AcceptClientTransferComponent implements OnInit {
* @param {ActivatedRoute} route Activated Route
* @param {Router} router Router
*/
constructor(private formBuilder: UntypedFormBuilder,
private clientsService: ClientsService,
private settingsService: SettingsService,
private dateUtils: Dates,
private route: ActivatedRoute,
private router: Router) {
constructor(
private formBuilder: UntypedFormBuilder,
private clientsService: ClientsService,
private settingsService: SettingsService,
private dateUtils: Dates,
private route: ActivatedRoute,
private router: Router
) {
this.route.data.subscribe((data: { clientActionData: any }) => {
this.transferDate = data.clientActionData;
});
@@ -57,8 +58,8 @@ export class AcceptClientTransferComponent implements OnInit {
*/
createAcceptClientTransferForm() {
this.acceptClientTransferForm = this.formBuilder.group({
'transferDate': {value: new Date(this.transferDate), disabled: true},
'note': ['']
transferDate: { value: new Date(this.transferDate), disabled: true },
note: ['']
});
}
@@ -74,11 +75,10 @@ export class AcceptClientTransferComponent implements OnInit {
acceptClientTransferFormData.transferDate = this.dateUtils.formatDate(prevTransferDate, dateFormat);
}
const data = {
...acceptClientTransferFormData,
...acceptClientTransferFormData
};
this.clientsService.executeClientCommand(this.clientId, 'acceptTransfer', data).subscribe(() => {
this.router.navigate(['../../'], { relativeTo: this.route });
});
}
}
@@ -8,9 +8,8 @@ describe('ActivateClientComponent', () => {
beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [ ActivateClientComponent ]
})
.compileComponents();
declarations: [ActivateClientComponent]
}).compileComponents();
}));
beforeEach(() => {
@@ -17,7 +17,6 @@ import { SettingsService } from 'app/settings/settings.service';
styleUrls: ['./activate-client.component.scss']
})
export class ActivateClientComponent implements OnInit {
/** Minimum date allowed. */
minDate = new Date(2000, 0, 1);
/** Maximum date allowed. */
@@ -35,12 +34,14 @@ export class ActivateClientComponent implements OnInit {
* @param {Router} router Router
* @param {SettingsService} settingsService Settings Service
*/
constructor(private formBuilder: UntypedFormBuilder,
private clientsService: ClientsService,
private dateUtils: Dates,
private route: ActivatedRoute,
private router: Router,
private settingsService: SettingsService) {
constructor(
private formBuilder: UntypedFormBuilder,
private clientsService: ClientsService,
private dateUtils: Dates,
private route: ActivatedRoute,
private router: Router,
private settingsService: SettingsService
) {
this.clientId = this.route.parent.snapshot.params['clientId'];
}
@@ -57,7 +58,10 @@ export class ActivateClientComponent implements OnInit {
*/
createActivateClientForm() {
this.activateClientForm = this.formBuilder.group({
'activationDate': ['', Validators.required]
activationDate: [
'',
Validators.required
]
});
}
@@ -82,5 +86,4 @@ export class ActivateClientComponent implements OnInit {
this.router.navigate(['../../'], { relativeTo: this.route });
});
}
}
@@ -8,9 +8,8 @@ describe('AddClientChargeComponent', () => {
beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [ AddClientChargeComponent ]
})
.compileComponents();
declarations: [AddClientChargeComponent]
}).compileComponents();
}));
beforeEach(() => {
@@ -17,7 +17,6 @@ import { SettingsService } from 'app/settings/settings.service';
styleUrls: ['./add-client-charge.component.scss']
})
export class AddClientChargeComponent implements OnInit {
/** Minimum Due Date allowed. */
minDate = new Date(2000, 0, 1);
/** Maximum Due Date allowed. */
@@ -64,7 +63,7 @@ export class AddClientChargeComponent implements OnInit {
* Subscribe to form controls value changes
*/
buildDependencies() {
this.clientChargeForm.controls.chargeId.valueChanges.subscribe(chargeId => {
this.clientChargeForm.controls.chargeId.valueChanges.subscribe((chargeId) => {
this.clientsService.getChargeAndTemplate(chargeId).subscribe((data: any) => {
this.chargeDetails = data;
const chargeTimeType = data.chargeTimeType.id;
@@ -85,14 +84,17 @@ export class AddClientChargeComponent implements OnInit {
this.clientChargeForm.removeControl('feeOnMonthDay');
}
if (chargeTimeType.value === 'Monthly Fee') {
this.clientChargeForm.addControl('feeInterval', new UntypedFormControl(data.feeInterval, Validators.required));
this.clientChargeForm.addControl(
'feeInterval',
new UntypedFormControl(data.feeInterval, Validators.required)
);
} else {
this.clientChargeForm.removeControl('feeInterval');
}
this.clientChargeForm.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 AddClientChargeComponent implements OnInit {
*/
createClientsChargeForm() {
this.clientChargeForm = 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 }]
});
}
@@ -136,9 +144,8 @@ export class AddClientChargeComponent implements OnInit {
}
}
}
this.clientsService.createClientCharge(this.clientId, clientCharge).subscribe( () => {
this.clientsService.createClientCharge(this.clientId, clientCharge).subscribe(() => {
this.router.navigate(['../../'], { relativeTo: this.route });
});
}
}
@@ -8,9 +8,8 @@ describe('AddClientCollateralComponent', () => {
beforeEach(async () => {
await TestBed.configureTestingModule({
declarations: [ AddClientCollateralComponent ]
})
.compileComponents();
declarations: [AddClientCollateralComponent]
}).compileComponents();
});
beforeEach(() => {
@@ -16,7 +16,6 @@ import { SettingsService } from 'app/settings/settings.service';
styleUrls: ['./add-client-collateral.component.scss']
})
export class AddClientCollateralComponent implements OnInit {
/** Client Collateral Form */
clientCollateralForm: UntypedFormGroup;
/** Client Collateral Options */
@@ -39,13 +38,13 @@ export class AddClientCollateralComponent implements OnInit {
private router: Router,
private productsService: ProductsService,
private clientsService: ClientsService,
private settingsService: SettingsService,
) {
this.route.data.subscribe((data: { clientActionData: any }) => {
this.clientCollateralOptions = data.clientActionData;
});
this.clientId = this.route.parent.snapshot.params['clientId'];
}
private settingsService: SettingsService
) {
this.route.data.subscribe((data: { clientActionData: any }) => {
this.clientCollateralOptions = data.clientActionData;
});
this.clientId = this.route.parent.snapshot.params['clientId'];
}
ngOnInit(): void {
this.createClientCollateralForm();
@@ -56,22 +55,22 @@ export class AddClientCollateralComponent implements OnInit {
* Subscribe to Form controls value changes
*/
buildDependencies() {
this.clientCollateralForm.controls.collateralId.valueChanges.subscribe(collateralId => {
this.clientCollateralForm.controls.collateralId.valueChanges.subscribe((collateralId) => {
this.productsService.getCollateral(collateralId).subscribe((data: any) => {
this.collateralDetails = data;
this.clientCollateralForm.patchValue({
'name': data.name,
'quality': data.quality,
'unitType': data.unitType,
'basePrice': this.collateralDetails.basePrice,
'pctToBase': this.collateralDetails.pctToBase,
name: data.name,
quality: data.quality,
unitType: data.unitType,
basePrice: this.collateralDetails.basePrice,
pctToBase: this.collateralDetails.pctToBase
});
});
});
this.clientCollateralForm.controls.quantity.valueChanges.subscribe((quantity: any) => {
this.clientCollateralForm.patchValue({
'totalValue': this.collateralDetails.basePrice * quantity,
'totalCollateralValue': this.collateralDetails.basePrice * this.collateralDetails.pctToBase * quantity / 100
totalValue: this.collateralDetails.basePrice * quantity,
totalCollateralValue: (this.collateralDetails.basePrice * this.collateralDetails.pctToBase * quantity) / 100
});
});
}
@@ -81,15 +80,21 @@ export class AddClientCollateralComponent implements OnInit {
*/
createClientCollateralForm() {
this.clientCollateralForm = this.formBuilder.group({
'collateralId': [ '', Validators.required ],
'quantity': [ '', Validators.required ],
'name': [{ value: '', disabled: true }],
'quality': [{value: '', disabled: true}],
'unitType': [{value: '', disabled: true}],
'basePrice': [{value: '', disabled: true}],
'pctToBase': [{value: '', disabled: true}],
'totalValue': [{value: '', disabled: true}],
'totalCollateralValue': [{value: '', disabled: true}],
collateralId: [
'',
Validators.required
],
quantity: [
'',
Validators.required
],
name: [{ value: '', disabled: true }],
quality: [{ value: '', disabled: true }],
unitType: [{ value: '', disabled: true }],
basePrice: [{ value: '', disabled: true }],
pctToBase: [{ value: '', disabled: true }],
totalValue: [{ value: '', disabled: true }],
totalCollateralValue: [{ value: '', disabled: true }]
});
}
@@ -106,8 +111,7 @@ export class AddClientCollateralComponent implements OnInit {
locale
};
this.clientsService.createClientCollateral(this.clientId, clientCollateral).subscribe(() => {
this.router.navigate(['../../'], {relativeTo: this.route});
this.router.navigate(['../../'], { relativeTo: this.route });
});
}
}
@@ -8,9 +8,8 @@ describe('ClientActionsComponent', () => {
beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [ ClientActionsComponent ]
})
.compileComponents();
declarations: [ClientActionsComponent]
}).compileComponents();
}));
beforeEach(() => {
@@ -11,38 +11,37 @@ import { ActivatedRoute, Router } from '@angular/router';
styleUrls: ['./client-actions.component.scss']
})
export class ClientActionsComponent {
/** Flag object to store possible actions and render appropriate UI to the user */
actions: {
'Assign Staff': boolean
'Close': boolean
'Reject': boolean
'Survey': boolean
'Withdraw': boolean
'Update Default Savings': boolean
'Transfer Client': boolean
'Undo Transfer': boolean
'Accept Transfer': boolean
'Reject Transfer': boolean
'Reactivate': boolean
'Undo Rejection': boolean
'Add Charge': boolean
'Take Survey': boolean
'Client Screen Reports': boolean,
'Create Self Service User': boolean,
'Create Collateral': boolean
'Assign Staff': boolean;
Close: boolean;
Reject: boolean;
Survey: boolean;
Withdraw: boolean;
'Update Default Savings': boolean;
'Transfer Client': boolean;
'Undo Transfer': boolean;
'Accept Transfer': boolean;
'Reject Transfer': boolean;
Reactivate: boolean;
'Undo Rejection': boolean;
'Add Charge': boolean;
'Take Survey': boolean;
'Client Screen Reports': boolean;
'Create Self Service User': boolean;
'Create Collateral': boolean;
} = {
'Assign Staff': false,
'Close': false,
'Reject': false,
'Survey': false,
'Withdraw': false,
Close: false,
Reject: false,
Survey: false,
Withdraw: false,
'Update Default Savings': false,
'Transfer Client': false,
'Undo Transfer': false,
'Accept Transfer': false,
'Reject Transfer': false,
'Reactivate': false,
Reactivate: false,
'Undo Rejection': false,
'Add Charge': false,
'Take Survey': false,
@@ -55,11 +54,12 @@ export class ClientActionsComponent {
* @param {ActivatedRoute} route Activated Route
* @param {Router} router Router
*/
constructor(private route: ActivatedRoute,
private router: Router) {
constructor(
private route: ActivatedRoute,
private router: Router
) {
this.router.routeReuseStrategy.shouldReuseRoute = () => false;
const name = this.route.snapshot.params['name'];
this.actions[name] = true;
}
}
@@ -8,9 +8,8 @@ describe('ClientAssignStaffComponent', () => {
beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [ ClientAssignStaffComponent ]
})
.compileComponents();
declarations: [ClientAssignStaffComponent]
}).compileComponents();
}));
beforeEach(() => {
@@ -15,7 +15,6 @@ import { ClientsService } from 'app/clients/clients.service';
styleUrls: ['./client-assign-staff.component.scss']
})
export class ClientAssignStaffComponent implements OnInit {
/** Client Assign Staff form. */
clientAssignStaffForm: UntypedFormGroup;
/** Staff Data */
@@ -30,10 +29,12 @@ export class ClientAssignStaffComponent implements OnInit {
* @param {ActivatedRoute} route Activated Route
* @param {Router} router Router
*/
constructor(private formBuilder: UntypedFormBuilder,
private clientsService: ClientsService,
private route: ActivatedRoute,
private router: Router) {
constructor(
private formBuilder: UntypedFormBuilder,
private clientsService: ClientsService,
private route: ActivatedRoute,
private router: Router
) {
this.route.data.subscribe((data: { clientActionData: any }) => {
this.clientData = data.clientActionData;
});
@@ -52,7 +53,7 @@ export class ClientAssignStaffComponent implements OnInit {
*/
createClientAssignStaffForm() {
this.clientAssignStaffForm = this.formBuilder.group({
'staffId': ['']
staffId: ['']
});
}
@@ -60,10 +61,10 @@ export class ClientAssignStaffComponent implements OnInit {
* Submits the form and assigns staff for the client.
*/
submit() {
this.clientsService.executeClientCommand(this.clientData.id, 'assignStaff', this.clientAssignStaffForm.value)
this.clientsService
.executeClientCommand(this.clientData.id, 'assignStaff', this.clientAssignStaffForm.value)
.subscribe(() => {
this.router.navigate(['../../'], { relativeTo: this.route });
});
}
}
@@ -8,9 +8,8 @@ describe('ClientScreenReportsComponent', () => {
beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [ ClientScreenReportsComponent ]
})
.compileComponents();
declarations: [ClientScreenReportsComponent]
}).compileComponents();
}));
beforeEach(() => {
@@ -16,7 +16,6 @@ import { DomSanitizer } from '@angular/platform-browser';
styleUrls: ['./client-screen-reports.component.scss']
})
export class ClientScreenReportsComponent implements OnInit {
/** Client Screen Reportform. */
clientScreenReportForm: UntypedFormGroup;
/** Templates Data */
@@ -37,11 +36,13 @@ export class ClientScreenReportsComponent implements OnInit {
* @param {DomSanitizer} sanitizer DOM Sanitizer
* @param {Renderer2} renderer Renderer 2
*/
constructor(private formBuilder: UntypedFormBuilder,
private clientsService: ClientsService,
private route: ActivatedRoute,
private sanitizer: DomSanitizer,
private renderer: Renderer2) {
constructor(
private formBuilder: UntypedFormBuilder,
private clientsService: ClientsService,
private route: ActivatedRoute,
private sanitizer: DomSanitizer,
private renderer: Renderer2
) {
this.route.data.subscribe((data: { clientActionData: any }) => {
this.templatesData = data.clientActionData;
});
@@ -60,7 +61,7 @@ export class ClientScreenReportsComponent implements OnInit {
*/
createClientScreenReportForm() {
this.clientScreenReportForm = this.formBuilder.group({
'templateId': ['']
templateId: ['']
});
}
@@ -87,5 +88,4 @@ export class ClientScreenReportsComponent implements OnInit {
this.renderer.setProperty(this.screenReportRef.nativeElement, 'innerHTML', this.template);
});
}
}
@@ -8,9 +8,8 @@ describe('CloseClientComponent', () => {
beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [ CloseClientComponent ]
})
.compileComponents();
declarations: [CloseClientComponent]
}).compileComponents();
}));
beforeEach(() => {
@@ -17,7 +17,6 @@ import { SettingsService } from 'app/settings/settings.service';
styleUrls: ['./close-client.component.scss']
})
export class CloseClientComponent implements OnInit {
/** Minimum date allowed. */
minDate = new Date(2000, 0, 1);
/** Maximum date allowed. */
@@ -37,12 +36,14 @@ export class CloseClientComponent implements OnInit {
* @param {Router} router Router
* @param {SettingsService} settingsService Setting service
*/
constructor(private formBuilder: UntypedFormBuilder,
private clientsService: ClientsService,
private dateUtils: Dates,
private route: ActivatedRoute,
private router: Router,
private settingsService: SettingsService) {
constructor(
private formBuilder: UntypedFormBuilder,
private clientsService: ClientsService,
private dateUtils: Dates,
private route: ActivatedRoute,
private router: Router,
private settingsService: SettingsService
) {
this.route.data.subscribe((data: { clientActionData: any }) => {
this.closureData = data.clientActionData.narrations;
});
@@ -59,8 +60,14 @@ export class CloseClientComponent implements OnInit {
*/
createCloseClientForm() {
this.closeClientForm = this.formBuilder.group({
'closureDate': ['', Validators.required],
'closureReasonId': ['', Validators.required]
closureDate: [
'',
Validators.required
],
closureReasonId: [
'',
Validators.required
]
});
}
@@ -84,5 +91,4 @@ export class CloseClientComponent implements OnInit {
this.router.navigate(['../../'], { relativeTo: this.route });
});
}
}
@@ -8,9 +8,8 @@ describe('CreateSelfServiceUserComponent', () => {
beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [ CreateSelfServiceUserComponent ]
})
.compileComponents();
declarations: [CreateSelfServiceUserComponent]
}).compileComponents();
}));
beforeEach(() => {
@@ -1,6 +1,14 @@
/** Angular Imports. */
import { Component, OnInit } from '@angular/core';
import { UntypedFormBuilder, UntypedFormGroup, UntypedFormControl, Validators, AbstractControl, ValidationErrors, ValidatorFn } from '@angular/forms';
import {
UntypedFormBuilder,
UntypedFormGroup,
UntypedFormControl,
Validators,
AbstractControl,
ValidationErrors,
ValidatorFn
} from '@angular/forms';
import { ActivatedRoute, Router } from '@angular/router';
import { Subscription } from 'rxjs';
@@ -14,17 +22,18 @@ import { PasswordsUtility } from 'app/core/utils/passwords-utility';
styleUrls: ['./create-self-service-user.component.scss']
})
export class CreateSelfServiceUserComponent implements OnInit {
createSelfServiceForm: UntypedFormGroup;
clientData: any;
hidePasswordField = true;
constructor(private formBuilder: UntypedFormBuilder,
private route: ActivatedRoute,
private clientService: ClientsService,
private router: Router,
private passwordsUtility: PasswordsUtility) {
this.route.data.subscribe((data: { clientActionData: any}) => {
constructor(
private formBuilder: UntypedFormBuilder,
private route: ActivatedRoute,
private clientService: ClientsService,
private router: Router,
private passwordsUtility: PasswordsUtility
) {
this.route.data.subscribe((data: { clientActionData: any }) => {
this.clientData = data.clientActionData;
});
}
@@ -45,8 +54,16 @@ export class CreateSelfServiceUserComponent implements OnInit {
this.createSelfServiceForm.removeControl('repeatPassword');
} else {
this.hidePasswordField = false;
this.createSelfServiceForm.addControl('password', new UntypedFormControl('', this.passwordsUtility.getPasswordValidators()));
this.createSelfServiceForm.addControl('repeatPassword', new UntypedFormControl('', [Validators.required, this.passwordsUtility.confirmPassword('password')]));
this.createSelfServiceForm.addControl(
'password',
new UntypedFormControl('', this.passwordsUtility.getPasswordValidators())
);
this.createSelfServiceForm.addControl(
'repeatPassword',
new UntypedFormControl('', [
Validators.required,
this.passwordsUtility.confirmPassword('password')])
);
}
});
}
@@ -56,13 +73,19 @@ export class CreateSelfServiceUserComponent implements OnInit {
*/
createSelfServiceUser() {
this.createSelfServiceForm = this.formBuilder.group({
'username': new UntypedFormControl('', [Validators.required]),
'firstname': new UntypedFormControl(this.clientData.firstname, [Validators.required]),
'lastname': new UntypedFormControl(this.clientData.lastname, [Validators.required]),
'email': new UntypedFormControl('', [Validators.required, Validators.email]),
'sendPasswordToEmail': new UntypedFormControl(true),
'passwordNeverExpires': new UntypedFormControl(false),
'status': new UntypedFormControl({value: this.clientData.subStatus.active ? 'Active' : 'Inactive', disabled: true})
username: new UntypedFormControl('', [Validators.required]),
firstname: new UntypedFormControl(this.clientData.firstname, [Validators.required]),
lastname: new UntypedFormControl(this.clientData.lastname, [Validators.required]),
email: new UntypedFormControl('', [
Validators.required,
Validators.email
]),
sendPasswordToEmail: new UntypedFormControl(true),
passwordNeverExpires: new UntypedFormControl(false),
status: new UntypedFormControl({
value: this.clientData.subStatus.active ? 'Active' : 'Inactive',
disabled: true
})
});
}
@@ -75,8 +98,7 @@ export class CreateSelfServiceUserComponent implements OnInit {
}
const clientId = this.clientData.id.toString();
const selfServiceForm = this.createSelfServiceForm.value;
selfServiceForm.roles = [2],
selfServiceForm.isSelfServiceUser = true;
(selfServiceForm.roles = [2]), (selfServiceForm.isSelfServiceUser = true);
selfServiceForm.staffId = this.clientData.staffId;
selfServiceForm.clients = [clientId];
selfServiceForm.officeId = this.clientData.officeId;
@@ -84,5 +106,4 @@ export class CreateSelfServiceUserComponent implements OnInit {
this.router.navigate(['../../general'], { relativeTo: this.route });
});
}
}
@@ -8,9 +8,8 @@ describe('ReactivateClientComponent', () => {
beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [ ReactivateClientComponent ]
})
.compileComponents();
declarations: [ReactivateClientComponent]
}).compileComponents();
}));
beforeEach(() => {
@@ -17,7 +17,6 @@ import { SettingsService } from 'app/settings/settings.service';
styleUrls: ['./reactivate-client.component.scss']
})
export class ReactivateClientComponent implements OnInit {
/** Minimum date allowed. */
minDate = new Date(2000, 0, 1);
/** Maximum date allowed. */
@@ -35,12 +34,14 @@ export class ReactivateClientComponent implements OnInit {
* @param {Router} router Router
* @param {SettingsService} settingsService Setting service
*/
constructor(private formBuilder: UntypedFormBuilder,
private clientsService: ClientsService,
private dateUtils: Dates,
private route: ActivatedRoute,
private router: Router,
private settingsService: SettingsService) {
constructor(
private formBuilder: UntypedFormBuilder,
private clientsService: ClientsService,
private dateUtils: Dates,
private route: ActivatedRoute,
private router: Router,
private settingsService: SettingsService
) {
this.clientId = this.route.parent.snapshot.params['clientId'];
}
@@ -57,7 +58,10 @@ export class ReactivateClientComponent implements OnInit {
*/
createReactivateClientForm() {
this.reactivateClientForm = this.formBuilder.group({
'reactivationDate': ['', Validators.required]
reactivationDate: [
'',
Validators.required
]
});
}
@@ -82,5 +86,4 @@ export class ReactivateClientComponent implements OnInit {
this.router.navigate(['../../'], { relativeTo: this.route });
});
}
}
@@ -8,9 +8,8 @@ describe('RejectClientTransferComponent', () => {
beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [ RejectClientTransferComponent ]
})
.compileComponents();
declarations: [RejectClientTransferComponent]
}).compileComponents();
}));
beforeEach(() => {
@@ -17,7 +17,6 @@ import { SettingsService } from 'app/settings/settings.service';
styleUrls: ['./reject-client-transfer.component.scss']
})
export class RejectClientTransferComponent implements OnInit {
/** Reject Client Transfer form. */
rejectClientTransferForm: UntypedFormGroup;
/** Client Id */
@@ -31,12 +30,14 @@ export class RejectClientTransferComponent implements OnInit {
* @param {ActivatedRoute} route Activated Route
* @param {Router} router Router
*/
constructor(private formBuilder: UntypedFormBuilder,
private clientsService: ClientsService,
private settingsService: SettingsService,
private dateUtils: Dates,
private route: ActivatedRoute,
private router: Router) {
constructor(
private formBuilder: UntypedFormBuilder,
private clientsService: ClientsService,
private settingsService: SettingsService,
private dateUtils: Dates,
private route: ActivatedRoute,
private router: Router
) {
this.route.data.subscribe((data: { clientActionData: any }) => {
this.transferDate = data.clientActionData;
});
@@ -52,8 +53,8 @@ export class RejectClientTransferComponent implements OnInit {
*/
createRejectClientTransferForm() {
this.rejectClientTransferForm = this.formBuilder.group({
'transferDate': {value: new Date(this.transferDate), disabled: true},
'note': ['']
transferDate: { value: new Date(this.transferDate), disabled: true },
note: ['']
});
}
@@ -76,5 +77,4 @@ export class RejectClientTransferComponent implements OnInit {
this.router.navigate(['../../'], { relativeTo: this.route });
});
}
}
@@ -8,9 +8,8 @@ describe('RejectClientComponent', () => {
beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [ RejectClientComponent ]
})
.compileComponents();
declarations: [RejectClientComponent]
}).compileComponents();
}));
beforeEach(() => {
@@ -17,7 +17,6 @@ import { SettingsService } from 'app/settings/settings.service';
styleUrls: ['./reject-client.component.scss']
})
export class RejectClientComponent implements OnInit {
/** Minimum date allowed. */
minDate = new Date(2000, 0, 1);
/** Maximum date allowed. */
@@ -37,12 +36,14 @@ export class RejectClientComponent implements OnInit {
* @param {Router} router Router
* @param {SettingsService} settingsService Setting service
*/
constructor(private formBuilder: UntypedFormBuilder,
private clientsService: ClientsService,
private dateUtils: Dates,
private route: ActivatedRoute,
private router: Router,
private settingsService: SettingsService) {
constructor(
private formBuilder: UntypedFormBuilder,
private clientsService: ClientsService,
private dateUtils: Dates,
private route: ActivatedRoute,
private router: Router,
private settingsService: SettingsService
) {
this.route.data.subscribe((data: { clientActionData: any }) => {
this.rejectionData = data.clientActionData.narrations;
});
@@ -59,8 +60,14 @@ export class RejectClientComponent implements OnInit {
*/
createRejectClientForm() {
this.rejectClientForm = this.formBuilder.group({
'rejectionDate': ['', Validators.required],
'rejectionReasonId': ['', Validators.required]
rejectionDate: [
'',
Validators.required
],
rejectionReasonId: [
'',
Validators.required
]
});
}
@@ -84,5 +91,4 @@ export class RejectClientComponent implements OnInit {
this.router.navigate(['../../'], { relativeTo: this.route });
});
}
}
@@ -8,9 +8,8 @@ describe('TakeSurveyComponent', () => {
beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [ TakeSurveyComponent ]
})
.compileComponents();
declarations: [TakeSurveyComponent]
}).compileComponents();
}));
beforeEach(() => {
@@ -15,7 +15,6 @@ import { AuthenticationService } from '../../../../core/authentication/authentic
styleUrls: ['./take-survey.component.scss']
})
export class TakeSurveyComponent {
/** List of all Survey Data */
allSurveyData: any;
/** User Id */
@@ -28,13 +27,13 @@ export class TakeSurveyComponent {
clientId: any;
/** Stores the value to send to the API */
formData: {
userId: Number,
clientId: Number,
surveyId: Number,
scorecardValues: { questionId: Number, responseId: Number, value: String }[],
surveyName: String,
username: String,
id: Number
userId: Number;
clientId: Number;
surveyId: Number;
scorecardValues: { questionId: Number; responseId: Number; value: String }[];
surveyName: String;
username: String;
id: Number;
};
/**
@@ -44,10 +43,12 @@ export class TakeSurveyComponent {
* @param {Router} router Router
* @param {AuthenticationService} authenticationService AuthenticationService
*/
constructor(private route: ActivatedRoute,
private clientsService: ClientsService,
private router: Router,
private authenticationService: AuthenticationService) {
constructor(
private route: ActivatedRoute,
private clientsService: ClientsService,
private router: Router,
private authenticationService: AuthenticationService
) {
this.route.data.subscribe((data: { clientActionData: any }) => {
this.allSurveyData = data.clientActionData;
this.clientId = this.route.parent.snapshot.params['clientId'];
@@ -82,7 +83,6 @@ export class TakeSurveyComponent {
});
}
/**
* Checks if there is any response or not from the user and enables the submit button accordingly
*/
@@ -127,5 +127,4 @@ export class TakeSurveyComponent {
this.router.navigate(['../../general'], { relativeTo: this.route });
});
}
}
@@ -8,9 +8,8 @@ describe('TransferClientComponent', () => {
beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [ TransferClientComponent ]
})
.compileComponents();
declarations: [TransferClientComponent]
}).compileComponents();
}));
beforeEach(() => {
@@ -17,7 +17,6 @@ import { SettingsService } from 'app/settings/settings.service';
styleUrls: ['./transfer-client.component.scss']
})
export class TransferClientComponent implements OnInit {
/** Minimum date allowed. */
minDate = new Date(2000, 0, 1);
/** Maximum date allowed. */
@@ -37,12 +36,14 @@ export class TransferClientComponent implements OnInit {
* @param {Router} router Router
* @param {SettingsService} settingsService Setting service
*/
constructor(private formBuilder: UntypedFormBuilder,
private clientsService: ClientsService,
private dateUtils: Dates,
private route: ActivatedRoute,
private router: Router,
private settingsService: SettingsService) {
constructor(
private formBuilder: UntypedFormBuilder,
private clientsService: ClientsService,
private dateUtils: Dates,
private route: ActivatedRoute,
private router: Router,
private settingsService: SettingsService
) {
this.route.data.subscribe((data: { clientActionData: any }) => {
this.officeData = data.clientActionData;
});
@@ -59,9 +60,15 @@ export class TransferClientComponent implements OnInit {
*/
createTransferClientForm() {
this.transferClientForm = this.formBuilder.group({
'destinationOfficeId': ['', Validators.required],
'transferDate': ['', Validators.required],
'note': ['']
destinationOfficeId: [
'',
Validators.required
],
transferDate: [
'',
Validators.required
],
note: ['']
});
}
@@ -85,5 +92,4 @@ export class TransferClientComponent implements OnInit {
this.router.navigate(['../../'], { relativeTo: this.route });
});
}
}
@@ -8,9 +8,8 @@ describe('UndoClientRejectionComponent', () => {
beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [ UndoClientRejectionComponent ]
})
.compileComponents();
declarations: [UndoClientRejectionComponent]
}).compileComponents();
}));
beforeEach(() => {
@@ -17,7 +17,6 @@ import { SettingsService } from 'app/settings/settings.service';
styleUrls: ['./undo-client-rejection.component.scss']
})
export class UndoClientRejectionComponent implements OnInit {
/** Minimum date allowed. */
minDate = new Date(2000, 0, 1);
/** Maximum date allowed. */
@@ -34,12 +33,14 @@ export class UndoClientRejectionComponent implements OnInit {
* @param {ActivatedRoute} route Activated Route
* @param {Router} router Router
*/
constructor(private formBuilder: UntypedFormBuilder,
private clientsService: ClientsService,
private dateUtils: Dates,
private route: ActivatedRoute,
private router: Router,
private settingsService: SettingsService) {
constructor(
private formBuilder: UntypedFormBuilder,
private clientsService: ClientsService,
private dateUtils: Dates,
private route: ActivatedRoute,
private router: Router,
private settingsService: SettingsService
) {
this.clientId = this.route.parent.snapshot.params['clientId'];
}
@@ -56,7 +57,10 @@ export class UndoClientRejectionComponent implements OnInit {
*/
createUndoClientRejectionForm() {
this.undoClientRejectionForm = this.formBuilder.group({
'reopenedDate': ['', Validators.required]
reopenedDate: [
'',
Validators.required
]
});
}
@@ -81,5 +85,4 @@ export class UndoClientRejectionComponent implements OnInit {
this.router.navigate(['../../'], { relativeTo: this.route });
});
}
}
@@ -8,9 +8,8 @@ describe('UndoClientTransferComponent', () => {
beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [ UndoClientTransferComponent ]
})
.compileComponents();
declarations: [UndoClientTransferComponent]
}).compileComponents();
}));
beforeEach(() => {
@@ -17,7 +17,6 @@ import { SettingsService } from 'app/settings/settings.service';
styleUrls: ['./undo-client-transfer.component.scss']
})
export class UndoClientTransferComponent implements OnInit {
/** Undo Client Transfer form. */
undoClientTransferForm: UntypedFormGroup;
/** Client Id */
@@ -31,12 +30,14 @@ export class UndoClientTransferComponent implements OnInit {
* @param {ActivatedRoute} route Activated Route
* @param {Router} router Router
*/
constructor(private formBuilder: UntypedFormBuilder,
private clientsService: ClientsService,
private settingsService: SettingsService,
private dateUtils: Dates,
private route: ActivatedRoute,
private router: Router) {
constructor(
private formBuilder: UntypedFormBuilder,
private clientsService: ClientsService,
private settingsService: SettingsService,
private dateUtils: Dates,
private route: ActivatedRoute,
private router: Router
) {
this.route.data.subscribe((data: { clientActionData: any }) => {
this.transferDate = data.clientActionData;
});
@@ -55,8 +56,8 @@ export class UndoClientTransferComponent implements OnInit {
*/
createUndoClientTransferForm() {
this.undoClientTransferForm = this.formBuilder.group({
'transferDate': {value: new Date(this.transferDate), disabled: true},
'note': ['']
transferDate: { value: new Date(this.transferDate), disabled: true },
note: ['']
});
}
@@ -79,5 +80,4 @@ export class UndoClientTransferComponent implements OnInit {
this.router.navigate(['../../'], { relativeTo: this.route });
});
}
}
@@ -8,9 +8,8 @@ describe('UpdateClientSavingsAccountComponent', () => {
beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [ UpdateClientSavingsAccountComponent ]
})
.compileComponents();
declarations: [UpdateClientSavingsAccountComponent]
}).compileComponents();
}));
beforeEach(() => {
@@ -15,7 +15,6 @@ import { ClientsService } from 'app/clients/clients.service';
styleUrls: ['./update-client-savings-account.component.scss']
})
export class UpdateClientSavingsAccountComponent implements OnInit {
/** Client Update Savings Account form. */
clientSavingsAccountForm: UntypedFormGroup;
/** Savings Accounts Data */
@@ -30,10 +29,12 @@ export class UpdateClientSavingsAccountComponent implements OnInit {
* @param {ActivatedRoute} route Activated Route
* @param {Router} router Router
*/
constructor(private formBuilder: UntypedFormBuilder,
private clientsService: ClientsService,
private route: ActivatedRoute,
private router: Router) {
constructor(
private formBuilder: UntypedFormBuilder,
private clientsService: ClientsService,
private route: ActivatedRoute,
private router: Router
) {
this.route.data.subscribe((data: { clientActionData: any }) => {
this.clientData = data.clientActionData;
});
@@ -49,7 +50,7 @@ export class UpdateClientSavingsAccountComponent implements OnInit {
*/
createClientSavingsAccountForm() {
this.clientSavingsAccountForm = this.formBuilder.group({
'savingsAccountId': [this.clientData.savingsAccountId]
savingsAccountId: [this.clientData.savingsAccountId]
});
}
@@ -57,10 +58,10 @@ export class UpdateClientSavingsAccountComponent implements OnInit {
* Submits the form and update savings account for the client.
*/
submit() {
this.clientsService.executeClientCommand(this.clientData.id, 'updateSavingsAccount', this.clientSavingsAccountForm.value)
this.clientsService
.executeClientCommand(this.clientData.id, 'updateSavingsAccount', this.clientSavingsAccountForm.value)
.subscribe(() => {
this.router.navigate(['../../'], { relativeTo: this.route });
});
}
}
@@ -8,9 +8,8 @@ describe('ViewSurveyComponent', () => {
beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [ ViewSurveyComponent ]
})
.compileComponents();
declarations: [ViewSurveyComponent]
}).compileComponents();
}));
beforeEach(() => {
@@ -14,20 +14,23 @@ import { MatTableDataSource } from '@angular/material/table';
styleUrls: ['./view-survey.component.scss']
})
export class ViewSurveyComponent implements OnInit {
/** Survey Data */
surveyData: any;
/** Data source for view surveys table. */
dataSource: MatTableDataSource<any>;
/** Columns to be displayed in list of surveys table. */
displayedColumns: string[] = ['surveyName', 'createdBy', 'date', 'score'];
displayedColumns: string[] = [
'surveyName',
'createdBy',
'date',
'score'
];
/** Paginator for list of surveys table. */
@ViewChild(MatPaginator, { static: true }) paginator: MatPaginator;
/** Sorter for list of surveys table. */
@ViewChild(MatSort, { static: true }) sort: MatSort;
/**
* Retrieves the survey data from `resolve`.
* @param {ActivatedRoute} route Activated Route.
@@ -71,5 +74,4 @@ export class ViewSurveyComponent implements OnInit {
applyFilter(filterValue: string) {
this.dataSource.filter = filterValue.trim().toLowerCase();
}
}
@@ -8,9 +8,8 @@ describe('WithdrawClientComponent', () => {
beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [ WithdrawClientComponent ]
})
.compileComponents();
declarations: [WithdrawClientComponent]
}).compileComponents();
}));
beforeEach(() => {
@@ -17,7 +17,6 @@ import { SettingsService } from 'app/settings/settings.service';
styleUrls: ['./withdraw-client.component.scss']
})
export class WithdrawClientComponent implements OnInit {
/** Minimum date allowed. */
minDate = new Date(2000, 0, 1);
/** Maximum date allowed. */
@@ -37,12 +36,14 @@ export class WithdrawClientComponent implements OnInit {
* @param {Router} router Router
* @param {SettingsService} settingsService Setting service
*/
constructor(private formBuilder: UntypedFormBuilder,
private clientsService: ClientsService,
private dateUtils: Dates,
private route: ActivatedRoute,
private router: Router,
private settingsService: SettingsService) {
constructor(
private formBuilder: UntypedFormBuilder,
private clientsService: ClientsService,
private dateUtils: Dates,
private route: ActivatedRoute,
private router: Router,
private settingsService: SettingsService
) {
this.route.data.subscribe((data: { clientActionData: any }) => {
this.withdrawalData = data.clientActionData.narrations;
});
@@ -59,8 +60,14 @@ export class WithdrawClientComponent implements OnInit {
*/
createWithdrawClientForm() {
this.withdrawClientForm = this.formBuilder.group({
'withdrawalDate': ['', Validators.required],
'withdrawalReasonId': ['', Validators.required]
withdrawalDate: [
'',
Validators.required
],
withdrawalReasonId: [
'',
Validators.required
]
});
}
@@ -84,5 +91,4 @@ export class WithdrawClientComponent implements OnInit {
this.router.navigate(['../../'], { relativeTo: this.route });
});
}
}
@@ -8,9 +8,8 @@ describe('ClientsViewComponent', () => {
beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [ ClientsViewComponent ]
})
.compileComponents();
declarations: [ClientsViewComponent]
}).compileComponents();
}));
beforeEach(() => {
@@ -22,22 +22,19 @@ import { ClientsService } from '../clients.service';
styleUrls: ['./clients-view.component.scss']
})
export class ClientsViewComponent implements OnInit {
clientViewData: any;
clientDatatables: any;
clientImage: any;
clientTemplateData: any;
constructor(private route: ActivatedRoute,
private router: Router,
private clientsService: ClientsService,
private _sanitizer: DomSanitizer,
public dialog: MatDialog) {
this.route.data.subscribe((data: {
clientViewData: any,
clientTemplateData: any,
clientDatatables: any
}) => {
constructor(
private route: ActivatedRoute,
private router: Router,
private clientsService: ClientsService,
private _sanitizer: DomSanitizer,
public dialog: MatDialog
) {
this.route.data.subscribe((data: { clientViewData: any; clientTemplateData: any; clientDatatables: any }) => {
this.clientViewData = data.clientViewData;
this.clientDatatables = data.clientDatatables;
this.clientTemplateData = data.clientTemplateData;
@@ -48,12 +45,13 @@ export class ClientsViewComponent implements OnInit {
this.clientsService.getClientProfileImage(this.clientViewData.id).subscribe(
(base64Image: any) => {
this.clientImage = this._sanitizer.bypassSecurityTrustResourceUrl(base64Image);
}, (error: any) => {}
},
(error: any) => {}
);
}
isActive(): boolean {
return (this.clientViewData.status.value === 'Active');
return this.clientViewData.status.value === 'Active';
}
/**
@@ -81,7 +79,7 @@ export class ClientsViewComponent implements OnInit {
case 'Client Screen Reports':
this.router.navigate([`actions/${name}`], { relativeTo: this.route });
break;
case 'Unassign Staff':
case 'Unassign Staff':
this.unassignStaff();
break;
case 'Delete':
@@ -106,12 +104,24 @@ export class ClientsViewComponent implements OnInit {
this.deleteProfileImage();
break;
case 'Create Standing Instructions':
const createStandingInstructionsQueryParams: any = { officeId: this.clientViewData.officeId, accountType: 'fromsavings' };
this.router.navigate(['standing-instructions/create-standing-instructions'], { relativeTo: this.route, queryParams: createStandingInstructionsQueryParams });
const createStandingInstructionsQueryParams: any = {
officeId: this.clientViewData.officeId,
accountType: 'fromsavings'
};
this.router.navigate(['standing-instructions/create-standing-instructions'], {
relativeTo: this.route,
queryParams: createStandingInstructionsQueryParams
});
break;
case 'View Standing Instructions':
const viewStandingInstructionsQueryParams: any = { officeId: this.clientViewData.officeId, accountType: 'fromsavings' };
this.router.navigate(['standing-instructions/list-standing-instructions'], { relativeTo: this.route, queryParams: viewStandingInstructionsQueryParams });
const viewStandingInstructionsQueryParams: any = {
officeId: this.clientViewData.officeId,
accountType: 'fromsavings'
};
this.router.navigate(['standing-instructions/list-standing-instructions'], {
relativeTo: this.route,
queryParams: viewStandingInstructionsQueryParams
});
break;
}
}
@@ -122,8 +132,7 @@ export class ClientsViewComponent implements OnInit {
*/
reload() {
const url: string = this.router.url;
this.router.navigateByUrl(`/clients`, {skipLocationChange: true})
.then(() => this.router.navigate([url]));
this.router.navigateByUrl(`/clients`, { skipLocationChange: true }).then(() => this.router.navigate([url]));
}
/**
@@ -149,7 +158,8 @@ export class ClientsViewComponent implements OnInit {
const unAssignStaffDialogRef = this.dialog.open(UnassignStaffDialogComponent);
unAssignStaffDialogRef.afterClosed().subscribe((response: { confirm: any }) => {
if (response.confirm) {
this.clientsService.executeClientCommand(this.clientViewData.id, 'unassignStaff', { staffId: this.clientViewData.staffId })
this.clientsService
.executeClientCommand(this.clientViewData.id, 'unassignStaff', { staffId: this.clientViewData.staffId })
.subscribe(() => {
this.reload();
});
@@ -185,10 +195,9 @@ export class ClientsViewComponent implements OnInit {
const uploadSignatureDialogRef = this.dialog.open(UploadSignatureDialogComponent);
uploadSignatureDialogRef.afterClosed().subscribe((signature: File) => {
if (signature) {
this.clientsService.uploadClientSignatureImage(this.clientViewData.id, signature)
.subscribe(() => {
this.reload();
});
this.clientsService.uploadClientSignatureImage(this.clientViewData.id, signature).subscribe(() => {
this.reload();
});
}
});
}
@@ -203,10 +212,9 @@ export class ClientsViewComponent implements OnInit {
});
deleteSignatureDialogRef.afterClosed().subscribe((response: any) => {
if (response.delete) {
this.clientsService.deleteClientDocument(this.clientViewData.id, response.id)
.subscribe(() => {
this.reload();
});
this.clientsService.deleteClientDocument(this.clientViewData.id, response.id).subscribe(() => {
this.reload();
});
} else if (response.upload) {
this.uploadSignature();
}
@@ -221,10 +229,9 @@ export class ClientsViewComponent implements OnInit {
const captureImageDialogRef = this.dialog.open(CaptureImageDialogComponent);
captureImageDialogRef.afterClosed().subscribe((imageURL: string) => {
if (imageURL) {
this.clientsService.uploadCapturedClientProfileImage(this.clientViewData.id, imageURL)
.subscribe(() => {
this.reload();
});
this.clientsService.uploadCapturedClientProfileImage(this.clientViewData.id, imageURL).subscribe(() => {
this.reload();
});
}
});
}
@@ -236,10 +243,9 @@ export class ClientsViewComponent implements OnInit {
const uploadImageDialogRef = this.dialog.open(UploadImageDialogComponent);
uploadImageDialogRef.afterClosed().subscribe((image: File) => {
if (image) {
this.clientsService.uploadClientProfileImage(this.clientViewData.id, image)
.subscribe(() => {
this.reload();
});
this.clientsService.uploadClientProfileImage(this.clientViewData.id, image).subscribe(() => {
this.reload();
});
}
});
}
@@ -253,12 +259,10 @@ export class ClientsViewComponent implements OnInit {
});
deleteClientImageDialogRef.afterClosed().subscribe((response: any) => {
if (response.delete) {
this.clientsService.deleteClientProfileImage(this.clientViewData.id)
.subscribe(() => {
this.reload();
});
this.clientsService.deleteClientProfileImage(this.clientViewData.id).subscribe(() => {
this.reload();
});
}
});
}
}
@@ -8,9 +8,8 @@ describe('CaptureImageDialogComponent', () => {
beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [ CaptureImageDialogComponent ]
})
.compileComponents();
declarations: [CaptureImageDialogComponent]
}).compileComponents();
}));
beforeEach(() => {
@@ -11,7 +11,6 @@ import { MatDialogRef } from '@angular/material/dialog';
styleUrls: ['./capture-image-dialog.component.scss']
})
export class CaptureImageDialogComponent implements AfterViewInit, OnDestroy {
/** Video element reference */
@ViewChild('video', { static: true }) video: ElementRef;
/** Canvas element reference */
@@ -30,8 +29,10 @@ export class CaptureImageDialogComponent implements AfterViewInit, OnDestroy {
* @param {MatDialogRef} dialogRef Mat Dialog Reference
* @param {Renderer2} renderer Template Renderer
*/
constructor(public dialogRef: MatDialogRef<CaptureImageDialogComponent>,
private renderer: Renderer2) {}
constructor(
public dialogRef: MatDialogRef<CaptureImageDialogComponent>,
private renderer: Renderer2
) {}
ngAfterViewInit() {
this.startCamera();
@@ -48,14 +49,15 @@ export class CaptureImageDialogComponent implements AfterViewInit, OnDestroy {
*/
startCamera() {
if (navigator.mediaDevices && navigator.mediaDevices.getUserMedia) {
navigator.mediaDevices.getUserMedia({ video: true })
.then((stream: MediaStream) => {
this.renderer.setProperty(this.video.nativeElement, 'srcObject', stream);
this.video.nativeElement.play();
})
.catch((error: Error) => {
this.handleError(error);
});
navigator.mediaDevices
.getUserMedia({ video: true })
.then((stream: MediaStream) => {
this.renderer.setProperty(this.video.nativeElement, 'srcObject', stream);
this.video.nativeElement.play();
})
.catch((error: Error) => {
this.handleError(error);
});
} else {
throw new Error('Cannot connect to camera');
}
@@ -104,5 +106,4 @@ export class CaptureImageDialogComponent implements AfterViewInit, OnDestroy {
this.isCaptured = false;
this.video.nativeElement.play();
}
}
@@ -8,9 +8,8 @@ describe('DeleteSignatureDialogComponent', () => {
beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [ DeleteSignatureDialogComponent ]
})
.compileComponents();
declarations: [DeleteSignatureDialogComponent]
}).compileComponents();
}));
beforeEach(() => {
@@ -11,7 +11,6 @@ import { MatDialogRef, MAT_DIALOG_DATA } from '@angular/material/dialog';
styleUrls: ['./delete-signature-dialog.component.scss']
})
export class DeleteSignatureDialogComponent {
/** Id of client signature in documents */
signatureId: any;
@@ -19,10 +18,11 @@ export class DeleteSignatureDialogComponent {
* @param {MatDialogRef} dialogRef Component reference to dialog.
* @param {any} data Documents data
*/
constructor(public dialogRef: MatDialogRef<DeleteSignatureDialogComponent>,
@Inject(MAT_DIALOG_DATA) public data: any[]) {
constructor(
public dialogRef: MatDialogRef<DeleteSignatureDialogComponent>,
@Inject(MAT_DIALOG_DATA) public data: any[]
) {
const signature = this.data.find((document: any) => document.name === 'clientSignature') || {};
this.signatureId = signature.id;
}
}
@@ -8,9 +8,8 @@ describe('EditNotesDialogComponent', () => {
beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [ EditNotesDialogComponent ]
})
.compileComponents();
declarations: [EditNotesDialogComponent]
}).compileComponents();
}));
beforeEach(() => {
@@ -11,9 +11,11 @@ import { UntypedFormGroup, UntypedFormBuilder, Validators } from '@angular/forms
export class EditNotesDialogComponent implements OnInit {
noteForm: UntypedFormGroup;
constructor(public dialogRef: MatDialogRef<EditNotesDialogComponent>,
constructor(
public dialogRef: MatDialogRef<EditNotesDialogComponent>,
private formBuilder: UntypedFormBuilder,
@Inject(MAT_DIALOG_DATA) public data: any) { }
@Inject(MAT_DIALOG_DATA) public data: any
) {}
ngOnInit() {
this.createNoteForm();
@@ -21,7 +23,10 @@ export class EditNotesDialogComponent implements OnInit {
createNoteForm() {
this.noteForm = this.formBuilder.group({
'note': [this.data.noteContent, Validators.required]
note: [
this.data.noteContent,
Validators.required
]
});
}
}
@@ -8,9 +8,8 @@ describe('UnassignStaffDialogComponent', () => {
beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [ UnassignStaffDialogComponent ]
})
.compileComponents();
declarations: [UnassignStaffDialogComponent]
}).compileComponents();
}));
beforeEach(() => {
@@ -11,10 +11,8 @@ import { MatDialogRef, MAT_DIALOG_DATA } from '@angular/material/dialog';
styleUrls: ['./unassign-staff-dialog.component.scss']
})
export class UnassignStaffDialogComponent {
/**
* @param {MatDialogRef} dialogRef Component reference to dialog.
*/
constructor(public dialogRef: MatDialogRef<UnassignStaffDialogComponent>) { }
constructor(public dialogRef: MatDialogRef<UnassignStaffDialogComponent>) {}
}
@@ -8,9 +8,8 @@ describe('UploadDocumentDialogComponent', () => {
beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [ UploadDocumentDialogComponent ]
})
.compileComponents();
declarations: [UploadDocumentDialogComponent]
}).compileComponents();
}));
beforeEach(() => {
@@ -8,7 +8,6 @@ import { UntypedFormGroup, UntypedFormBuilder, Validators, FormControl } from '@
styleUrls: ['./upload-document-dialog.component.scss']
})
export class UploadDocumentDialogComponent implements OnInit {
/** Upload Document form. */
uploadDocumentForm: UntypedFormGroup;
/** Upload Document Data */
@@ -23,9 +22,11 @@ export class UploadDocumentDialogComponent implements OnInit {
* @param {FormBuilder} formBuilder Form Builder
* @param {any} data Dialog Data
*/
constructor(public dialogRef: MatDialogRef<UploadDocumentDialogComponent>,
private formBuilder: UntypedFormBuilder,
@Inject(MAT_DIALOG_DATA) public data: any) {
constructor(
public dialogRef: MatDialogRef<UploadDocumentDialogComponent>,
private formBuilder: UntypedFormBuilder,
@Inject(MAT_DIALOG_DATA) public data: any
) {
this.documentIdentifier = data.documentIdentifier;
this.entityType = data.entityType;
}
@@ -39,9 +40,12 @@ export class UploadDocumentDialogComponent implements OnInit {
*/
createUploadDocumentForm() {
this.uploadDocumentForm = this.formBuilder.group({
'fileName': ['', Validators.required],
'description': [''],
'file': ['']
fileName: [
'',
Validators.required
],
description: [''],
file: ['']
});
}
@@ -55,7 +59,4 @@ export class UploadDocumentDialogComponent implements OnInit {
this.uploadDocumentForm.get('file').setValue(file);
}
}
}
@@ -8,9 +8,8 @@ describe('UploadImageDialogComponent', () => {
beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [ UploadImageDialogComponent ]
})
.compileComponents();
declarations: [UploadImageDialogComponent]
}).compileComponents();
}));
beforeEach(() => {
@@ -11,14 +11,13 @@ import { MatDialogRef } from '@angular/material/dialog';
styleUrls: ['./upload-image-dialog.component.scss']
})
export class UploadImageDialogComponent {
/** Client Image */
image: File;
/**
* @param {MatDialogRef} dialogRef Component reference to dialog.
*/
constructor(public dialogRef: MatDialogRef<UploadImageDialogComponent>) { }
constructor(public dialogRef: MatDialogRef<UploadImageDialogComponent>) {}
/**
* Sets file form control value.
@@ -29,5 +28,4 @@ export class UploadImageDialogComponent {
this.image = $event.target.files[0];
}
}
}
@@ -8,9 +8,8 @@ describe('UploadSignatureDialogComponent', () => {
beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [ UploadSignatureDialogComponent ]
})
.compileComponents();
declarations: [UploadSignatureDialogComponent]
}).compileComponents();
}));
beforeEach(() => {
@@ -11,14 +11,13 @@ import { MatDialogRef } from '@angular/material/dialog';
styleUrls: ['./upload-signature-dialog.component.scss']
})
export class UploadSignatureDialogComponent {
/** Client Signature */
signature: File;
/**
* @param {MatDialogRef} dialogRef Component reference to dialog.
*/
constructor(public dialogRef: MatDialogRef<UploadSignatureDialogComponent>) { }
constructor(public dialogRef: MatDialogRef<UploadSignatureDialogComponent>) {}
/**
* Sets file form control value.
@@ -29,5 +28,4 @@ export class UploadSignatureDialogComponent {
this.signature = $event.target.files[0];
}
}
}
@@ -8,9 +8,8 @@ describe('ViewSignatureDialogComponent', () => {
beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [ ViewSignatureDialogComponent ]
})
.compileComponents();
declarations: [ViewSignatureDialogComponent]
}).compileComponents();
}));
beforeEach(() => {
@@ -18,7 +18,6 @@ import { Buffer } from 'buffer';
styleUrls: ['./view-signature-dialog.component.scss']
})
export class ViewSignatureDialogComponent implements OnInit {
/** Id of client signature in documents */
signatureId: any;
/** Signature Image */
@@ -30,10 +29,12 @@ export class ViewSignatureDialogComponent implements OnInit {
* @param {MatDialogRef} dialogRef Component reference to dialog.
* @param {any} data Documents data
*/
constructor(public dialogRef: MatDialogRef<ViewSignatureDialogComponent>,
private clientsService: ClientsService,
private sanitizer: DomSanitizer,
@Inject(MAT_DIALOG_DATA) public data: { documents: any[], id: string }) {
constructor(
public dialogRef: MatDialogRef<ViewSignatureDialogComponent>,
private clientsService: ClientsService,
private sanitizer: DomSanitizer,
@Inject(MAT_DIALOG_DATA) public data: { documents: any[]; id: string }
) {
const signature = this.data.documents.find((document: any) => document.name === 'clientSignature') || {};
this.signatureId = signature.id;
this.clientId = this.data.id;
@@ -43,11 +44,11 @@ export class ViewSignatureDialogComponent implements OnInit {
if (this.signatureId) {
this.clientsService.getClientSignatureImage(this.clientId, this.signatureId).subscribe(
async (blob: any) => {
const buffer = Buffer.from(await blob.arrayBuffer())
const buffer = Buffer.from(await blob.arrayBuffer());
this.signatureImage = 'data:' + blob.type + ';base64,' + buffer.toString('base64');
}, (error: any) => {}
},
(error: any) => {}
);
}
}
}
@@ -8,9 +8,8 @@ describe('DatatableTabComponent', () => {
beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [ DatatableTabComponent ]
})
.compileComponents();
declarations: [DatatableTabComponent]
}).compileComponents();
}));
beforeEach(() => {
@@ -19,5 +19,4 @@ export class DatatableTabComponent {
this.multiRowDatatableFlag = this.entityDatatable.columnHeaders[0].columnName === 'id' ? true : false;
});
}
}
@@ -8,9 +8,8 @@ describe('DocumentsTabComponent', () => {
beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [ DocumentsTabComponent ]
})
.compileComponents();
declarations: [DocumentsTabComponent]
}).compileComponents();
}));
beforeEach(() => {
@@ -15,9 +15,11 @@ export class DocumentsTabComponent {
entityId: string;
entityType = 'clients';
constructor(private route: ActivatedRoute,
constructor(
private route: ActivatedRoute,
private clientsService: ClientsService,
public dialog: MatDialog) {
public dialog: MatDialog
) {
this.route.data.subscribe((data: { clientDocuments: any }) => {
this.entityDocuments = data.clientDocuments;
});
@@ -25,18 +27,17 @@ export class DocumentsTabComponent {
}
downloadDocument(documentId: string) {
this.clientsService.downloadClientDocument(this.entityId, documentId).subscribe(res => {
this.clientsService.downloadClientDocument(this.entityId, documentId).subscribe((res) => {
const url = window.URL.createObjectURL(res);
window.open(url);
});
}
deleteDocument(documentId: string) {
this.clientsService.deleteClientDocument(this.entityId, documentId).subscribe(res => {});
this.clientsService.deleteClientDocument(this.entityId, documentId).subscribe((res) => {});
}
uploadDocument(formData: FormData): any {
return this.clientsService.uploadClientDocument(this.entityId, formData);
}
}
@@ -8,9 +8,8 @@ describe('AddFamilyMemberComponent', () => {
beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [ AddFamilyMemberComponent ]
})
.compileComponents();
declarations: [AddFamilyMemberComponent]
}).compileComponents();
}));
beforeEach(() => {
@@ -17,7 +17,6 @@ import { Dates } from 'app/core/utils/dates';
styleUrls: ['./add-family-member.component.scss']
})
export class AddFamilyMemberComponent implements OnInit {
/** Maximum Due Date allowed. */
maxDate = new Date();
/** Minimum age allowed is 0. */
@@ -37,17 +36,18 @@ export class AddFamilyMemberComponent implements OnInit {
* @param {ClientsService} clientsService Clients Service
* @param {SettingsService} settingsService Setting service
*/
constructor(private formBuilder: UntypedFormBuilder,
private dateUtils: Dates,
private router: Router,
private route: ActivatedRoute,
private clientsService: ClientsService,
private settingsService: SettingsService) {
constructor(
private formBuilder: UntypedFormBuilder,
private dateUtils: Dates,
private router: Router,
private route: ActivatedRoute,
private clientsService: ClientsService,
private settingsService: SettingsService
) {
this.route.data.subscribe((data: { clientTemplate: any }) => {
this.addFamilyMemberTemplate = data.clientTemplate.familyMemberOptions;
});
this.clientId = this.route.parent.parent.snapshot.params['clientId'];
}
ngOnInit() {
@@ -60,17 +60,35 @@ export class AddFamilyMemberComponent implements OnInit {
*/
createAddFamilyMemberForm() {
this.addFamilyMemberForm = this.formBuilder.group({
'firstName': ['', Validators.required],
'middleName': [''],
'lastName': ['', Validators.required],
'qualification': [''],
'age': ['', Validators.required],
'isDependent': [''],
'relationshipId': ['', Validators.required],
'genderId': ['', Validators.required],
'professionId': [''],
'maritalStatusId': [''],
'dateOfBirth': ['', Validators.required]
firstName: [
'',
Validators.required
],
middleName: [''],
lastName: [
'',
Validators.required
],
qualification: [''],
age: [
'',
Validators.required
],
isDependent: [''],
relationshipId: [
'',
Validators.required
],
genderId: [
'',
Validators.required
],
professionId: [''],
maritalStatusId: [''],
dateOfBirth: [
'',
Validators.required
]
});
}
@@ -90,9 +108,8 @@ export class AddFamilyMemberComponent implements OnInit {
dateFormat,
locale
};
this.clientsService.addFamilyMember(this.clientId, data).subscribe(res => {
this.clientsService.addFamilyMember(this.clientId, data).subscribe((res) => {
this.router.navigate(['../'], { relativeTo: this.route });
});
}
}
@@ -8,9 +8,8 @@ describe('EditFamilyMemberComponent', () => {
beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [ EditFamilyMemberComponent ]
})
.compileComponents();
declarations: [EditFamilyMemberComponent]
}).compileComponents();
}));
beforeEach(() => {
@@ -17,8 +17,6 @@ import { Dates } from 'app/core/utils/dates';
styleUrls: ['./edit-family-member.component.scss']
})
export class EditFamilyMemberComponent implements OnInit {
/** Maximum Due Date allowed. */
maxDate = new Date();
/** Add family member form. */
@@ -36,13 +34,15 @@ export class EditFamilyMemberComponent implements OnInit {
* @param {ClientsService} clientsService Clients Service
* @param {SettingsService} settingsService Setting service
*/
constructor(private formBuilder: UntypedFormBuilder,
private dateUtils: Dates,
private router: Router,
private route: ActivatedRoute,
private clientsService: ClientsService,
private settingsService: SettingsService) {
this.route.data.subscribe((data: { clientTemplate: any, editFamilyMember: any }) => {
constructor(
private formBuilder: UntypedFormBuilder,
private dateUtils: Dates,
private router: Router,
private route: ActivatedRoute,
private clientsService: ClientsService,
private settingsService: SettingsService
) {
this.route.data.subscribe((data: { clientTemplate: any; editFamilyMember: any }) => {
this.addFamilyMemberTemplate = data.clientTemplate.familyMemberOptions;
this.familyMemberDetails = data.editFamilyMember;
});
@@ -59,17 +59,35 @@ export class EditFamilyMemberComponent implements OnInit {
*/
createEditFamilyMemberForm(familyMember: any) {
this.editFamilyMemberForm = this.formBuilder.group({
'firstName': [familyMember.firstName, Validators.required],
'middleName': [familyMember.middleName],
'lastName': [familyMember.lastName, Validators.required],
'qualification': [familyMember.qualification],
'age': [familyMember.age, Validators.required],
'isDependent': [familyMember.isDependent],
'relationshipId': [familyMember.relationshipId, Validators.required],
'genderId': [familyMember.genderId, Validators.required],
'professionId': [familyMember.professionId],
'maritalStatusId': [familyMember.maritalStatusId],
'dateOfBirth': [this.dateUtils.formatDate(familyMember.dateOfBirth, 'yyyy-MM-dd'), Validators.required]
firstName: [
familyMember.firstName,
Validators.required
],
middleName: [familyMember.middleName],
lastName: [
familyMember.lastName,
Validators.required
],
qualification: [familyMember.qualification],
age: [
familyMember.age,
Validators.required
],
isDependent: [familyMember.isDependent],
relationshipId: [
familyMember.relationshipId,
Validators.required
],
genderId: [
familyMember.genderId,
Validators.required
],
professionId: [familyMember.professionId],
maritalStatusId: [familyMember.maritalStatusId],
dateOfBirth: [
this.dateUtils.formatDate(familyMember.dateOfBirth, 'yyyy-MM-dd'),
Validators.required
]
});
}
@@ -89,9 +107,10 @@ export class EditFamilyMemberComponent implements OnInit {
dateFormat,
locale
};
this.clientsService.editFamilyMember(this.familyMemberDetails.clientId, this.familyMemberDetails.id, data).subscribe(res => {
this.router.navigate(['../../'], { relativeTo: this.route });
});
this.clientsService
.editFamilyMember(this.familyMemberDetails.clientId, this.familyMemberDetails.id, data)
.subscribe((res) => {
this.router.navigate(['../../'], { relativeTo: this.route });
});
}
}
@@ -8,9 +8,8 @@ describe('FamilyMembersTabComponent', () => {
beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [ FamilyMembersTabComponent ]
})
.compileComponents();
declarations: [FamilyMembersTabComponent]
}).compileComponents();
}));
beforeEach(() => {
@@ -18,7 +18,6 @@ import { ClientsService } from '../../clients.service';
styleUrls: ['./family-members-tab.component.scss']
})
export class FamilyMembersTabComponent {
/** Client Family Members */
clientFamilyMembers: any;
@@ -27,9 +26,11 @@ export class FamilyMembersTabComponent {
* @param {ClientsService} clientsService Clients Service
* @param {MatDialog }dialog Mat Dialog
*/
constructor(private route: ActivatedRoute,
private clientsService: ClientsService,
public dialog: MatDialog) {
constructor(
private route: ActivatedRoute,
private clientsService: ClientsService,
public dialog: MatDialog
) {
this.route.data.subscribe((data: { clientFamilyMembers: any }) => {
this.clientFamilyMembers = data.clientFamilyMembers;
});
@@ -44,10 +45,9 @@ export class FamilyMembersTabComponent {
});
deleteFamilyMemberDialogRef.afterClosed().subscribe((response: any) => {
if (response.delete) {
this.clientsService.deleteFamilyMember(clientId, id)
.subscribe(() => {
this.clientFamilyMembers.splice(index, 1);
});
this.clientsService.deleteFamilyMember(clientId, id).subscribe(() => {
this.clientFamilyMembers.splice(index, 1);
});
}
});
}
@@ -62,5 +62,4 @@ export class FamilyMembersTabComponent {
}
return fullName;
}
}
@@ -8,9 +8,8 @@ describe('GeneralTabComponent', () => {
beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [ GeneralTabComponent ]
})
.compileComponents();
declarations: [GeneralTabComponent]
}).compileComponents();
}));
beforeEach(() => {
@@ -14,23 +14,74 @@ import { ClientsService } from 'app/clients/clients.service';
styleUrls: ['./general-tab.component.scss']
})
export class GeneralTabComponent {
/** Open Loan Accounts Columns */
openLoansColumns: string[] = ['Account No', 'Loan Account', 'Original Loan', 'Loan Balance', 'Amount Paid', 'Type', 'Actions'];
openLoansColumns: string[] = [
'Account No',
'Loan Account',
'Original Loan',
'Loan Balance',
'Amount Paid',
'Type',
'Actions'
];
/** Closed Loan Accounts Columns */
closedLoansColumns: string[] = ['Account No', 'Loan Account', 'Original Loan', 'Loan Balance', 'Amount Paid', 'Type', 'Closed Date'];
closedLoansColumns: string[] = [
'Account No',
'Loan Account',
'Original Loan',
'Loan Balance',
'Amount Paid',
'Type',
'Closed Date'
];
/** Open Savings Accounts Columns */
openSavingsColumns: string[] = ['Account No', 'Saving Account', 'Last Active', 'Balance', 'Actions'];
openSavingsColumns: string[] = [
'Account No',
'Saving Account',
'Last Active',
'Balance',
'Actions'
];
/** Closed Savings Accounts Columns */
closedSavingsColumns: string[] = ['Account No', 'Saving Account', 'Closed Date'];
closedSavingsColumns: string[] = [
'Account No',
'Saving Account',
'Closed Date'
];
/** Open Shares Accounts Columns */
openSharesColumns: string[] = ['Account No', 'Share Account', 'Approved Shares', 'Pending For Approval Shares', 'Actions'];
openSharesColumns: string[] = [
'Account No',
'Share Account',
'Approved Shares',
'Pending For Approval Shares',
'Actions'
];
/** Closed Shares Accounts Columns */
closedSharesColumns: string[] = ['Account No', 'Share Account', 'Approved Shares', 'Pending For Approval Shares', 'Closed Date'];
closedSharesColumns: string[] = [
'Account No',
'Share Account',
'Approved Shares',
'Pending For Approval Shares',
'Closed Date'
];
/** Upcoming Charges Columns */
upcomingChargesColumns: string[] = ['Name', 'Due as of', 'Due', 'Paid', 'Waived', 'Outstanding', 'Actions'];
upcomingChargesColumns: string[] = [
'Name',
'Due as of',
'Due',
'Paid',
'Waived',
'Outstanding',
'Actions'
];
/** Collaterals Column */
collateralsColumns: string[] = ['ID', 'Name', 'Quantity', 'Total Value', 'Total Collateral Value'];
collateralsColumns: string[] = [
'ID',
'Name',
'Quantity',
'Total Value',
'Total Collateral Value'
];
/** Client Account Data */
clientAccountData: any;
@@ -71,16 +122,18 @@ export class GeneralTabComponent {
private clientService: ClientsService,
private router: Router
) {
this.route.data.subscribe((data: { clientAccountsData: any, clientChargesData: any, clientSummary: any, clientCollateralData: any }) => {
this.clientAccountData = data.clientAccountsData;
this.savingAccounts = data.clientAccountsData.savingsAccounts;
this.loanAccounts = data.clientAccountsData.loanAccounts;
this.shareAccounts = data.clientAccountsData.shareAccounts;
this.upcomingCharges = data.clientChargesData.pageItems;
this.collaterals = data.clientCollateralData;
this.clientSummary = data.clientSummary ? data.clientSummary[0] : [];
this.clientid = this.route.parent.snapshot.params['clientId'];
});
this.route.data.subscribe(
(data: { clientAccountsData: any; clientChargesData: any; clientSummary: any; clientCollateralData: any }) => {
this.clientAccountData = data.clientAccountsData;
this.savingAccounts = data.clientAccountsData.savingsAccounts;
this.loanAccounts = data.clientAccountsData.loanAccounts;
this.shareAccounts = data.clientAccountsData.shareAccounts;
this.upcomingCharges = data.clientChargesData.pageItems;
this.collaterals = data.clientCollateralData;
this.clientSummary = data.clientSummary ? data.clientSummary[0] : [];
this.clientid = this.route.parent.snapshot.params['clientId'];
}
);
}
/**
@@ -124,7 +177,7 @@ export class GeneralTabComponent {
* @param clientId Selected Client Id.
*/
waiveCharge(chargeId: string, clientId: string) {
const charge = { clientId: clientId.toString(), resourceType: chargeId};
const charge = { clientId: clientId.toString(), resourceType: chargeId };
this.clientService.waiveClientCharge(charge).subscribe(() => {
this.getChargeData(clientId);
});
@@ -153,7 +206,16 @@ export class GeneralTabComponent {
*/
routeTransferFund(loanId: any) {
const queryParams: any = { loanId: loanId, accountType: 'fromloans' };
this.router.navigate(['../', 'loans-accounts', loanId, 'transfer-funds', 'make-account-transfer'], { relativeTo: this.route, queryParams: queryParams });
this.router.navigate(
[
'../',
'loans-accounts',
loanId,
'transfer-funds',
'make-account-transfer'
],
{ relativeTo: this.route, queryParams: queryParams }
);
}
viewAccountsLabel(closed: boolean): string {
@@ -163,5 +225,4 @@ export class GeneralTabComponent {
return 'labels.buttons.View Closed Accounts';
}
}
}
@@ -8,9 +8,8 @@ describe('IdentitiesTabComponent', () => {
beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [ IdentitiesTabComponent ]
})
.compileComponents();
declarations: [IdentitiesTabComponent]
}).compileComponents();
}));
beforeEach(() => {
@@ -27,7 +27,6 @@ import { ClientsService } from '../../clients.service';
styleUrls: ['./identities-tab.component.scss']
})
export class IdentitiesTabComponent {
/** Client Identities */
clientIdentities: any;
/** Client Identifier Template */
@@ -35,7 +34,15 @@ export class IdentitiesTabComponent {
/** Client Id */
clientId: string;
/** Identities Columns */
identitiesColumns: string[] = ['id', 'description', 'type', 'documentKey', 'documents', 'status', 'actions'];
identitiesColumns: string[] = [
'id',
'description',
'type',
'documentKey',
'documents',
'status',
'actions'
];
/** Identifiers Table */
@ViewChild('identifiersTable', { static: true }) identifiersTable: MatTable<Element>;
@@ -45,12 +52,14 @@ export class IdentitiesTabComponent {
* @param {MatDialog} dialog Mat Dialog
* @param {ClientsService} clientService Clients Service
*/
constructor(private route: ActivatedRoute,
private dialog: MatDialog,
private clientService: ClientsService,
private translateService: TranslateService) {
constructor(
private route: ActivatedRoute,
private dialog: MatDialog,
private clientService: ClientsService,
private translateService: TranslateService
) {
this.clientId = this.route.parent.snapshot.paramMap.get('clientId');
this.route.data.subscribe((data: { clientIdentities: any, clientIdentifierTemplate: any }) => {
this.route.data.subscribe((data: { clientIdentities: any; clientIdentifierTemplate: any }) => {
this.clientIdentities = data.clientIdentities;
this.clientIdentifierTemplate = data.clientIdentifierTemplate;
});
@@ -62,7 +71,7 @@ export class IdentitiesTabComponent {
* @param {string} documentId Document ID
*/
download(parentEntityId: string, documentId: string) {
this.clientService.downloadClientIdentificationDocument(parentEntityId, documentId).subscribe(res => {
this.clientService.downloadClientIdentificationDocument(parentEntityId, documentId).subscribe((res) => {
const url = window.URL.createObjectURL(res);
window.open(url);
});
@@ -73,7 +82,9 @@ export class IdentitiesTabComponent {
*/
addIdentifier() {
for (let index = 0; index < this.clientIdentifierTemplate.allowedDocumentTypes.length; index++) {
this.clientIdentifierTemplate.allowedDocumentTypes[index].name = this.translateService.instant(`labels.catalogs.${this.clientIdentifierTemplate.allowedDocumentTypes[index].name}`);
this.clientIdentifierTemplate.allowedDocumentTypes[index].name = this.translateService.instant(
`labels.catalogs.${this.clientIdentifierTemplate.allowedDocumentTypes[index].name}`
);
}
const formfields: FormfieldBase[] = [
new SelectBase({
@@ -88,10 +99,14 @@ export class IdentitiesTabComponent {
controlName: 'status',
label: this.translateService.instant('labels.inputs.Status'),
value: '2',
options: { label: 'label', value: 'value', data: [
{ label: this.translateService.instant('labels.catalogs.Active'), value: 'Active' },
{ label: this.translateService.instant('labels.catalogs.Inactive'), value: 'Inactive' }
] },
options: {
label: 'label',
value: 'value',
data: [
{ label: this.translateService.instant('labels.catalogs.Active'), value: 'Active' },
{ label: this.translateService.instant('labels.catalogs.Inactive'), value: 'Inactive' }
]
},
required: true,
order: 2
}),
@@ -110,6 +125,7 @@ export class IdentitiesTabComponent {
type: 'text',
order: 4
})
];
const data = {
title: this.translateService.instant('labels.heading.Add Client Identifier'),
@@ -122,11 +138,16 @@ export class IdentitiesTabComponent {
this.clientIdentities.push({
id: res.resourceId,
description: response.data.value.description,
documentType: this.clientIdentifierTemplate.allowedDocumentTypes.filter((doc: any) => (doc.id === response.data.value.documentTypeId))[0],
documentType: this.clientIdentifierTemplate.allowedDocumentTypes.filter(
(doc: any) => doc.id === response.data.value.documentTypeId
)[0],
documentKey: response.data.value.documentKey,
documents: [],
clientId: this.clientId,
status: (response.data.value.status === 'Active' ? 'clientIdentifierStatusType.active' : 'clientIdentifierStatusType.inactive')
status:
response.data.value.status === 'Active'
? 'clientIdentifierStatusType.active'
: 'clientIdentifierStatusType.inactive'
});
this.identifiersTable.renderRows();
});
@@ -146,7 +167,7 @@ export class IdentitiesTabComponent {
});
deleteIdentifierDialogRef.afterClosed().subscribe((response: any) => {
if (response.delete) {
this.clientService.deleteClientIdentifier(clientId, identifierId).subscribe(res => {
this.clientService.deleteClientIdentifier(clientId, identifierId).subscribe((res) => {
this.clientIdentities.splice(index, 1);
this.identifiersTable.renderRows();
});
@@ -165,7 +186,7 @@ export class IdentitiesTabComponent {
});
uploadDocumentDialogRef.afterClosed().subscribe((dialogResponse: any) => {
if (dialogResponse) {
const formData: FormData = new FormData;
const formData: FormData = new FormData();
formData.append('name', dialogResponse.fileName);
formData.append('file', dialogResponse.file);
this.clientService.uploadClientIdentifierDocument(identifierId, formData).subscribe((res: any) => {
@@ -181,5 +202,4 @@ export class IdentitiesTabComponent {
}
});
}
}
@@ -8,9 +8,8 @@ describe('NotesTabComponent', () => {
beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [ NotesTabComponent ]
})
.compileComponents();
declarations: [NotesTabComponent]
}).compileComponents();
}));
beforeEach(() => {
@@ -17,7 +17,6 @@ import { AuthenticationService } from 'app/core/authentication/authentication.se
styleUrls: ['./notes-tab.component.scss']
})
export class NotesTabComponent {
/** Client ID */
entityId: string;
/** Username */
@@ -30,9 +29,11 @@ export class NotesTabComponent {
* @param {ClientsService} clientsService Clients Service
* @param {AuthenticationService} authenticationService Authentication Service
*/
constructor(private route: ActivatedRoute,
private clientsService: ClientsService,
private authenticationService: AuthenticationService) {
constructor(
private route: ActivatedRoute,
private clientsService: ClientsService,
private authenticationService: AuthenticationService
) {
const credentials = this.authenticationService.getCredentials();
this.username = credentials.username;
this.entityId = this.route.parent.snapshot.params['clientId'];
@@ -59,10 +60,9 @@ export class NotesTabComponent {
* @param {number} index Index
*/
deleteNote(noteId: string, index: number) {
this.clientsService.deleteClientNote(this.entityId, noteId)
.subscribe(() => {
this.entityNotes.splice(index, 1);
});
this.clientsService.deleteClientNote(this.entityId, noteId).subscribe(() => {
this.entityNotes.splice(index, 1);
});
}
/**
@@ -78,5 +78,4 @@ export class NotesTabComponent {
});
});
}
}
+23 -13
View File
@@ -12,12 +12,18 @@ import { ClientsService } from './clients.service';
@Component({
selector: 'mifosx-clients',
templateUrl: './clients.component.html',
styleUrls: ['./clients.component.scss'],
styleUrls: ['./clients.component.scss']
})
export class ClientsComponent implements OnInit {
@ViewChild('showClosedAccounts') showClosedAccounts: MatCheckbox;
displayedColumns = ['displayName', 'accountNumber', 'externalId', 'status', 'officeName'];
displayedColumns = [
'displayName',
'accountNumber',
'externalId',
'status',
'officeName'
];
dataSource: MatTableDataSource<any> = new MatTableDataSource();
existsClientsToFilter = false;
@@ -36,7 +42,7 @@ export class ClientsComponent implements OnInit {
@ViewChild(MatPaginator) paginator: MatPaginator;
@ViewChild(MatSort) sort: MatSort;
constructor(private clientService: ClientsService) { }
constructor(private clientService: ClientsService) {}
ngOnInit() {
if (environment.preloadClients) {
@@ -55,18 +61,22 @@ export class ClientsComponent implements OnInit {
private getClients() {
this.isLoading = true;
this.clientService.searchByText(this.filterText, this.currentPage, this.pageSize, this.sortAttribute, this.sortDirection)
.subscribe((data: any) => {
this.dataSource.data = data.content;
this.clientService
.searchByText(this.filterText, this.currentPage, this.pageSize, this.sortAttribute, this.sortDirection)
.subscribe(
(data: any) => {
this.dataSource.data = data.content;
this.totalRows = data.totalElements;
this.totalRows = data.totalElements;
this.existsClientsToFilter = (data.numberOfElements > 0);
this.notExistsClientsToFilter = !this.existsClientsToFilter;
this.isLoading = false;
}, (error: any) => {
this.isLoading = false;
});
this.existsClientsToFilter = data.numberOfElements > 0;
this.notExistsClientsToFilter = !this.existsClientsToFilter;
this.isLoading = false;
},
(error: any) => {
this.isLoading = false;
}
);
}
pageChanged(event: PageEvent) {
+2 -4
View File
@@ -58,7 +58,6 @@ import { CreateSelfServiceUserComponent } from './clients-view/client-actions/cr
import { AddClientCollateralComponent } from './clients-view/client-actions/add-client-collateral/add-client-collateral.component';
import { ClientDatatableStepComponent } from './client-stepper/client-datatable-step/client-datatable-step.component';
/**
* Clients Module
*
@@ -122,7 +121,6 @@ import { ClientDatatableStepComponent } from './client-stepper/client-datatable-
AddClientCollateralComponent,
ClientDatatableStepComponent
],
providers: [ ]
providers: []
})
export class ClientsModule { }
export class ClientsModule {}
+34 -22
View File
@@ -14,9 +14,15 @@ export class ClientsService {
/**
* @param {HttpClient} http Http Client to send requests.
*/
constructor(private http: HttpClient) { }
constructor(private http: HttpClient) {}
getFilteredClients(orderBy: string, sortOrder: string, orphansOnly: boolean, displayName: string, officeId?: any): Observable<any> {
getFilteredClients(
orderBy: string,
sortOrder: string,
orphansOnly: boolean,
displayName: string,
officeId?: any
): Observable<any> {
let httpParams = new HttpParams()
.set('displayName', displayName)
.set('orphansOnly', orphansOnly.toString())
@@ -62,9 +68,7 @@ export class ClientsService {
}
getClientDataAndTemplate(clientId: string) {
const httpParams = new HttpParams()
.set('template', 'true')
.set('staffInSelectedOfficeOnly', 'true');
const httpParams = new HttpParams().set('template', 'true').set('staffInSelectedOfficeOnly', 'true');
return this.http.get(`/clients/${clientId}`, { params: httpParams });
}
@@ -112,7 +116,9 @@ export class ClientsService {
*/
waiveClientCharge(chargeData: any) {
const httpParams = new HttpParams().set('command', 'waive');
return this.http.post(`/clients/${chargeData.clientId}/charges/${chargeData.resourceType}`, chargeData, { params: httpParams });
return this.http.post(`/clients/${chargeData.clientId}/charges/${chargeData.resourceType}`, chargeData, {
params: httpParams
});
}
getAllClientCharges(clientId: string) {
@@ -123,7 +129,10 @@ export class ClientsService {
* @param transactionData Transaction Data to be undone.
*/
undoTransaction(transactionData: any) {
return this.http.post(`/clients/${transactionData.clientId}/transactions/${transactionData.transactionId}?command=undo`, transactionData);
return this.http.post(
`/clients/${transactionData.clientId}/transactions/${transactionData.transactionId}?command=undo`,
transactionData
);
}
/**
@@ -149,18 +158,21 @@ export class ClientsService {
*/
payClientCharge(clientId: string, chargeId: string, payment: any) {
const httpParams = new HttpParams().set('command', 'paycharge');
return this.http.post(`/clients/${clientId}/charges/${chargeId}?command=paycharge`, payment, { params: httpParams });
return this.http.post(`/clients/${clientId}/charges/${chargeId}?command=paycharge`, payment, {
params: httpParams
});
}
getClientSummary(clientId: string) {
const httpParams = new HttpParams().set('R_clientId', clientId)
.set('genericResultSet', 'false');
const httpParams = new HttpParams().set('R_clientId', clientId).set('genericResultSet', 'false');
return this.http.get(`/runreports/ClientSummary`, { params: httpParams });
}
getClientProfileImage(clientId: string) {
const httpParams = new HttpParams().set('maxHeight', '150');
return this.http.skipErrorHandler().get(`/clients/${clientId}/images`, { params: httpParams, responseType: 'text' });
return this.http
.skipErrorHandler()
.get(`/clients/${clientId}/images`, { params: httpParams, responseType: 'text' });
}
uploadClientProfileImage(clientId: string, image: File) {
@@ -231,7 +243,9 @@ export class ClientsService {
}
downloadClientIdentificationDocument(parentEntityId: string, documentId: string) {
return this.http.get(`/client_identifiers/${parentEntityId}/documents/${documentId}/attachment`, { responseType: 'blob' });
return this.http.get(`/client_identifiers/${parentEntityId}/documents/${documentId}/attachment`, {
responseType: 'blob'
});
}
uploadClientIdentifierDocument(identifierId: string, documentData: any) {
@@ -318,9 +332,7 @@ export class ClientsService {
}
getClientReportTemplates() {
const httpParams = new HttpParams()
.set('entityId', '0')
.set('typeId', '0');
const httpParams = new HttpParams().set('entityId', '0').set('typeId', '0');
return this.http.get('/templates', { params: httpParams });
}
@@ -384,19 +396,19 @@ export class ClientsService {
searchByText(text: string, page: number, pageSize: number, sortAttribute: string = '', sortDirection: string = '') {
let request: any = {
request: {
text
},
page,
size: pageSize
request: {
text
},
page,
size: pageSize
};
if (sortAttribute !== '' && sortDirection !== '') {
request = {
...request,
sorts: [
{
direction: sortDirection,
property: sortAttribute
direction: sortDirection,
property: sortAttribute
}
]
};
@@ -13,19 +13,17 @@ import { ClientsService } from '../clients.service';
*/
@Injectable()
export class ClientAccountsResolver implements Resolve<Object> {
/**
* @param {ClientsService} ClientsService Clients service.
*/
constructor(private clientsService: ClientsService) {}
/**
* @param {ClientsService} ClientsService Clients service.
*/
constructor(private clientsService: ClientsService) { }
/**
* Returns the Client Account data.
* @returns {Observable<any>}
*/
resolve(route: ActivatedRouteSnapshot): Observable<any> {
const clientId = route.parent.paramMap.get('clientId');
return this.clientsService.getClientAccountData(clientId);
}
/**
* Returns the Client Account data.
* @returns {Observable<any>}
*/
resolve(route: ActivatedRouteSnapshot): Observable<any> {
const clientId = route.parent.paramMap.get('clientId');
return this.clientsService.getClientAccountData(clientId);
}
}
@@ -14,13 +14,14 @@ import { ProductsService } from 'app/products/products.service';
*/
@Injectable()
export class ClientActionsResolver implements Resolve<Object> {
/**
* @param {ClientsService} clientsService Clients service.
* @param {ProductsService} productsService Products Service
*/
constructor(private clientsService: ClientsService,
private productsService: ProductsService) { }
constructor(
private clientsService: ClientsService,
private productsService: ProductsService
) {}
/**
* Returns the clients actions data.
@@ -62,5 +63,4 @@ export class ClientActionsResolver implements Resolve<Object> {
return undefined;
}
}
}
@@ -13,18 +13,16 @@ import { ClientsService } from '../clients.service';
*/
@Injectable()
export class ClientAddressFieldConfigurationResolver implements Resolve<Object> {
/**
* @param {ClientsService} ClientsService Clients service.
*/
constructor(private clientsService: ClientsService) {}
/**
* @param {ClientsService} ClientsService Clients service.
*/
constructor(private clientsService: ClientsService) { }
/**
* Returns the Client Address Field Configuration.
* @returns {Observable<any>}
*/
resolve(): Observable<any> {
return this.clientsService.getAddressFieldConfiguration();
}
/**
* Returns the Client Address Field Configuration.
* @returns {Observable<any>}
*/
resolve(): Observable<any> {
return this.clientsService.getAddressFieldConfiguration();
}
}

Some files were not shown because too many files have changed in this diff Show More