build: Use prettier for typescript
Stop ignoring .ts files in prettier and fix existing issues.
This commit is contained in:
@@ -13,7 +13,6 @@ import { OrganizationService } from 'app/organization/organization.service';
|
||||
*/
|
||||
@Injectable()
|
||||
export class AdhocQueryTemplateResolver implements Resolve<Object> {
|
||||
|
||||
/**
|
||||
* @param {OrganizationService} organizationService Organization service.
|
||||
*/
|
||||
@@ -26,5 +25,4 @@ export class AdhocQueryTemplateResolver implements Resolve<Object> {
|
||||
resolve(): Observable<any> {
|
||||
return this.organizationService.getAdhocQueryTemplate();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -8,9 +8,8 @@ describe('AdhocQueryComponent', () => {
|
||||
|
||||
beforeEach(async(() => {
|
||||
TestBed.configureTestingModule({
|
||||
declarations: [ AdhocQueryComponent ]
|
||||
})
|
||||
.compileComponents();
|
||||
declarations: [AdhocQueryComponent]
|
||||
}).compileComponents();
|
||||
}));
|
||||
|
||||
beforeEach(() => {
|
||||
|
||||
@@ -17,11 +17,18 @@ import { of } from 'rxjs';
|
||||
styleUrls: ['./adhoc-query.component.scss']
|
||||
})
|
||||
export class AdhocQueryComponent implements OnInit {
|
||||
|
||||
/** Adhoc Queries data. */
|
||||
adhocQueriesData: any;
|
||||
/** Columns to be displayed in adhoc queries table. */
|
||||
displayedColumns: string[] = ['name', 'query', 'tableName', 'email', 'reportRunFrequency', 'isActive', 'createdBy'];
|
||||
displayedColumns: string[] = [
|
||||
'name',
|
||||
'query',
|
||||
'tableName',
|
||||
'email',
|
||||
'reportRunFrequency',
|
||||
'isActive',
|
||||
'createdBy'
|
||||
];
|
||||
/** Data source for adhoc queries table. */
|
||||
dataSource: MatTableDataSource<any>;
|
||||
|
||||
@@ -35,7 +42,7 @@ export class AdhocQueryComponent implements OnInit {
|
||||
* @param {ActivatedRoute} route Activated Route.
|
||||
*/
|
||||
constructor(private route: ActivatedRoute) {
|
||||
this.route.data.subscribe(( data: { adhocQueries: any }) => {
|
||||
this.route.data.subscribe((data: { adhocQueries: any }) => {
|
||||
this.adhocQueriesData = data.adhocQueries;
|
||||
});
|
||||
}
|
||||
@@ -77,5 +84,4 @@ export class AdhocQueryComponent implements OnInit {
|
||||
this.dataSource.paginator = this.paginator;
|
||||
this.dataSource.sort = this.sort;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -13,7 +13,6 @@ import { OrganizationService } from '../../organization.service';
|
||||
*/
|
||||
@Injectable()
|
||||
export class AdhocQueriesResolver implements Resolve<Object> {
|
||||
|
||||
/**
|
||||
* @param {OrganizationService} organizationService Organization service.
|
||||
*/
|
||||
@@ -26,5 +25,4 @@ export class AdhocQueriesResolver implements Resolve<Object> {
|
||||
resolve(): Observable<any> {
|
||||
return this.organizationService.getAdhocQueries();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -13,7 +13,6 @@ import { OrganizationService } from 'app/organization/organization.service';
|
||||
*/
|
||||
@Injectable()
|
||||
export class AdhocQueryAndTemplateResolver implements Resolve<Object> {
|
||||
|
||||
/**
|
||||
* @param {OrganizationService} organizationService Organization service.
|
||||
*/
|
||||
@@ -27,5 +26,4 @@ export class AdhocQueryAndTemplateResolver implements Resolve<Object> {
|
||||
const adhocQueryId = route.paramMap.get('id');
|
||||
return this.organizationService.getAdhocQueryAndTemplate(adhocQueryId);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -13,7 +13,6 @@ import { OrganizationService } from 'app/organization/organization.service';
|
||||
*/
|
||||
@Injectable()
|
||||
export class AdhocQueryResolver implements Resolve<Object> {
|
||||
|
||||
/**
|
||||
* @param {OrganizationService} organizationService Organization service.
|
||||
*/
|
||||
@@ -27,5 +26,4 @@ export class AdhocQueryResolver implements Resolve<Object> {
|
||||
const adhocQueryId = route.paramMap.get('id');
|
||||
return this.organizationService.getAdhocQuery(adhocQueryId);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
+2
-3
@@ -8,9 +8,8 @@ describe('CreateAdhocQueryComponent', () => {
|
||||
|
||||
beforeEach(async(() => {
|
||||
TestBed.configureTestingModule({
|
||||
declarations: [ CreateAdhocQueryComponent ]
|
||||
})
|
||||
.compileComponents();
|
||||
declarations: [CreateAdhocQueryComponent]
|
||||
}).compileComponents();
|
||||
}));
|
||||
|
||||
beforeEach(() => {
|
||||
|
||||
+42
-16
@@ -15,7 +15,6 @@ import { OrganizationService } from '../../organization.service';
|
||||
styleUrls: ['./create-adhoc-query.component.scss']
|
||||
})
|
||||
export class CreateAdhocQueryComponent implements OnInit {
|
||||
|
||||
/** Adhoc Query form. */
|
||||
adhocQueryForm: UntypedFormGroup;
|
||||
/** Adhoc Query template data. */
|
||||
@@ -30,10 +29,12 @@ export class CreateAdhocQueryComponent implements OnInit {
|
||||
* @param {ActivatedRoute} route Activated Route.
|
||||
* @param {Router} router Router for navigation.
|
||||
*/
|
||||
constructor(private formBuilder: UntypedFormBuilder,
|
||||
private organizationService: OrganizationService,
|
||||
private route: ActivatedRoute,
|
||||
private router: Router) {
|
||||
constructor(
|
||||
private formBuilder: UntypedFormBuilder,
|
||||
private organizationService: OrganizationService,
|
||||
private route: ActivatedRoute,
|
||||
private router: Router
|
||||
) {
|
||||
this.route.data.subscribe((data: { adhocQueryTemplate: any }) => {
|
||||
this.adhocQueryTemplateData = data.adhocQueryTemplate;
|
||||
});
|
||||
@@ -53,13 +54,28 @@ export class CreateAdhocQueryComponent implements OnInit {
|
||||
createAdhocQueryForm() {
|
||||
this.reportRunFrequencyData = this.adhocQueryTemplateData.reportRunFrequencies;
|
||||
this.adhocQueryForm = this.formBuilder.group({
|
||||
'name': ['', Validators.required],
|
||||
'query': ['', Validators.required],
|
||||
'tableName': ['', Validators.required],
|
||||
'tableFields': ['', Validators.required],
|
||||
'email': ['', Validators.email],
|
||||
'reportRunFrequency': [''],
|
||||
'isActive': [false]
|
||||
name: [
|
||||
'',
|
||||
Validators.required
|
||||
],
|
||||
query: [
|
||||
'',
|
||||
Validators.required
|
||||
],
|
||||
tableName: [
|
||||
'',
|
||||
Validators.required
|
||||
],
|
||||
tableFields: [
|
||||
'',
|
||||
Validators.required
|
||||
],
|
||||
email: [
|
||||
'',
|
||||
Validators.email
|
||||
],
|
||||
reportRunFrequency: [''],
|
||||
isActive: [false]
|
||||
});
|
||||
}
|
||||
|
||||
@@ -67,9 +83,14 @@ export class CreateAdhocQueryComponent implements OnInit {
|
||||
* Sets the conditional controls of the adhoc query form
|
||||
*/
|
||||
setConditionalControls() {
|
||||
this.adhocQueryForm.get('reportRunFrequency').valueChanges.subscribe(reportRunFrequencyId => {
|
||||
this.adhocQueryForm.get('reportRunFrequency').valueChanges.subscribe((reportRunFrequencyId) => {
|
||||
if (reportRunFrequencyId === 5) {
|
||||
this.adhocQueryForm.addControl('reportRunEvery', new UntypedFormControl('', [Validators.required, Validators.min(1)]));
|
||||
this.adhocQueryForm.addControl(
|
||||
'reportRunEvery',
|
||||
new UntypedFormControl('', [
|
||||
Validators.required,
|
||||
Validators.min(1)])
|
||||
);
|
||||
} else {
|
||||
this.adhocQueryForm.removeControl('reportRunEvery');
|
||||
}
|
||||
@@ -82,8 +103,13 @@ export class CreateAdhocQueryComponent implements OnInit {
|
||||
*/
|
||||
submit() {
|
||||
this.organizationService.createAdhocQuery(this.adhocQueryForm.value).subscribe((response: any) => {
|
||||
this.router.navigate(['../', response.resourceId], { relativeTo: this.route });
|
||||
this.router.navigate(
|
||||
[
|
||||
'../',
|
||||
response.resourceId
|
||||
],
|
||||
{ relativeTo: this.route }
|
||||
);
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
+2
-3
@@ -8,9 +8,8 @@ describe('EditAdhocQueryComponent', () => {
|
||||
|
||||
beforeEach(async(() => {
|
||||
TestBed.configureTestingModule({
|
||||
declarations: [ EditAdhocQueryComponent ]
|
||||
})
|
||||
.compileComponents();
|
||||
declarations: [EditAdhocQueryComponent]
|
||||
}).compileComponents();
|
||||
}));
|
||||
|
||||
beforeEach(() => {
|
||||
|
||||
@@ -15,7 +15,6 @@ import { OrganizationService } from '../../organization.service';
|
||||
styleUrls: ['./edit-adhoc-query.component.scss']
|
||||
})
|
||||
export class EditAdhocQueryComponent implements OnInit {
|
||||
|
||||
/** Edit Adhoc Query form. */
|
||||
editAdhocQueryForm: UntypedFormGroup;
|
||||
/** Adhoc Query template data. */
|
||||
@@ -30,10 +29,12 @@ export class EditAdhocQueryComponent implements OnInit {
|
||||
* @param {ActivatedRoute} route Activated Route.
|
||||
* @param {Router} router Router for navigation.
|
||||
*/
|
||||
constructor(private formBuilder: UntypedFormBuilder,
|
||||
private organizationService: OrganizationService,
|
||||
private route: ActivatedRoute,
|
||||
private router: Router) {
|
||||
constructor(
|
||||
private formBuilder: UntypedFormBuilder,
|
||||
private organizationService: OrganizationService,
|
||||
private route: ActivatedRoute,
|
||||
private router: Router
|
||||
) {
|
||||
this.route.data.subscribe((data: { adhocQueryAndTemplate: any }) => {
|
||||
this.adhocQueryTemplateData = data.adhocQueryAndTemplate;
|
||||
});
|
||||
@@ -53,13 +54,28 @@ export class EditAdhocQueryComponent implements OnInit {
|
||||
createEditAdhocQueryForm() {
|
||||
this.reportRunFrequencyData = this.adhocQueryTemplateData.reportRunFrequencies;
|
||||
this.editAdhocQueryForm = this.formBuilder.group({
|
||||
'name': [this.adhocQueryTemplateData.name, Validators.required],
|
||||
'query': [this.adhocQueryTemplateData.query, Validators.required],
|
||||
'tableName': [this.adhocQueryTemplateData.tableName, Validators.required],
|
||||
'tableFields': [this.adhocQueryTemplateData.tableFields, Validators.required],
|
||||
'email': [this.adhocQueryTemplateData.email, Validators.email],
|
||||
'reportRunFrequency': [''],
|
||||
'isActive': [this.adhocQueryTemplateData.isActive]
|
||||
name: [
|
||||
this.adhocQueryTemplateData.name,
|
||||
Validators.required
|
||||
],
|
||||
query: [
|
||||
this.adhocQueryTemplateData.query,
|
||||
Validators.required
|
||||
],
|
||||
tableName: [
|
||||
this.adhocQueryTemplateData.tableName,
|
||||
Validators.required
|
||||
],
|
||||
tableFields: [
|
||||
this.adhocQueryTemplateData.tableFields,
|
||||
Validators.required
|
||||
],
|
||||
email: [
|
||||
this.adhocQueryTemplateData.email,
|
||||
Validators.email
|
||||
],
|
||||
reportRunFrequency: [''],
|
||||
isActive: [this.adhocQueryTemplateData.isActive]
|
||||
});
|
||||
}
|
||||
|
||||
@@ -67,9 +83,14 @@ export class EditAdhocQueryComponent implements OnInit {
|
||||
* Sets the conditional controls of the adhoc query form
|
||||
*/
|
||||
setConditionalControls() {
|
||||
this.editAdhocQueryForm.get('reportRunFrequency').valueChanges.subscribe(reportRunFrequencyId => {
|
||||
this.editAdhocQueryForm.get('reportRunFrequency').valueChanges.subscribe((reportRunFrequencyId) => {
|
||||
if (reportRunFrequencyId === 5) {
|
||||
this.editAdhocQueryForm.addControl('reportRunEvery', new UntypedFormControl('', [Validators.required, Validators.min(1)]));
|
||||
this.editAdhocQueryForm.addControl(
|
||||
'reportRunEvery',
|
||||
new UntypedFormControl('', [
|
||||
Validators.required,
|
||||
Validators.min(1)])
|
||||
);
|
||||
this.editAdhocQueryForm.get('reportRunEvery').patchValue(this.adhocQueryTemplateData.reportRunEvery);
|
||||
} else {
|
||||
this.editAdhocQueryForm.removeControl('reportRunEvery');
|
||||
@@ -83,9 +104,10 @@ export class EditAdhocQueryComponent implements OnInit {
|
||||
* if successful redirects to view adhoc query.
|
||||
*/
|
||||
submit() {
|
||||
this.organizationService.updateAdhocQuery(this.adhocQueryTemplateData.id, this.editAdhocQueryForm.value).subscribe(() => {
|
||||
this.router.navigate(['../'], { relativeTo: this.route });
|
||||
});
|
||||
this.organizationService
|
||||
.updateAdhocQuery(this.adhocQueryTemplateData.id, this.editAdhocQueryForm.value)
|
||||
.subscribe(() => {
|
||||
this.router.navigate(['../'], { relativeTo: this.route });
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
+2
-3
@@ -8,9 +8,8 @@ describe('ViewAdhocQueryComponent', () => {
|
||||
|
||||
beforeEach(async(() => {
|
||||
TestBed.configureTestingModule({
|
||||
declarations: [ ViewAdhocQueryComponent ]
|
||||
})
|
||||
.compileComponents();
|
||||
declarations: [ViewAdhocQueryComponent]
|
||||
}).compileComponents();
|
||||
}));
|
||||
|
||||
beforeEach(() => {
|
||||
|
||||
@@ -18,7 +18,6 @@ import { DeleteDialogComponent } from 'app/shared/delete-dialog/delete-dialog.co
|
||||
styleUrls: ['./view-adhoc-query.component.scss']
|
||||
})
|
||||
export class ViewAdhocQueryComponent {
|
||||
|
||||
/** Adhoc query data. */
|
||||
adhocQueryData: any;
|
||||
|
||||
@@ -29,10 +28,12 @@ export class ViewAdhocQueryComponent {
|
||||
* @param {Router} router Router for navigation.
|
||||
* @param {MatDialog} dialog Dialog reference.
|
||||
*/
|
||||
constructor(private organizationService: OrganizationService,
|
||||
private route: ActivatedRoute,
|
||||
private router: Router,
|
||||
private dialog: MatDialog) {
|
||||
constructor(
|
||||
private organizationService: OrganizationService,
|
||||
private route: ActivatedRoute,
|
||||
private router: Router,
|
||||
private dialog: MatDialog
|
||||
) {
|
||||
this.route.data.subscribe((data: { adhocQuery: any }) => {
|
||||
this.adhocQueryData = data.adhocQuery;
|
||||
});
|
||||
@@ -59,12 +60,10 @@ export class ViewAdhocQueryComponent {
|
||||
});
|
||||
deleteAdhocQueryDialogRef.afterClosed().subscribe((response: any) => {
|
||||
if (response.delete) {
|
||||
this.organizationService.deleteAdhocQuery(this.adhocQueryData.id)
|
||||
.subscribe(() => {
|
||||
this.organizationService.deleteAdhocQuery(this.adhocQueryData.id).subscribe(() => {
|
||||
this.router.navigate(['/organization/adhoc-query']);
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -8,9 +8,8 @@ describe('BulkImportComponent', () => {
|
||||
|
||||
beforeEach(async(() => {
|
||||
TestBed.configureTestingModule({
|
||||
declarations: [ BulkImportComponent ]
|
||||
})
|
||||
.compileComponents();
|
||||
declarations: [BulkImportComponent]
|
||||
}).compileComponents();
|
||||
}));
|
||||
|
||||
beforeEach(() => {
|
||||
|
||||
@@ -16,14 +16,12 @@ import { BulkImports } from './view-bulk-import/bulk-imports';
|
||||
*/
|
||||
@Injectable()
|
||||
export class BulkImportResolver implements Resolve<Object> {
|
||||
|
||||
bulkImportsArray = BulkImports;
|
||||
bulkImportsArray = BulkImports;
|
||||
|
||||
/**
|
||||
* @param {OrganizationService} organizationService Organization service.
|
||||
*/
|
||||
constructor(private organizationService: OrganizationService) {
|
||||
}
|
||||
constructor(private organizationService: OrganizationService) {}
|
||||
|
||||
/**
|
||||
* Gets bulk-import's entity name
|
||||
@@ -42,5 +40,4 @@ export class BulkImportResolver implements Resolve<Object> {
|
||||
const entity = this.getEntityName(route.params['import-name']);
|
||||
return this.organizationService.getImports(entity);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,129 +1,129 @@
|
||||
/** TODO: Refactor Permissions */
|
||||
export const BulkImports = [
|
||||
{
|
||||
name: 'Offices',
|
||||
entityType: 'offices',
|
||||
urlSuffix: '/offices',
|
||||
permission: 'READ_OFFICE',
|
||||
formFields: 0
|
||||
},
|
||||
{
|
||||
name: 'Users',
|
||||
entityType: 'users',
|
||||
urlSuffix: '/users',
|
||||
permission: 'READ_CLIENT',
|
||||
formFields: 2
|
||||
},
|
||||
{
|
||||
name: 'Groups',
|
||||
entityType: 'groups',
|
||||
urlSuffix: '/groups',
|
||||
permission: 'READ_CLIENT',
|
||||
formFields: 2
|
||||
},
|
||||
{
|
||||
name: 'Centers',
|
||||
entityType: 'centers',
|
||||
urlSuffix: '/centers',
|
||||
permission: 'READ_CENTERS',
|
||||
formFields: 2
|
||||
},
|
||||
{
|
||||
name: 'Clients',
|
||||
entityType: 'client',
|
||||
urlSuffix: '/clients',
|
||||
permission: 'READ_CLIENT',
|
||||
formFields: 3
|
||||
},
|
||||
{
|
||||
name: 'Employees',
|
||||
entityType: 'staff',
|
||||
urlSuffix: '/staff',
|
||||
permission: 'READ_CLIENT',
|
||||
formFields: 1
|
||||
},
|
||||
{
|
||||
name: 'Guarantors',
|
||||
entityType: 'guarantors',
|
||||
urlSuffix: '/loans/1/guarantors',
|
||||
permission: 'READ_CLIENT',
|
||||
formFields: 1
|
||||
},
|
||||
{
|
||||
name: 'Journal Entries',
|
||||
entityType: 'gljournalentries',
|
||||
urlSuffix: '/journalentries',
|
||||
permission: 'READ_CLIENT',
|
||||
formFields: 1
|
||||
},
|
||||
{
|
||||
name: 'Loan Accounts',
|
||||
entityType: 'loans',
|
||||
urlSuffix: '/loans',
|
||||
permission: 'READ_CLIENT',
|
||||
formFields: 2
|
||||
},
|
||||
{
|
||||
name: 'Savings Accounts',
|
||||
entityType: 'savingsaccount',
|
||||
urlSuffix: '/savingsaccounts',
|
||||
permission: 'READ_CLIENT',
|
||||
formFields: 2
|
||||
},
|
||||
{
|
||||
name: 'Fixed Deposit Accounts',
|
||||
entityType: 'fixeddepositaccounts',
|
||||
urlSuffix: '/fixeddepositaccounts',
|
||||
permission: 'READ_CLIENT',
|
||||
formFields: 2
|
||||
},
|
||||
{
|
||||
name: 'Reccuring Deposit Accounts',
|
||||
entityType: 'recurringdeposits',
|
||||
urlSuffix: '/recurringdepositaccounts',
|
||||
permission: 'READ_CLIENT',
|
||||
formFields: 2
|
||||
},
|
||||
{
|
||||
name: 'Chart of Accounts',
|
||||
entityType: 'chartofaccounts',
|
||||
urlSuffix: '/glaccounts',
|
||||
permission: 'READ_CLIENT',
|
||||
formFields: 2
|
||||
},
|
||||
{
|
||||
name: 'Share Accounts',
|
||||
entityType: 'shareaccounts',
|
||||
urlSuffix: '/accounts/share',
|
||||
permission: 'READ_CLIENT',
|
||||
formFields: 1
|
||||
},
|
||||
{
|
||||
name: 'Loan Repayments',
|
||||
entityType: 'loantransactions',
|
||||
urlSuffix: '/loans/repayments',
|
||||
permission: 'READ_CLIENT',
|
||||
formFields: 1
|
||||
},
|
||||
{
|
||||
name: 'Savings Transactions',
|
||||
entityType: 'savingstransactions',
|
||||
urlSuffix: '/savingsaccounts/transactions',
|
||||
permission: 'READ_CLIENT',
|
||||
formFields: 1
|
||||
},
|
||||
{
|
||||
name: 'Fixed Deposit Transactions',
|
||||
entityType: 'fixeddeposittransactions',
|
||||
urlSuffix: '/fixeddepositaccounts/transaction',
|
||||
permission: 'READ_CLIENT',
|
||||
formFields: 1
|
||||
},
|
||||
{
|
||||
name: 'Recurring Deposit Transactions',
|
||||
entityType: 'recurringdepositstransactions',
|
||||
urlSuffix: '/recurringdepositaccounts/transactions',
|
||||
permission: 'READ_CLIENT',
|
||||
formFields: 1
|
||||
},
|
||||
];
|
||||
{
|
||||
name: 'Offices',
|
||||
entityType: 'offices',
|
||||
urlSuffix: '/offices',
|
||||
permission: 'READ_OFFICE',
|
||||
formFields: 0
|
||||
},
|
||||
{
|
||||
name: 'Users',
|
||||
entityType: 'users',
|
||||
urlSuffix: '/users',
|
||||
permission: 'READ_CLIENT',
|
||||
formFields: 2
|
||||
},
|
||||
{
|
||||
name: 'Groups',
|
||||
entityType: 'groups',
|
||||
urlSuffix: '/groups',
|
||||
permission: 'READ_CLIENT',
|
||||
formFields: 2
|
||||
},
|
||||
{
|
||||
name: 'Centers',
|
||||
entityType: 'centers',
|
||||
urlSuffix: '/centers',
|
||||
permission: 'READ_CENTERS',
|
||||
formFields: 2
|
||||
},
|
||||
{
|
||||
name: 'Clients',
|
||||
entityType: 'client',
|
||||
urlSuffix: '/clients',
|
||||
permission: 'READ_CLIENT',
|
||||
formFields: 3
|
||||
},
|
||||
{
|
||||
name: 'Employees',
|
||||
entityType: 'staff',
|
||||
urlSuffix: '/staff',
|
||||
permission: 'READ_CLIENT',
|
||||
formFields: 1
|
||||
},
|
||||
{
|
||||
name: 'Guarantors',
|
||||
entityType: 'guarantors',
|
||||
urlSuffix: '/loans/1/guarantors',
|
||||
permission: 'READ_CLIENT',
|
||||
formFields: 1
|
||||
},
|
||||
{
|
||||
name: 'Journal Entries',
|
||||
entityType: 'gljournalentries',
|
||||
urlSuffix: '/journalentries',
|
||||
permission: 'READ_CLIENT',
|
||||
formFields: 1
|
||||
},
|
||||
{
|
||||
name: 'Loan Accounts',
|
||||
entityType: 'loans',
|
||||
urlSuffix: '/loans',
|
||||
permission: 'READ_CLIENT',
|
||||
formFields: 2
|
||||
},
|
||||
{
|
||||
name: 'Savings Accounts',
|
||||
entityType: 'savingsaccount',
|
||||
urlSuffix: '/savingsaccounts',
|
||||
permission: 'READ_CLIENT',
|
||||
formFields: 2
|
||||
},
|
||||
{
|
||||
name: 'Fixed Deposit Accounts',
|
||||
entityType: 'fixeddepositaccounts',
|
||||
urlSuffix: '/fixeddepositaccounts',
|
||||
permission: 'READ_CLIENT',
|
||||
formFields: 2
|
||||
},
|
||||
{
|
||||
name: 'Reccuring Deposit Accounts',
|
||||
entityType: 'recurringdeposits',
|
||||
urlSuffix: '/recurringdepositaccounts',
|
||||
permission: 'READ_CLIENT',
|
||||
formFields: 2
|
||||
},
|
||||
{
|
||||
name: 'Chart of Accounts',
|
||||
entityType: 'chartofaccounts',
|
||||
urlSuffix: '/glaccounts',
|
||||
permission: 'READ_CLIENT',
|
||||
formFields: 2
|
||||
},
|
||||
{
|
||||
name: 'Share Accounts',
|
||||
entityType: 'shareaccounts',
|
||||
urlSuffix: '/accounts/share',
|
||||
permission: 'READ_CLIENT',
|
||||
formFields: 1
|
||||
},
|
||||
{
|
||||
name: 'Loan Repayments',
|
||||
entityType: 'loantransactions',
|
||||
urlSuffix: '/loans/repayments',
|
||||
permission: 'READ_CLIENT',
|
||||
formFields: 1
|
||||
},
|
||||
{
|
||||
name: 'Savings Transactions',
|
||||
entityType: 'savingstransactions',
|
||||
urlSuffix: '/savingsaccounts/transactions',
|
||||
permission: 'READ_CLIENT',
|
||||
formFields: 1
|
||||
},
|
||||
{
|
||||
name: 'Fixed Deposit Transactions',
|
||||
entityType: 'fixeddeposittransactions',
|
||||
urlSuffix: '/fixeddepositaccounts/transaction',
|
||||
permission: 'READ_CLIENT',
|
||||
formFields: 1
|
||||
},
|
||||
{
|
||||
name: 'Recurring Deposit Transactions',
|
||||
entityType: 'recurringdepositstransactions',
|
||||
urlSuffix: '/recurringdepositaccounts/transactions',
|
||||
permission: 'READ_CLIENT',
|
||||
formFields: 1
|
||||
}
|
||||
];
|
||||
|
||||
+2
-3
@@ -8,9 +8,8 @@ describe('ViewBulkImportComponent', () => {
|
||||
|
||||
beforeEach(async(() => {
|
||||
TestBed.configureTestingModule({
|
||||
declarations: [ ViewBulkImportComponent ]
|
||||
})
|
||||
.compileComponents();
|
||||
declarations: [ViewBulkImportComponent]
|
||||
}).compileComponents();
|
||||
}));
|
||||
|
||||
beforeEach(() => {
|
||||
|
||||
@@ -4,7 +4,7 @@ import { ActivatedRoute } from '@angular/router';
|
||||
import { MatPaginator } from '@angular/material/paginator';
|
||||
import { MatSort } from '@angular/material/sort';
|
||||
import { MatTableDataSource, MatTable } from '@angular/material/table';
|
||||
import { UntypedFormGroup, UntypedFormBuilder} from '@angular/forms';
|
||||
import { UntypedFormGroup, UntypedFormBuilder } from '@angular/forms';
|
||||
|
||||
/** Custom Imports */
|
||||
import { OrganizationService } from '../../organization.service';
|
||||
@@ -19,7 +19,6 @@ import { BulkImports } from './bulk-imports';
|
||||
styleUrls: ['./view-bulk-import.component.scss']
|
||||
})
|
||||
export class ViewBulkImportComponent implements OnInit {
|
||||
|
||||
/** offices Data */
|
||||
officeData: any;
|
||||
/** staff Data */
|
||||
@@ -37,8 +36,7 @@ export class ViewBulkImportComponent implements OnInit {
|
||||
/** Data source for imports table. */
|
||||
dataSource = new MatTableDataSource();
|
||||
/** Columns to be displayed in imports table. */
|
||||
displayedColumns: string[] =
|
||||
[
|
||||
displayedColumns: string[] = [
|
||||
'name',
|
||||
'importTime',
|
||||
'endTime',
|
||||
@@ -62,12 +60,13 @@ export class ViewBulkImportComponent implements OnInit {
|
||||
* @param {FormBuilder} formBuilder FormBuilder
|
||||
* @param {OrganizationService} organizationService OrganizationService
|
||||
*/
|
||||
constructor(private route: ActivatedRoute,
|
||||
private formBuilder: UntypedFormBuilder,
|
||||
private organizationService: OrganizationService,
|
||||
) {
|
||||
constructor(
|
||||
private route: ActivatedRoute,
|
||||
private formBuilder: UntypedFormBuilder,
|
||||
private organizationService: OrganizationService
|
||||
) {
|
||||
this.bulkImport.name = this.route.snapshot.params['import-name'];
|
||||
this.route.data.subscribe( (data: any) => {
|
||||
this.route.data.subscribe((data: any) => {
|
||||
this.officeData = data.offices;
|
||||
this.importsData = data.imports;
|
||||
});
|
||||
@@ -77,7 +76,7 @@ export class ViewBulkImportComponent implements OnInit {
|
||||
* Gets bulk import's properties.
|
||||
*/
|
||||
ngOnInit() {
|
||||
this.bulkImport = this.bulkImportsArray.find( (entry) => entry.name === this.bulkImport.name);
|
||||
this.bulkImport = this.bulkImportsArray.find((entry) => entry.name === this.bulkImport.name);
|
||||
this.createBulkImportForm();
|
||||
this.buildDependencies();
|
||||
this.setImports();
|
||||
@@ -88,9 +87,9 @@ export class ViewBulkImportComponent implements OnInit {
|
||||
*/
|
||||
createBulkImportForm() {
|
||||
this.bulkImportForm = this.formBuilder.group({
|
||||
'officeId': [''],
|
||||
'staffId': [''],
|
||||
'legalForm': [''],
|
||||
officeId: [''],
|
||||
staffId: [''],
|
||||
legalForm: ['']
|
||||
});
|
||||
}
|
||||
|
||||
@@ -100,7 +99,7 @@ export class ViewBulkImportComponent implements OnInit {
|
||||
buildDependencies() {
|
||||
this.bulkImportForm.get('officeId').valueChanges.subscribe((value: any) => {
|
||||
if (this.bulkImport.formFields >= 2) {
|
||||
this.organizationService.getStaff(value).subscribe( (data: any) => {
|
||||
this.organizationService.getStaff(value).subscribe((data: any) => {
|
||||
this.staffData = data;
|
||||
});
|
||||
}
|
||||
@@ -126,18 +125,20 @@ export class ViewBulkImportComponent implements OnInit {
|
||||
/** Only for Client Bulk Imports */
|
||||
switch (this.bulkImportForm.get('legalForm').value) {
|
||||
case 'Person':
|
||||
legalFormType = 'CLIENTS_PERSON';
|
||||
legalFormType = 'CLIENTS_PERSON';
|
||||
break;
|
||||
case 'Entity':
|
||||
legalFormType = 'CLIENTS_ENTITY';
|
||||
legalFormType = 'CLIENTS_ENTITY';
|
||||
break;
|
||||
}
|
||||
this.organizationService.getImportTemplate(this.bulkImport.urlSuffix, officeId, staffId, legalFormType).subscribe( (res: any) => {
|
||||
const contentType = res.headers.get('Content-Type');
|
||||
const blob = new Blob([res.body], { type: contentType });
|
||||
const fileOfBlob = new File([blob], 'template.xls', { type: contentType });
|
||||
window.open(window.URL.createObjectURL(fileOfBlob));
|
||||
});
|
||||
this.organizationService
|
||||
.getImportTemplate(this.bulkImport.urlSuffix, officeId, staffId, legalFormType)
|
||||
.subscribe((res: any) => {
|
||||
const contentType = res.headers.get('Content-Type');
|
||||
const blob = new Blob([res.body], { type: contentType });
|
||||
const fileOfBlob = new File([blob], 'template.xls', { type: contentType });
|
||||
window.open(window.URL.createObjectURL(fileOfBlob));
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -163,15 +164,17 @@ export class ViewBulkImportComponent implements OnInit {
|
||||
legalFormType = 'CLIENTS_PERSON';
|
||||
}
|
||||
}
|
||||
this.organizationService.uploadImportDocument(this.template, this.bulkImport.urlSuffix, legalFormType).subscribe(() => {});
|
||||
this.organizationService
|
||||
.uploadImportDocument(this.template, this.bulkImport.urlSuffix, legalFormType)
|
||||
.subscribe(() => {});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reloads imports data table.
|
||||
*/
|
||||
refreshDocuments() {
|
||||
this.organizationService.getImports(this.bulkImport.entityType).subscribe( (data: any) => {
|
||||
this.dataSource = new MatTableDataSource(data);
|
||||
this.organizationService.getImports(this.bulkImport.entityType).subscribe((data: any) => {
|
||||
this.dataSource = new MatTableDataSource(data);
|
||||
this.importsTableRef.renderRows();
|
||||
});
|
||||
}
|
||||
@@ -182,12 +185,11 @@ export class ViewBulkImportComponent implements OnInit {
|
||||
* @param {any} id ImportID
|
||||
*/
|
||||
downloadDocument(name: string, id: any) {
|
||||
this.organizationService.getImportDocument(id).subscribe( (res: any) => {
|
||||
this.organizationService.getImportDocument(id).subscribe((res: any) => {
|
||||
const contentType = res.headers.get('Content-Type');
|
||||
const blob = new Blob([res.body], { type: contentType });
|
||||
const fileOfBlob = new File([blob], name, { type: contentType });
|
||||
window.open(window.URL.createObjectURL(fileOfBlob));
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
+2
-3
@@ -8,9 +8,8 @@ describe('BulkLoanReassignmnetComponent', () => {
|
||||
|
||||
beforeEach(async(() => {
|
||||
TestBed.configureTestingModule({
|
||||
declarations: [ BulkLoanReassignmnetComponent ]
|
||||
})
|
||||
.compileComponents();
|
||||
declarations: [BulkLoanReassignmnetComponent]
|
||||
}).compileComponents();
|
||||
}));
|
||||
|
||||
beforeEach(() => {
|
||||
|
||||
@@ -17,7 +17,6 @@ import { Dates } from 'app/core/utils/dates';
|
||||
styleUrls: ['./bulk-loan-reassignmnet.component.scss']
|
||||
})
|
||||
export class BulkLoanReassignmnetComponent implements OnInit {
|
||||
|
||||
/** Bulk Loan form. */
|
||||
bulkLoanForm: UntypedFormGroup;
|
||||
/** Office data. */
|
||||
@@ -45,13 +44,15 @@ export class BulkLoanReassignmnetComponent implements OnInit {
|
||||
* @param {SettingsService} settingsService Settings Service.
|
||||
* @param {Router} router Router.
|
||||
*/
|
||||
constructor(private formBuilder: UntypedFormBuilder,
|
||||
private route: ActivatedRoute,
|
||||
private organizationSevice: OrganizationService,
|
||||
private settingsService: SettingsService,
|
||||
private dateUtils: Dates,
|
||||
private router: Router) {
|
||||
this.route.data.subscribe((data: { offices: any} ) => {
|
||||
constructor(
|
||||
private formBuilder: UntypedFormBuilder,
|
||||
private route: ActivatedRoute,
|
||||
private organizationSevice: OrganizationService,
|
||||
private settingsService: SettingsService,
|
||||
private dateUtils: Dates,
|
||||
private router: Router
|
||||
) {
|
||||
this.route.data.subscribe((data: { offices: any }) => {
|
||||
this.offices = data.offices;
|
||||
});
|
||||
}
|
||||
@@ -66,8 +67,14 @@ export class BulkLoanReassignmnetComponent implements OnInit {
|
||||
*/
|
||||
setBulkLoanForm() {
|
||||
this.bulkLoanForm = this.formBuilder.group({
|
||||
'assignmentDate': [new Date(), Validators.required],
|
||||
'toLoanOfficerId': ['', Validators.required]
|
||||
assignmentDate: [
|
||||
new Date(),
|
||||
Validators.required
|
||||
],
|
||||
toLoanOfficerId: [
|
||||
'',
|
||||
Validators.required
|
||||
]
|
||||
});
|
||||
}
|
||||
|
||||
@@ -88,7 +95,7 @@ export class BulkLoanReassignmnetComponent implements OnInit {
|
||||
* @param officerId Office Id.
|
||||
*/
|
||||
getFromOfficers(officerId: any) {
|
||||
this.toLoanOfficers = this.fromLoanOfficers.filter((officer: any) => officer.id !== officerId );
|
||||
this.toLoanOfficers = this.fromLoanOfficers.filter((officer: any) => officer.id !== officerId);
|
||||
this.organizationSevice.getOfficerTemplate(officerId, this.officeTemplate.id).subscribe((response: any) => {
|
||||
this.officerTemplate = response;
|
||||
});
|
||||
@@ -130,5 +137,4 @@ export class BulkLoanReassignmnetComponent implements OnInit {
|
||||
this.router.navigate(['../'], { relativeTo: this.route });
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -8,9 +8,8 @@ describe('CurrenciesComponent', () => {
|
||||
|
||||
beforeEach(async(() => {
|
||||
TestBed.configureTestingModule({
|
||||
declarations: [ CurrenciesComponent ]
|
||||
})
|
||||
.compileComponents();
|
||||
declarations: [CurrenciesComponent]
|
||||
}).compileComponents();
|
||||
}));
|
||||
|
||||
beforeEach(() => {
|
||||
|
||||
@@ -20,12 +20,14 @@ import { ConfigurationWizardService } from '../../configuration-wizard/configura
|
||||
templateUrl: './currencies.component.html',
|
||||
styleUrls: ['./currencies.component.scss']
|
||||
})
|
||||
export class CurrenciesComponent implements OnInit, AfterViewInit {
|
||||
|
||||
export class CurrenciesComponent implements OnInit, AfterViewInit {
|
||||
/** Currencies data. */
|
||||
currenciesData: any;
|
||||
/** Columns to be displayed in currencies table. */
|
||||
displayedColumns: string[] = ['name', 'code'];
|
||||
displayedColumns: string[] = [
|
||||
'name',
|
||||
'code'
|
||||
];
|
||||
/** Data source for currencies table. */
|
||||
dataSource: MatTableDataSource<any>;
|
||||
|
||||
@@ -50,11 +52,13 @@ export class CurrenciesComponent implements OnInit, AfterViewInit {
|
||||
* @param {ConfigurationWizardService} configurationWizardService ConfigurationWizard Service.
|
||||
* @param {PopoverService} popoverService PopoverService.
|
||||
*/
|
||||
constructor(private route: ActivatedRoute,
|
||||
private router: Router,
|
||||
private configurationWizardService: ConfigurationWizardService,
|
||||
private popoverService: PopoverService) {
|
||||
this.route.data.subscribe(( data: { currencies: any }) => {
|
||||
constructor(
|
||||
private route: ActivatedRoute,
|
||||
private router: Router,
|
||||
private configurationWizardService: ConfigurationWizardService,
|
||||
private popoverService: PopoverService
|
||||
) {
|
||||
this.route.data.subscribe((data: { currencies: any }) => {
|
||||
this.currenciesData = data.currencies.selectedCurrencyOptions;
|
||||
});
|
||||
}
|
||||
@@ -90,7 +94,12 @@ export class CurrenciesComponent implements OnInit, AfterViewInit {
|
||||
* @param position String.
|
||||
* @param backdrop Boolean.
|
||||
*/
|
||||
showPopover(template: TemplateRef<any>, target: HTMLElement | ElementRef<any>, position: string, backdrop: boolean): void {
|
||||
showPopover(
|
||||
template: TemplateRef<any>,
|
||||
target: HTMLElement | ElementRef<any>,
|
||||
position: string,
|
||||
backdrop: boolean
|
||||
): void {
|
||||
setTimeout(() => this.popoverService.open(template, target, position, backdrop, {}), 200);
|
||||
}
|
||||
|
||||
@@ -100,13 +109,13 @@ export class CurrenciesComponent implements OnInit, AfterViewInit {
|
||||
ngAfterViewInit() {
|
||||
if (this.configurationWizardService.showCurrencyPage === true) {
|
||||
setTimeout(() => {
|
||||
this.showPopover(this.templateButtonAddEdit, this.buttonAddEdit.nativeElement, 'bottom', true);
|
||||
this.showPopover(this.templateButtonAddEdit, this.buttonAddEdit.nativeElement, 'bottom', true);
|
||||
});
|
||||
}
|
||||
|
||||
if (this.configurationWizardService.showCurrencyList === true) {
|
||||
setTimeout(() => {
|
||||
this.showPopover(this.templateTableCurrencies, this.tableCurrencies.nativeElement, 'top', true);
|
||||
this.showPopover(this.templateTableCurrencies, this.tableCurrencies.nativeElement, 'top', true);
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -130,5 +139,4 @@ export class CurrenciesComponent implements OnInit, AfterViewInit {
|
||||
this.configurationWizardService.showAddEditCurrency = true;
|
||||
this.router.navigate(['/organization']);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -13,7 +13,6 @@ import { OrganizationService } from '../organization.service';
|
||||
*/
|
||||
@Injectable()
|
||||
export class CurrenciesResolver implements Resolve<Object> {
|
||||
|
||||
/**
|
||||
* @param {OrganizationService} organizationService Organization service.
|
||||
*/
|
||||
@@ -26,5 +25,4 @@ export class CurrenciesResolver implements Resolve<Object> {
|
||||
resolve(): Observable<any> {
|
||||
return this.organizationService.getCurrencies();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
+2
-3
@@ -8,9 +8,8 @@ describe('ManageCurrenciesComponent', () => {
|
||||
|
||||
beforeEach(async(() => {
|
||||
TestBed.configureTestingModule({
|
||||
declarations: [ ManageCurrenciesComponent ]
|
||||
})
|
||||
.compileComponents();
|
||||
declarations: [ManageCurrenciesComponent]
|
||||
}).compileComponents();
|
||||
}));
|
||||
|
||||
beforeEach(() => {
|
||||
|
||||
@@ -1,5 +1,15 @@
|
||||
/** Angular Imports */
|
||||
import { Component, OnInit, TemplateRef, ElementRef, ViewChild, AfterViewInit, OnDestroy, OnChanges, SimpleChanges } from '@angular/core';
|
||||
import {
|
||||
Component,
|
||||
OnInit,
|
||||
TemplateRef,
|
||||
ElementRef,
|
||||
ViewChild,
|
||||
AfterViewInit,
|
||||
OnDestroy,
|
||||
OnChanges,
|
||||
SimpleChanges
|
||||
} from '@angular/core';
|
||||
import { ActivatedRoute, Router } from '@angular/router';
|
||||
import { MatDialog } from '@angular/material/dialog';
|
||||
import { UntypedFormBuilder, UntypedFormControl, Validators } from '@angular/forms';
|
||||
@@ -27,7 +37,6 @@ import { Currency } from 'app/shared/models/general.model';
|
||||
styleUrls: ['./manage-currencies.component.scss']
|
||||
})
|
||||
export class ManageCurrenciesComponent implements OnInit, AfterViewInit, OnDestroy, OnChanges {
|
||||
|
||||
/** Selected Currencies data. */
|
||||
selectedCurrencies: any[];
|
||||
/** Currency options data */
|
||||
@@ -56,23 +65,23 @@ export class ManageCurrenciesComponent implements OnInit, AfterViewInit, OnDestr
|
||||
* @param {OrganizationService} organizationservice Organization Service
|
||||
* @param {MatDialog} dialog Mat Dialog
|
||||
*/
|
||||
constructor(private route: ActivatedRoute,
|
||||
private formBuilder: UntypedFormBuilder,
|
||||
private organizationservice: OrganizationService,
|
||||
public dialog: MatDialog,
|
||||
private router: Router,
|
||||
private configurationWizardService: ConfigurationWizardService,
|
||||
private popoverService: PopoverService) {
|
||||
this.route.parent.data.subscribe(( data: { currencies: any }) => {
|
||||
constructor(
|
||||
private route: ActivatedRoute,
|
||||
private formBuilder: UntypedFormBuilder,
|
||||
private organizationservice: OrganizationService,
|
||||
public dialog: MatDialog,
|
||||
private router: Router,
|
||||
private configurationWizardService: ConfigurationWizardService,
|
||||
private popoverService: PopoverService
|
||||
) {
|
||||
this.route.parent.data.subscribe((data: { currencies: any }) => {
|
||||
this.selectedCurrencies = data.currencies.selectedCurrencyOptions;
|
||||
this.currencyList = data.currencies.currencyOptions;
|
||||
});
|
||||
}
|
||||
|
||||
ngOnInit() {
|
||||
this.filterFormCtrl.valueChanges
|
||||
.pipe(takeUntil(this._onDestroy))
|
||||
.subscribe(() => {
|
||||
this.filterFormCtrl.valueChanges.pipe(takeUntil(this._onDestroy)).subscribe(() => {
|
||||
this.searchItem();
|
||||
});
|
||||
this.createCurrencyForm();
|
||||
@@ -94,7 +103,10 @@ export class ManageCurrenciesComponent implements OnInit, AfterViewInit, OnDestr
|
||||
*/
|
||||
createCurrencyForm() {
|
||||
this.currencyForm = this.formBuilder.group({
|
||||
'currency': ['', Validators.required]
|
||||
currency: [
|
||||
'',
|
||||
Validators.required
|
||||
]
|
||||
});
|
||||
}
|
||||
|
||||
@@ -103,11 +115,13 @@ export class ManageCurrenciesComponent implements OnInit, AfterViewInit, OnDestr
|
||||
const search: string = this.filterFormCtrl.value.toLowerCase();
|
||||
|
||||
if (!search) {
|
||||
this.currencyData.next(this.currencyList.slice());
|
||||
this.currencyData.next(this.currencyList.slice());
|
||||
} else {
|
||||
this.currencyData.next(this.currencyList.filter((option: Currency) => {
|
||||
return option.name.toLowerCase().indexOf(search) >= 0 || option.code.toLowerCase().indexOf(search) >= 0;
|
||||
}));
|
||||
this.currencyData.next(
|
||||
this.currencyList.filter((option: Currency) => {
|
||||
return option.name.toLowerCase().indexOf(search) >= 0 || option.code.toLowerCase().indexOf(search) >= 0;
|
||||
})
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -117,18 +131,17 @@ export class ManageCurrenciesComponent implements OnInit, AfterViewInit, OnDestr
|
||||
*/
|
||||
addCurrency() {
|
||||
const newCurrency = this.currencyForm.value.currency;
|
||||
const selectedCurrencyCodes: any[] = this.selectedCurrencies.map(currency => currency.code);
|
||||
const selectedCurrencyCodes: any[] = this.selectedCurrencies.map((currency) => currency.code);
|
||||
if (!selectedCurrencyCodes.includes(newCurrency.code)) {
|
||||
selectedCurrencyCodes.push(newCurrency.code);
|
||||
this.organizationservice.updateCurrencies(selectedCurrencyCodes)
|
||||
.subscribe((response: any) => {
|
||||
this.selectedCurrencies.push(newCurrency);
|
||||
this.formRef.resetForm();
|
||||
if (this.configurationWizardService.showCurrencyForm === true) {
|
||||
this.configurationWizardService.showCurrencyForm = false;
|
||||
this.openDialog();
|
||||
}
|
||||
});
|
||||
this.organizationservice.updateCurrencies(selectedCurrencyCodes).subscribe((response: any) => {
|
||||
this.selectedCurrencies.push(newCurrency);
|
||||
this.formRef.resetForm();
|
||||
if (this.configurationWizardService.showCurrencyForm === true) {
|
||||
this.configurationWizardService.showCurrencyForm = false;
|
||||
this.openDialog();
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@@ -138,30 +151,34 @@ export class ManageCurrenciesComponent implements OnInit, AfterViewInit, OnDestr
|
||||
* @param {number} index Index
|
||||
*/
|
||||
deleteCurrency(currencyCode: string, index: number) {
|
||||
const selectedCurrencyCodes: any[] = this.selectedCurrencies.map(currency => currency.code);
|
||||
const selectedCurrencyCodes: any[] = this.selectedCurrencies.map((currency) => currency.code);
|
||||
selectedCurrencyCodes.splice(index, 1);
|
||||
const deleteCurrencyDialogRef = this.dialog.open(DeleteDialogComponent, {
|
||||
data: { deleteContext: `currency: ${currencyCode}` }
|
||||
});
|
||||
deleteCurrencyDialogRef.afterClosed().subscribe((response: any) => {
|
||||
if (response.delete) {
|
||||
this.organizationservice.updateCurrencies(selectedCurrencyCodes)
|
||||
.subscribe(() => {
|
||||
this.selectedCurrencies.splice(index, 1);
|
||||
this.formRef.resetForm();
|
||||
});
|
||||
this.organizationservice.updateCurrencies(selectedCurrencyCodes).subscribe(() => {
|
||||
this.selectedCurrencies.splice(index, 1);
|
||||
this.formRef.resetForm();
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
showPopover(template: TemplateRef<any>, target: HTMLElement | ElementRef<any>, position: string, backdrop: boolean): void {
|
||||
showPopover(
|
||||
template: TemplateRef<any>,
|
||||
target: HTMLElement | ElementRef<any>,
|
||||
position: string,
|
||||
backdrop: boolean
|
||||
): void {
|
||||
setTimeout(() => this.popoverService.open(template, target, position, backdrop, {}), 200);
|
||||
}
|
||||
|
||||
ngAfterViewInit() {
|
||||
if (this.configurationWizardService.showCurrencyForm === true) {
|
||||
setTimeout(() => {
|
||||
this.showPopover(this.templateCurrencyFormRef, this.currencyFormRef.nativeElement, 'bottom', true);
|
||||
this.showPopover(this.templateCurrencyFormRef, this.currencyFormRef.nativeElement, 'bottom', true);
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -182,10 +199,10 @@ export class ManageCurrenciesComponent implements OnInit, AfterViewInit, OnDestr
|
||||
const continueSetupDialogRef = this.dialog.open(ContinueSetupDialogComponent, {
|
||||
data: {
|
||||
stepName: 'currency'
|
||||
},
|
||||
}
|
||||
});
|
||||
continueSetupDialogRef.afterClosed().subscribe((response: { step: number }) => {
|
||||
if (response.step === 1) {
|
||||
if (response.step === 1) {
|
||||
this.configurationWizardService.showCurrencyForm = false;
|
||||
this.router.navigate(['../'], { relativeTo: this.route });
|
||||
} else if (response.step === 2) {
|
||||
|
||||
@@ -8,9 +8,8 @@ describe('CreateEmployeeComponent', () => {
|
||||
|
||||
beforeEach(async(() => {
|
||||
TestBed.configureTestingModule({
|
||||
declarations: [ CreateEmployeeComponent ]
|
||||
})
|
||||
.compileComponents();
|
||||
declarations: [CreateEmployeeComponent]
|
||||
}).compileComponents();
|
||||
}));
|
||||
|
||||
beforeEach(() => {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/** Angular Imports */
|
||||
import { Component, OnInit , TemplateRef, ElementRef, ViewChild, AfterViewInit } from '@angular/core';
|
||||
import { Component, OnInit, TemplateRef, ElementRef, ViewChild, AfterViewInit } from '@angular/core';
|
||||
import { UntypedFormGroup, UntypedFormBuilder, Validators } from '@angular/forms';
|
||||
import { Router, ActivatedRoute } from '@angular/router';
|
||||
|
||||
@@ -23,7 +23,6 @@ import { ContinueSetupDialogComponent } from '../../../configuration-wizard/cont
|
||||
styleUrls: ['./create-employee.component.scss']
|
||||
})
|
||||
export class CreateEmployeeComponent implements OnInit, AfterViewInit {
|
||||
|
||||
/** Minimum joining date allowed. */
|
||||
minDate = new Date(2000, 0, 1);
|
||||
/** Maximum joining date allowed. */
|
||||
@@ -50,15 +49,17 @@ export class CreateEmployeeComponent implements OnInit, AfterViewInit {
|
||||
* @param {PopoverService} popoverService PopoverService.
|
||||
* @param {MatDialog} dialog MatDialog.
|
||||
*/
|
||||
constructor(private formBuilder: UntypedFormBuilder,
|
||||
private organizationService: OrganizationService,
|
||||
private settingsService: SettingsService,
|
||||
private route: ActivatedRoute,
|
||||
private router: Router,
|
||||
private dateUtils: Dates,
|
||||
private configurationWizardService: ConfigurationWizardService,
|
||||
private popoverService: PopoverService,
|
||||
public dialog: MatDialog) {
|
||||
constructor(
|
||||
private formBuilder: UntypedFormBuilder,
|
||||
private organizationService: OrganizationService,
|
||||
private settingsService: SettingsService,
|
||||
private route: ActivatedRoute,
|
||||
private router: Router,
|
||||
private dateUtils: Dates,
|
||||
private configurationWizardService: ConfigurationWizardService,
|
||||
private popoverService: PopoverService,
|
||||
public dialog: MatDialog
|
||||
) {
|
||||
this.route.data.subscribe((data: { offices: any }) => {
|
||||
this.officeData = data.offices;
|
||||
});
|
||||
@@ -77,12 +78,28 @@ export class CreateEmployeeComponent implements OnInit, AfterViewInit {
|
||||
*/
|
||||
createEmployeeForm() {
|
||||
this.employeeForm = this.formBuilder.group({
|
||||
'officeId': ['', Validators.required],
|
||||
'firstname': ['', [Validators.required, Validators.pattern('(^[A-z]).*')]],
|
||||
'lastname': ['', [Validators.required, Validators.pattern('(^[A-z]).*')]],
|
||||
'isLoanOfficer': [false],
|
||||
'mobileNo': [''],
|
||||
'joiningDate': ['', Validators.required],
|
||||
officeId: [
|
||||
'',
|
||||
Validators.required
|
||||
],
|
||||
firstname: [
|
||||
'',
|
||||
[
|
||||
Validators.required,
|
||||
Validators.pattern('(^[A-z]).*')]
|
||||
],
|
||||
lastname: [
|
||||
'',
|
||||
[
|
||||
Validators.required,
|
||||
Validators.pattern('(^[A-z]).*')]
|
||||
],
|
||||
isLoanOfficer: [false],
|
||||
mobileNo: [''],
|
||||
joiningDate: [
|
||||
'',
|
||||
Validators.required
|
||||
]
|
||||
});
|
||||
}
|
||||
|
||||
@@ -120,7 +137,12 @@ export class CreateEmployeeComponent implements OnInit, AfterViewInit {
|
||||
* @param position String.
|
||||
* @param backdrop Boolean.
|
||||
*/
|
||||
showPopover(template: TemplateRef<any>, target: HTMLElement | ElementRef<any>, position: string, backdrop: boolean): void {
|
||||
showPopover(
|
||||
template: TemplateRef<any>,
|
||||
target: HTMLElement | ElementRef<any>,
|
||||
position: string,
|
||||
backdrop: boolean
|
||||
): void {
|
||||
setTimeout(() => this.popoverService.open(template, target, position, backdrop, {}), 200);
|
||||
}
|
||||
|
||||
@@ -130,7 +152,7 @@ export class CreateEmployeeComponent implements OnInit, AfterViewInit {
|
||||
ngAfterViewInit() {
|
||||
if (this.configurationWizardService.showEmployeeForm === true) {
|
||||
setTimeout(() => {
|
||||
this.showPopover(this.templateCreateEmployeeForm, this.createEmployeeFormRef.nativeElement, 'right', true);
|
||||
this.showPopover(this.templateCreateEmployeeForm, this.createEmployeeFormRef.nativeElement, 'right', true);
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -160,7 +182,7 @@ export class CreateEmployeeComponent implements OnInit, AfterViewInit {
|
||||
const continueSetupDialogRef = this.dialog.open(ContinueSetupDialogComponent, {
|
||||
data: {
|
||||
stepName: 'employee'
|
||||
},
|
||||
}
|
||||
});
|
||||
continueSetupDialogRef.afterClosed().subscribe((response: { step: number }) => {
|
||||
if (response.step === 1) {
|
||||
@@ -178,5 +200,4 @@ export class CreateEmployeeComponent implements OnInit, AfterViewInit {
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -13,7 +13,6 @@ import { OrganizationService } from '../organization.service';
|
||||
*/
|
||||
@Injectable()
|
||||
export class EditEmployeeResolver implements Resolve<Object> {
|
||||
|
||||
/**
|
||||
* @param {OrganizationService} organizationService Organization service.
|
||||
*/
|
||||
@@ -24,8 +23,7 @@ export class EditEmployeeResolver implements Resolve<Object> {
|
||||
* @returns {Observable<any>}
|
||||
*/
|
||||
resolve(route: ActivatedRouteSnapshot): Observable<any> {
|
||||
const employeeId = route.paramMap.get('id');
|
||||
const employeeId = route.paramMap.get('id');
|
||||
return this.organizationService.getEmployee(employeeId);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -8,9 +8,8 @@ describe('EditEmployeeComponent', () => {
|
||||
|
||||
beforeEach(async(() => {
|
||||
TestBed.configureTestingModule({
|
||||
declarations: [ EditEmployeeComponent ]
|
||||
})
|
||||
.compileComponents();
|
||||
declarations: [EditEmployeeComponent]
|
||||
}).compileComponents();
|
||||
}));
|
||||
|
||||
beforeEach(() => {
|
||||
|
||||
@@ -17,7 +17,6 @@ import { Dates } from 'app/core/utils/dates';
|
||||
styleUrls: ['./edit-employee.component.scss']
|
||||
})
|
||||
export class EditEmployeeComponent implements OnInit {
|
||||
|
||||
/** Employee data. */
|
||||
employeeData: any;
|
||||
/** Minimum joining date allowed. */
|
||||
@@ -38,13 +37,15 @@ export class EditEmployeeComponent implements OnInit {
|
||||
* @param {Router} router Router for navigation.
|
||||
* @param {Dates} dateUtils Date Utils to format date.
|
||||
*/
|
||||
constructor(private formBuilder: UntypedFormBuilder,
|
||||
private organizationService: OrganizationService,
|
||||
private settingsService: SettingsService,
|
||||
private route: ActivatedRoute,
|
||||
private router: Router,
|
||||
private dateUtils: Dates) {
|
||||
this.route.data.subscribe((data: { employee: any, offices: any }) => {
|
||||
constructor(
|
||||
private formBuilder: UntypedFormBuilder,
|
||||
private organizationService: OrganizationService,
|
||||
private settingsService: SettingsService,
|
||||
private route: ActivatedRoute,
|
||||
private router: Router,
|
||||
private dateUtils: Dates
|
||||
) {
|
||||
this.route.data.subscribe((data: { employee: any; offices: any }) => {
|
||||
this.employeeData = data.employee;
|
||||
this.officeData = data.employee.allowedOffices;
|
||||
});
|
||||
@@ -63,13 +64,29 @@ export class EditEmployeeComponent implements OnInit {
|
||||
*/
|
||||
createEditEmployeeForm() {
|
||||
this.editEmployeeForm = this.formBuilder.group({
|
||||
'officeId': [this.employeeData.officeId, Validators.required],
|
||||
'firstname': [this.employeeData.firstname, [Validators.required, Validators.pattern('(^[A-z]).*')]],
|
||||
'lastname': [this.employeeData.lastname, [Validators.required, Validators.pattern('(^[A-z]).*')]],
|
||||
'isLoanOfficer': [this.employeeData.isLoanOfficer],
|
||||
'mobileNo': [this.employeeData.mobileNo],
|
||||
'isActive': [this.employeeData.isActive],
|
||||
'joiningDate': [this.employeeData.joiningDate && new Date(this.employeeData.joiningDate), Validators.required]
|
||||
officeId: [
|
||||
this.employeeData.officeId,
|
||||
Validators.required
|
||||
],
|
||||
firstname: [
|
||||
this.employeeData.firstname,
|
||||
[
|
||||
Validators.required,
|
||||
Validators.pattern('(^[A-z]).*')]
|
||||
],
|
||||
lastname: [
|
||||
this.employeeData.lastname,
|
||||
[
|
||||
Validators.required,
|
||||
Validators.pattern('(^[A-z]).*')]
|
||||
],
|
||||
isLoanOfficer: [this.employeeData.isLoanOfficer],
|
||||
mobileNo: [this.employeeData.mobileNo],
|
||||
isActive: [this.employeeData.isActive],
|
||||
joiningDate: [
|
||||
this.employeeData.joiningDate && new Date(this.employeeData.joiningDate),
|
||||
Validators.required
|
||||
]
|
||||
});
|
||||
}
|
||||
|
||||
@@ -91,8 +108,13 @@ export class EditEmployeeComponent implements OnInit {
|
||||
locale
|
||||
};
|
||||
this.organizationService.updateEmployee(this.employeeData.id, data).subscribe((response: any) => {
|
||||
this.router.navigate(['../../', response.resourceId], { relativeTo: this.route });
|
||||
this.router.navigate(
|
||||
[
|
||||
'../../',
|
||||
response.resourceId
|
||||
],
|
||||
{ relativeTo: this.route }
|
||||
);
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -13,7 +13,6 @@ import { OrganizationService } from 'app/organization/organization.service';
|
||||
*/
|
||||
@Injectable()
|
||||
export class EmployeeResolver implements Resolve<Object> {
|
||||
|
||||
/**
|
||||
* @param {OrganizationService} organizationService Organization service.
|
||||
*/
|
||||
@@ -24,8 +23,7 @@ export class EmployeeResolver implements Resolve<Object> {
|
||||
* @returns {Observable<any>}
|
||||
*/
|
||||
resolve(route: ActivatedRouteSnapshot): Observable<any> {
|
||||
const employeeId = route.paramMap.get('id');
|
||||
const employeeId = route.paramMap.get('id');
|
||||
return this.organizationService.getEmployee(employeeId);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -8,9 +8,8 @@ describe('EmployeesComponent', () => {
|
||||
|
||||
beforeEach(async(() => {
|
||||
TestBed.configureTestingModule({
|
||||
declarations: [ EmployeesComponent ]
|
||||
})
|
||||
.compileComponents();
|
||||
declarations: [EmployeesComponent]
|
||||
}).compileComponents();
|
||||
}));
|
||||
|
||||
beforeEach(() => {
|
||||
|
||||
@@ -21,11 +21,15 @@ import { ConfigurationWizardService } from '../../configuration-wizard/configura
|
||||
styleUrls: ['./employees.component.scss']
|
||||
})
|
||||
export class EmployeesComponent implements OnInit, AfterViewInit {
|
||||
|
||||
/** Employees data. */
|
||||
employeesData: any;
|
||||
/** Columns to be displayed in employees table. */
|
||||
displayedColumns: string[] = ['displayName', 'isLoanOfficer', 'officeName', 'isActive'];
|
||||
displayedColumns: string[] = [
|
||||
'displayName',
|
||||
'isLoanOfficer',
|
||||
'officeName',
|
||||
'isActive'
|
||||
];
|
||||
/** Data source for employees table. */
|
||||
dataSource: MatTableDataSource<any>;
|
||||
|
||||
@@ -50,11 +54,13 @@ export class EmployeesComponent implements OnInit, AfterViewInit {
|
||||
* @param {ConfigurationWizardService} configurationWizardService ConfigurationWizard Service.
|
||||
* @param {PopoverService} popoverService PopoverService.
|
||||
*/
|
||||
constructor(private route: ActivatedRoute,
|
||||
private router: Router,
|
||||
private configurationWizardService: ConfigurationWizardService,
|
||||
private popoverService: PopoverService) {
|
||||
this.route.data.subscribe(( data: { employees: any }) => {
|
||||
constructor(
|
||||
private route: ActivatedRoute,
|
||||
private router: Router,
|
||||
private configurationWizardService: ConfigurationWizardService,
|
||||
private popoverService: PopoverService
|
||||
) {
|
||||
this.route.data.subscribe((data: { employees: any }) => {
|
||||
this.employeesData = data.employees;
|
||||
});
|
||||
}
|
||||
@@ -90,7 +96,12 @@ export class EmployeesComponent implements OnInit, AfterViewInit {
|
||||
* @param position String.
|
||||
* @param backdrop Boolean.
|
||||
*/
|
||||
showPopover(template: TemplateRef<any>, target: HTMLElement | ElementRef<any>, position: string, backdrop: boolean): void {
|
||||
showPopover(
|
||||
template: TemplateRef<any>,
|
||||
target: HTMLElement | ElementRef<any>,
|
||||
position: string,
|
||||
backdrop: boolean
|
||||
): void {
|
||||
setTimeout(() => this.popoverService.open(template, target, position, backdrop, {}), 200);
|
||||
}
|
||||
|
||||
@@ -100,12 +111,12 @@ export class EmployeesComponent implements OnInit, AfterViewInit {
|
||||
ngAfterViewInit() {
|
||||
if (this.configurationWizardService.showEmployeeList === true) {
|
||||
setTimeout(() => {
|
||||
this.showPopover(this.templateButtonImportEmployees, this.buttonImportEmployees.nativeElement, 'bottom', true);
|
||||
this.showPopover(this.templateButtonImportEmployees, this.buttonImportEmployees.nativeElement, 'bottom', true);
|
||||
});
|
||||
}
|
||||
if (this.configurationWizardService.showEmployeeTable === true) {
|
||||
setTimeout(() => {
|
||||
this.showPopover(this.templateTableEmployees, this.tableEmployees.nativeElement, 'top', true);
|
||||
this.showPopover(this.templateTableEmployees, this.tableEmployees.nativeElement, 'top', true);
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -129,5 +140,4 @@ export class EmployeesComponent implements OnInit, AfterViewInit {
|
||||
this.configurationWizardService.showCreateEmployee = true;
|
||||
this.router.navigate(['/organization']);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -13,7 +13,6 @@ import { OrganizationService } from '../organization.service';
|
||||
*/
|
||||
@Injectable()
|
||||
export class EmployeesResolver implements Resolve<Object> {
|
||||
|
||||
/**
|
||||
* @param {OrganizationService} organizationService Organization service.
|
||||
*/
|
||||
@@ -26,5 +25,4 @@ export class EmployeesResolver implements Resolve<Object> {
|
||||
resolve(): Observable<any> {
|
||||
return this.organizationService.getEmployees();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -8,9 +8,8 @@ describe('ViewEmployeeComponent', () => {
|
||||
|
||||
beforeEach(async(() => {
|
||||
TestBed.configureTestingModule({
|
||||
declarations: [ ViewEmployeeComponent ]
|
||||
})
|
||||
.compileComponents();
|
||||
declarations: [ViewEmployeeComponent]
|
||||
}).compileComponents();
|
||||
}));
|
||||
|
||||
beforeEach(() => {
|
||||
|
||||
@@ -11,7 +11,6 @@ import { ActivatedRoute } from '@angular/router';
|
||||
styleUrls: ['./view-employee.component.scss']
|
||||
})
|
||||
export class ViewEmployeeComponent {
|
||||
|
||||
/** Employee data. */
|
||||
employeeData: any;
|
||||
|
||||
@@ -24,5 +23,4 @@ export class ViewEmployeeComponent {
|
||||
this.employeeData = data.employee;
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
+2
-3
@@ -8,9 +8,8 @@ describe('CreateEnityDataTableChecksComponent', () => {
|
||||
|
||||
beforeEach(async(() => {
|
||||
TestBed.configureTestingModule({
|
||||
declarations: [ CreateEnityDataTableChecksComponent ]
|
||||
})
|
||||
.compileComponents();
|
||||
declarations: [CreateEnityDataTableChecksComponent]
|
||||
}).compileComponents();
|
||||
}));
|
||||
|
||||
beforeEach(() => {
|
||||
|
||||
+23
-12
@@ -15,7 +15,6 @@ import { OrganizationService } from 'app/organization/organization.service';
|
||||
styleUrls: ['./create-enity-data-table-checks.component.scss']
|
||||
})
|
||||
export class CreateEnityDataTableChecksComponent implements OnInit {
|
||||
|
||||
/** Create Entity Datatable Checks form. */
|
||||
createEntityForm: UntypedFormGroup;
|
||||
/** Entity Datatable Checks data. */
|
||||
@@ -36,11 +35,13 @@ export class CreateEnityDataTableChecksComponent implements OnInit {
|
||||
* @param {OrganizationService} organizationService Organization Service.
|
||||
* @param {Router} router Router.
|
||||
*/
|
||||
constructor(private formBuilder: UntypedFormBuilder,
|
||||
private route: ActivatedRoute,
|
||||
private organizationService: OrganizationService,
|
||||
private router: Router) {
|
||||
this.route.data.subscribe((data: {dataTableEntity: any}) => {
|
||||
constructor(
|
||||
private formBuilder: UntypedFormBuilder,
|
||||
private route: ActivatedRoute,
|
||||
private organizationService: OrganizationService,
|
||||
private router: Router
|
||||
) {
|
||||
this.route.data.subscribe((data: { dataTableEntity: any }) => {
|
||||
this.createEntityData = data.dataTableEntity;
|
||||
this.entityTypes = [
|
||||
{ name: 'Client', value: this.createEntityData.entities[0] },
|
||||
@@ -61,9 +62,18 @@ export class CreateEnityDataTableChecksComponent implements OnInit {
|
||||
*/
|
||||
setCreateEntityDataTableForm() {
|
||||
this.createEntityForm = this.formBuilder.group({
|
||||
'entity': ['', Validators.required],
|
||||
'status': ['', Validators.required],
|
||||
'datatableName': ['', Validators.required]
|
||||
entity: [
|
||||
'',
|
||||
Validators.required
|
||||
],
|
||||
status: [
|
||||
'',
|
||||
Validators.required
|
||||
],
|
||||
datatableName: [
|
||||
'',
|
||||
Validators.required
|
||||
]
|
||||
});
|
||||
}
|
||||
|
||||
@@ -95,9 +105,11 @@ export class CreateEnityDataTableChecksComponent implements OnInit {
|
||||
this.createEntityForm.removeControl('productId');
|
||||
break;
|
||||
}
|
||||
default : {
|
||||
default: {
|
||||
this.entityType = 'm_savings_account';
|
||||
this.dataTableList = this.createEntityData.datatables.filter((data: any) => data.entity === 'm_savings_account');
|
||||
this.dataTableList = this.createEntityData.datatables.filter(
|
||||
(data: any) => data.entity === 'm_savings_account'
|
||||
);
|
||||
this.statusList = this.createEntityData.statusSavings;
|
||||
this.createEntityForm.addControl('productId', new UntypedFormControl('', Validators.required));
|
||||
break;
|
||||
@@ -114,5 +126,4 @@ export class CreateEnityDataTableChecksComponent implements OnInit {
|
||||
this.router.navigate(['../'], { relativeTo: this.route });
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
-2
@@ -13,7 +13,6 @@ import { OrganizationService } from '../organization.service';
|
||||
*/
|
||||
@Injectable()
|
||||
export class EntityDataTableChecksTemplateResolver implements Resolve<Object> {
|
||||
|
||||
/**
|
||||
* @param {OrganizationService} organizationService Organization service.
|
||||
*/
|
||||
@@ -26,5 +25,4 @@ export class EntityDataTableChecksTemplateResolver implements Resolve<Object> {
|
||||
resolve(): Observable<any> {
|
||||
return this.organizationService.getEntityDataTableChecksTemplate();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
+2
-3
@@ -8,9 +8,8 @@ describe('EntityDataTableChecksComponent', () => {
|
||||
|
||||
beforeEach(async(() => {
|
||||
TestBed.configureTestingModule({
|
||||
declarations: [ EntityDataTableChecksComponent ]
|
||||
})
|
||||
.compileComponents();
|
||||
declarations: [EntityDataTableChecksComponent]
|
||||
}).compileComponents();
|
||||
}));
|
||||
|
||||
beforeEach(() => {
|
||||
|
||||
+24
-14
@@ -21,11 +21,17 @@ import { DeleteDialogComponent } from '../../shared/delete-dialog/delete-dialog.
|
||||
styleUrls: ['./entity-data-table-checks.component.scss']
|
||||
})
|
||||
export class EntityDataTableChecksComponent implements OnInit {
|
||||
|
||||
/** Entity Data Table Checks data. */
|
||||
entityDataTableChecksData: any;
|
||||
/** Columns to be displayed in entity data table checks table. */
|
||||
displayedColumns: string[] = ['entity', 'productName', 'datatableName', 'status', 'systemDefined', 'actions'];
|
||||
displayedColumns: string[] = [
|
||||
'entity',
|
||||
'productName',
|
||||
'datatableName',
|
||||
'status',
|
||||
'systemDefined',
|
||||
'actions'
|
||||
];
|
||||
/** Data source for entity data table checks table. */
|
||||
dataSource: MatTableDataSource<any>;
|
||||
/** Corresponding values for Entity */
|
||||
@@ -59,10 +65,12 @@ export class EntityDataTableChecksComponent implements OnInit {
|
||||
* @param {ActivatedRoute} route Activated Route.
|
||||
* @param {MatDialog} dialog Dialog reference.
|
||||
*/
|
||||
constructor(private organizationService: OrganizationService,
|
||||
private route: ActivatedRoute,
|
||||
private dialog: MatDialog) {
|
||||
this.route.data.subscribe(( data: { entityDataTableChecks: any }) => {
|
||||
constructor(
|
||||
private organizationService: OrganizationService,
|
||||
private route: ActivatedRoute,
|
||||
private dialog: MatDialog
|
||||
) {
|
||||
this.route.data.subscribe((data: { entityDataTableChecks: any }) => {
|
||||
this.entityDataTableChecksData = data.entityDataTableChecks.pageItems;
|
||||
});
|
||||
}
|
||||
@@ -105,8 +113,10 @@ export class EntityDataTableChecksComponent implements OnInit {
|
||||
this.dataSource.sort = this.sort;
|
||||
this.dataSource.sortingDataAccessor = (item, property) => {
|
||||
switch (property) {
|
||||
case 'status': return item.status.value;
|
||||
default: return item[property];
|
||||
case 'status':
|
||||
return item.status.value;
|
||||
default:
|
||||
return item[property];
|
||||
}
|
||||
};
|
||||
}
|
||||
@@ -121,13 +131,13 @@ export class EntityDataTableChecksComponent implements OnInit {
|
||||
});
|
||||
deleteEntityDataTableCheckDialogRef.afterClosed().subscribe((response: any) => {
|
||||
if (response.delete) {
|
||||
this.organizationService.deleteEntityDataTableCheck(entityDataTableCheckId)
|
||||
.subscribe(() => {
|
||||
this.entityDataTableChecksData = this.entityDataTableChecksData.filter((entityDataTableChecks: any) => entityDataTableChecks.id !== entityDataTableCheckId);
|
||||
this.dataSource.data = this.entityDataTableChecksData;
|
||||
});
|
||||
this.organizationService.deleteEntityDataTableCheck(entityDataTableCheckId).subscribe(() => {
|
||||
this.entityDataTableChecksData = this.entityDataTableChecksData.filter(
|
||||
(entityDataTableChecks: any) => entityDataTableChecks.id !== entityDataTableCheckId
|
||||
);
|
||||
this.dataSource.data = this.entityDataTableChecksData;
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -13,7 +13,6 @@ import { OrganizationService } from '../organization.service';
|
||||
*/
|
||||
@Injectable()
|
||||
export class EntityDataTableChecksResolver implements Resolve<Object> {
|
||||
|
||||
/**
|
||||
* @param {OrganizationService} organizationService Organization service.
|
||||
*/
|
||||
@@ -26,5 +25,4 @@ export class EntityDataTableChecksResolver implements Resolve<Object> {
|
||||
resolve(): Observable<any> {
|
||||
return this.organizationService.getEntityDataTableChecks();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -13,7 +13,6 @@ import { OrganizationService } from '../organization.service';
|
||||
*/
|
||||
@Injectable()
|
||||
export class AdvanceSearchTemplateResolver implements Resolve<Object> {
|
||||
|
||||
/**
|
||||
* @param {OrganizationService} organizationService Organization service.
|
||||
*/
|
||||
@@ -26,5 +25,4 @@ export class AdvanceSearchTemplateResolver implements Resolve<Object> {
|
||||
resolve(): Observable<any> {
|
||||
return this.organizationService.getAdvanceSearchTemplate();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -8,9 +8,8 @@ describe('FundMappingComponent', () => {
|
||||
|
||||
beforeEach(async(() => {
|
||||
TestBed.configureTestingModule({
|
||||
declarations: [ FundMappingComponent ]
|
||||
})
|
||||
.compileComponents();
|
||||
declarations: [FundMappingComponent]
|
||||
}).compileComponents();
|
||||
}));
|
||||
|
||||
beforeEach(() => {
|
||||
|
||||
@@ -20,7 +20,6 @@ import { Dates } from 'app/core/utils/dates';
|
||||
styleUrls: ['./fund-mapping.component.scss']
|
||||
})
|
||||
export class FundMappingComponent implements OnInit {
|
||||
|
||||
/** Minimum Date allowed. */
|
||||
minDate = new Date(2000, 0, 1);
|
||||
/** Maximum Date allowed. */
|
||||
@@ -33,7 +32,13 @@ export class FundMappingComponent implements OnInit {
|
||||
isCollapsed = false;
|
||||
|
||||
/** Columns to be displayed in loans table. */
|
||||
displayedColumns: string[] = ['officeName', 'productName', 'count', 'outstanding', 'percentage'];
|
||||
displayedColumns: string[] = [
|
||||
'officeName',
|
||||
'productName',
|
||||
'count',
|
||||
'outstanding',
|
||||
'percentage'
|
||||
];
|
||||
/** Data source for loans table. */
|
||||
dataSource: MatTableDataSource<any>;
|
||||
|
||||
@@ -50,11 +55,13 @@ export class FundMappingComponent implements OnInit {
|
||||
* @param {Router} router Router for navigation.
|
||||
* @param {Dates} dateUtils Date Utils to format date.
|
||||
*/
|
||||
constructor(private formBuilder: UntypedFormBuilder,
|
||||
private organizationService: OrganizationService,
|
||||
private settingsService: SettingsService,
|
||||
private route: ActivatedRoute,
|
||||
private dateUtils: Dates) {
|
||||
constructor(
|
||||
private formBuilder: UntypedFormBuilder,
|
||||
private organizationService: OrganizationService,
|
||||
private settingsService: SettingsService,
|
||||
private route: ActivatedRoute,
|
||||
private dateUtils: Dates
|
||||
) {
|
||||
this.route.data.subscribe((data: { advanceSearchTemplate: any }) => {
|
||||
this.advanceSearchTemplate = data.advanceSearchTemplate;
|
||||
});
|
||||
@@ -71,14 +78,23 @@ export class FundMappingComponent implements OnInit {
|
||||
*/
|
||||
createFundMappingForm() {
|
||||
this.fundMappingForm = this.formBuilder.group({
|
||||
'loanStatus': [''],
|
||||
'loanProducts': [''],
|
||||
'offices': [''],
|
||||
'loanDateOption': ['', Validators.required],
|
||||
'loanFromDate': ['', Validators.required],
|
||||
'loanToDate': ['', Validators.required],
|
||||
'includeOutStandingAmountPercentage': [false],
|
||||
'includeOutstandingAmount': [false]
|
||||
loanStatus: [''],
|
||||
loanProducts: [''],
|
||||
offices: [''],
|
||||
loanDateOption: [
|
||||
'',
|
||||
Validators.required
|
||||
],
|
||||
loanFromDate: [
|
||||
'',
|
||||
Validators.required
|
||||
],
|
||||
loanToDate: [
|
||||
'',
|
||||
Validators.required
|
||||
],
|
||||
includeOutStandingAmountPercentage: [false],
|
||||
includeOutstandingAmount: [false]
|
||||
});
|
||||
}
|
||||
|
||||
@@ -88,14 +104,26 @@ export class FundMappingComponent implements OnInit {
|
||||
buildDependencies() {
|
||||
this.fundMappingForm.get('includeOutStandingAmountPercentage').valueChanges.subscribe((value: boolean) => {
|
||||
if (value) {
|
||||
this.fundMappingForm.addControl('outStandingAmountPercentageCondition', new UntypedFormControl('', Validators.required));
|
||||
this.fundMappingForm.addControl(
|
||||
'outStandingAmountPercentageCondition',
|
||||
new UntypedFormControl('', Validators.required)
|
||||
);
|
||||
this.fundMappingForm.get('outStandingAmountPercentageCondition').valueChanges.subscribe((_value: string) => {
|
||||
if (_value === 'between') {
|
||||
this.fundMappingForm.addControl('minOutStandingAmountPercentage', new UntypedFormControl('', Validators.required));
|
||||
this.fundMappingForm.addControl('maxOutStandingAmountPercentage', new UntypedFormControl('', Validators.required));
|
||||
this.fundMappingForm.addControl(
|
||||
'minOutStandingAmountPercentage',
|
||||
new UntypedFormControl('', Validators.required)
|
||||
);
|
||||
this.fundMappingForm.addControl(
|
||||
'maxOutStandingAmountPercentage',
|
||||
new UntypedFormControl('', Validators.required)
|
||||
);
|
||||
this.fundMappingForm.removeControl('outStandingAmountPercentage');
|
||||
} else {
|
||||
this.fundMappingForm.addControl('outStandingAmountPercentage', new UntypedFormControl('', Validators.required));
|
||||
this.fundMappingForm.addControl(
|
||||
'outStandingAmountPercentage',
|
||||
new UntypedFormControl('', Validators.required)
|
||||
);
|
||||
this.fundMappingForm.removeControl('minOutStandingAmountPercentage');
|
||||
this.fundMappingForm.removeControl('maxOutStandingAmountPercentage');
|
||||
}
|
||||
@@ -170,5 +198,4 @@ export class FundMappingComponent implements OnInit {
|
||||
this.setLoans(response);
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -3,44 +3,41 @@ import { Injectable } from '@angular/core';
|
||||
import { OfficeItemNode } from './office-item.class';
|
||||
|
||||
@Injectable({
|
||||
providedIn: 'root'
|
||||
providedIn: 'root'
|
||||
})
|
||||
export class ChecklistDatabase {
|
||||
// rxjs functionality to update DOM via subscribe
|
||||
dataChange = new BehaviorSubject<OfficeItemNode[]>([]);
|
||||
get data(): OfficeItemNode[] {
|
||||
return this.dataChange.value;
|
||||
}
|
||||
TREE_DATA = {};
|
||||
|
||||
constructor() {}
|
||||
|
||||
// rxjs functionality to update DOM via subscribe
|
||||
dataChange = new BehaviorSubject<OfficeItemNode[]>([]);
|
||||
get data(): OfficeItemNode[] {
|
||||
return this.dataChange.value;
|
||||
}
|
||||
TREE_DATA = {};
|
||||
// called every time the data in route changes
|
||||
initialize(trie: any) {
|
||||
this.TREE_DATA = trie;
|
||||
const data = this.buildFileTree(this.TREE_DATA, 0);
|
||||
this.dataChange.next(data);
|
||||
}
|
||||
|
||||
constructor() {
|
||||
}
|
||||
// builds hierarchical tree of officeItemNodes
|
||||
buildFileTree(obj: { [key: string]: any }, level: number): OfficeItemNode[] {
|
||||
return Object.keys(obj).reduce<OfficeItemNode[]>((accumulator, key) => {
|
||||
const value = obj[key];
|
||||
const node = new OfficeItemNode();
|
||||
node.item = key;
|
||||
|
||||
// called every time the data in route changes
|
||||
initialize(trie: any) {
|
||||
this.TREE_DATA = trie;
|
||||
const data = this.buildFileTree(this.TREE_DATA, 0);
|
||||
this.dataChange.next(data);
|
||||
}
|
||||
if (value != null) {
|
||||
if (typeof value === 'object') {
|
||||
node.children = this.buildFileTree(value, level + 1);
|
||||
} else {
|
||||
node.item = value;
|
||||
}
|
||||
}
|
||||
|
||||
// builds hierarchical tree of officeItemNodes
|
||||
buildFileTree(obj: { [key: string]: any }, level: number): OfficeItemNode[] {
|
||||
return Object.keys(obj).reduce<OfficeItemNode[]>((accumulator, key) => {
|
||||
const value = obj[key];
|
||||
const node = new OfficeItemNode();
|
||||
node.item = key;
|
||||
|
||||
if (value != null) {
|
||||
if (typeof value === 'object') {
|
||||
node.children = this.buildFileTree(value, level + 1);
|
||||
} else {
|
||||
node.item = value;
|
||||
}
|
||||
}
|
||||
|
||||
return accumulator.concat(node);
|
||||
}, []);
|
||||
}
|
||||
return accumulator.concat(node);
|
||||
}, []);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -8,9 +8,8 @@ describe('CreateHolidayComponent', () => {
|
||||
|
||||
beforeEach(async(() => {
|
||||
TestBed.configureTestingModule({
|
||||
declarations: [ CreateHolidayComponent ]
|
||||
})
|
||||
.compileComponents();
|
||||
declarations: [CreateHolidayComponent]
|
||||
}).compileComponents();
|
||||
}));
|
||||
|
||||
beforeEach(() => {
|
||||
|
||||
@@ -24,7 +24,6 @@ import { CreateHoliday } from './create-holiday.service';
|
||||
styleUrls: ['./create-holiday.component.scss']
|
||||
})
|
||||
export class CreateHolidayComponent implements OnInit {
|
||||
|
||||
/** Create Holiday form. */
|
||||
holidayForm: UntypedFormGroup;
|
||||
/** Repayment Scheduling data. */
|
||||
@@ -73,15 +72,17 @@ export class CreateHolidayComponent implements OnInit {
|
||||
* @param {OrganizationService} organizationService Organization Service.
|
||||
* @param {Router} router Router.
|
||||
*/
|
||||
constructor(private formBuilder: UntypedFormBuilder,
|
||||
private route: ActivatedRoute,
|
||||
private dateUtils: Dates,
|
||||
private organizationService: OrganizationService,
|
||||
private settings: SettingsService,
|
||||
private router: Router,
|
||||
private _database: ChecklistDatabase,
|
||||
private createHoliday: CreateHoliday ) {
|
||||
this.route.data.subscribe((data: { offices: any, holidayTemplate: any }) => {
|
||||
constructor(
|
||||
private formBuilder: UntypedFormBuilder,
|
||||
private route: ActivatedRoute,
|
||||
private dateUtils: Dates,
|
||||
private organizationService: OrganizationService,
|
||||
private settings: SettingsService,
|
||||
private router: Router,
|
||||
private _database: ChecklistDatabase,
|
||||
private createHoliday: CreateHoliday
|
||||
) {
|
||||
this.route.data.subscribe((data: { offices: any; holidayTemplate: any }) => {
|
||||
this.officesData = data.offices;
|
||||
this.repaymentSchedulingTypes = data.holidayTemplate;
|
||||
// Constructs trie everytime data changes
|
||||
@@ -121,7 +122,7 @@ export class CreateHolidayComponent implements OnInit {
|
||||
// Sets root as the first object
|
||||
root = trie[Object.keys(trie)[0]];
|
||||
// Construction of hierarchy via Depth First Search
|
||||
hierarchy.forEach((stage: string) => {
|
||||
hierarchy.forEach((stage: string) => {
|
||||
if (!(stage in root)) {
|
||||
root[stage] = {};
|
||||
}
|
||||
@@ -160,7 +161,7 @@ export class CreateHolidayComponent implements OnInit {
|
||||
this.flatNodeMap.set(flatNode, node);
|
||||
this.nestedNodeMap.set(node, flatNode);
|
||||
return flatNode;
|
||||
}
|
||||
};
|
||||
|
||||
/** Whether all the descendants of the node are selected. */
|
||||
descendantsAllSelected(node: OfficeItemFlatNode): boolean {
|
||||
@@ -176,7 +177,7 @@ export class CreateHolidayComponent implements OnInit {
|
||||
|
||||
setSelectedOffices() {
|
||||
this.holidayForm.patchValue({
|
||||
offices: this.checklistSelection.selected.map((item) => item.item),
|
||||
offices: this.checklistSelection.selected.map((item) => item.item)
|
||||
});
|
||||
}
|
||||
|
||||
@@ -256,12 +257,27 @@ export class CreateHolidayComponent implements OnInit {
|
||||
*/
|
||||
setHolidayForm() {
|
||||
this.holidayForm = this.formBuilder.group({
|
||||
'name': ['', Validators.required],
|
||||
'fromDate': ['', Validators.required],
|
||||
'toDate': ['', Validators.required],
|
||||
'reschedulingType': ['', Validators.required],
|
||||
'description': [''],
|
||||
'offices': ['', Validators.required]
|
||||
name: [
|
||||
'',
|
||||
Validators.required
|
||||
],
|
||||
fromDate: [
|
||||
'',
|
||||
Validators.required
|
||||
],
|
||||
toDate: [
|
||||
'',
|
||||
Validators.required
|
||||
],
|
||||
reschedulingType: [
|
||||
'',
|
||||
Validators.required
|
||||
],
|
||||
description: [''],
|
||||
offices: [
|
||||
'',
|
||||
Validators.required
|
||||
]
|
||||
});
|
||||
}
|
||||
|
||||
@@ -294,7 +310,7 @@ export class CreateHolidayComponent implements OnInit {
|
||||
holidayFormData.repaymentsRescheduledTo = this.dateUtils.formatDate(prevRepaymentsRescheduledTo, dateFormat);
|
||||
}
|
||||
const offices = this.holidayForm.value.offices.map((office: string) => {
|
||||
return {'officeId': Number.parseInt(office, 10)};
|
||||
return { officeId: Number.parseInt(office, 10) };
|
||||
});
|
||||
const data = {
|
||||
...holidayFormData,
|
||||
@@ -303,8 +319,13 @@ export class CreateHolidayComponent implements OnInit {
|
||||
offices
|
||||
};
|
||||
this.organizationService.createHoliday(data).subscribe((response: any) => {
|
||||
this.router.navigate(['../', response.resourceId], { relativeTo: this.route });
|
||||
this.router.navigate(
|
||||
[
|
||||
'../',
|
||||
response.resourceId
|
||||
],
|
||||
{ relativeTo: this.route }
|
||||
);
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,17 +1,16 @@
|
||||
import { Injectable } from '@angular/core';
|
||||
|
||||
@Injectable({
|
||||
providedIn: 'root'
|
||||
providedIn: 'root'
|
||||
})
|
||||
export class CreateHoliday {
|
||||
setEmptyObjectsToNull(root: any) {
|
||||
Object.keys(root).forEach((key) => {
|
||||
if (Object.keys(root[key]).length === 0) {
|
||||
root[key] = null;
|
||||
} else {
|
||||
this.setEmptyObjectsToNull(root[key]);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
setEmptyObjectsToNull(root: any) {
|
||||
Object.keys(root).forEach((key) => {
|
||||
if (Object.keys(root[key]).length === 0) {
|
||||
root[key] = null;
|
||||
} else {
|
||||
this.setEmptyObjectsToNull(root[key]);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
import { Injectable } from '@angular/core';
|
||||
|
||||
@Injectable({
|
||||
providedIn: 'root'
|
||||
providedIn: 'root'
|
||||
})
|
||||
export class OfficeItemFlatNode {
|
||||
item: string;
|
||||
level: number;
|
||||
expandable: boolean;
|
||||
}
|
||||
item: string;
|
||||
level: number;
|
||||
expandable: boolean;
|
||||
}
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
import { Injectable } from '@angular/core';
|
||||
|
||||
@Injectable({
|
||||
providedIn: 'root'
|
||||
providedIn: 'root'
|
||||
})
|
||||
export class OfficeItemNode {
|
||||
children: OfficeItemNode[];
|
||||
item: string;
|
||||
children: OfficeItemNode[];
|
||||
item: string;
|
||||
}
|
||||
|
||||
@@ -8,9 +8,8 @@ describe('EditHolidayComponent', () => {
|
||||
|
||||
beforeEach(async(() => {
|
||||
TestBed.configureTestingModule({
|
||||
declarations: [ EditHolidayComponent ]
|
||||
})
|
||||
.compileComponents();
|
||||
declarations: [EditHolidayComponent]
|
||||
}).compileComponents();
|
||||
}));
|
||||
|
||||
beforeEach(() => {
|
||||
|
||||
@@ -17,7 +17,6 @@ import { SettingsService } from 'app/settings/settings.service';
|
||||
styleUrls: ['./edit-holiday.component.scss']
|
||||
})
|
||||
export class EditHolidayComponent implements OnInit {
|
||||
|
||||
/** Edit Holiday form. */
|
||||
holidayForm: UntypedFormGroup;
|
||||
/** Holiday data. */
|
||||
@@ -39,17 +38,19 @@ export class EditHolidayComponent implements OnInit {
|
||||
* @param {OrganizationService} organizatioService Organization Service.
|
||||
* @param {Router} router Router.
|
||||
*/
|
||||
constructor(private formBuilder: UntypedFormBuilder,
|
||||
private route: ActivatedRoute,
|
||||
private dateUtils: Dates,
|
||||
private organizatioService: OrganizationService,
|
||||
private settingsService: SettingsService,
|
||||
private router: Router ) {
|
||||
this.route.data.subscribe((data: { holiday: any, holidayTemplate: any }) => {
|
||||
constructor(
|
||||
private formBuilder: UntypedFormBuilder,
|
||||
private route: ActivatedRoute,
|
||||
private dateUtils: Dates,
|
||||
private organizatioService: OrganizationService,
|
||||
private settingsService: SettingsService,
|
||||
private router: Router
|
||||
) {
|
||||
this.route.data.subscribe((data: { holiday: any; holidayTemplate: any }) => {
|
||||
this.holidayData = data.holiday;
|
||||
this.holidayData.repaymentSchedulingTypes = data.holidayTemplate;
|
||||
this.reSchedulingType = this.holidayData.reschedulingType;
|
||||
if ( this.holidayData.status.value === 'Active' ) {
|
||||
if (this.holidayData.status.value === 'Active') {
|
||||
this.isActiveHoliday = true;
|
||||
} else {
|
||||
this.isActiveHoliday = false;
|
||||
@@ -70,15 +71,33 @@ export class EditHolidayComponent implements OnInit {
|
||||
*/
|
||||
setEditForm() {
|
||||
this.holidayForm = this.formBuilder.group({
|
||||
'name': [this.holidayData.name, Validators.required],
|
||||
'description': [this.holidayData.description]
|
||||
name: [
|
||||
this.holidayData.name,
|
||||
Validators.required
|
||||
],
|
||||
description: [this.holidayData.description]
|
||||
});
|
||||
if (!this.isActiveHoliday) {
|
||||
this.holidayForm.addControl('fromDate', new UntypedFormControl(this.holidayData.fromDate && new Date(this.holidayData.fromDate), Validators.required));
|
||||
this.holidayForm.addControl('toDate', new UntypedFormControl(this.holidayData.toDate && new Date(this.holidayData.toDate), Validators.required));
|
||||
this.holidayForm.addControl('reschedulingType', new UntypedFormControl(this.holidayData.reschedulingType, Validators.required));
|
||||
this.holidayForm.addControl(
|
||||
'fromDate',
|
||||
new UntypedFormControl(this.holidayData.fromDate && new Date(this.holidayData.fromDate), Validators.required)
|
||||
);
|
||||
this.holidayForm.addControl(
|
||||
'toDate',
|
||||
new UntypedFormControl(this.holidayData.toDate && new Date(this.holidayData.toDate), Validators.required)
|
||||
);
|
||||
this.holidayForm.addControl(
|
||||
'reschedulingType',
|
||||
new UntypedFormControl(this.holidayData.reschedulingType, Validators.required)
|
||||
);
|
||||
if (this.reSchedulingType === 2) {
|
||||
this.holidayForm.addControl('repaymentsRescheduledTo', new UntypedFormControl(this.holidayData.repaymentsRescheduledTo && new Date(this.holidayData.repaymentsRescheduledTo), Validators.required));
|
||||
this.holidayForm.addControl(
|
||||
'repaymentsRescheduledTo',
|
||||
new UntypedFormControl(
|
||||
this.holidayData.repaymentsRescheduledTo && new Date(this.holidayData.repaymentsRescheduledTo),
|
||||
Validators.required
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -87,7 +106,7 @@ export class EditHolidayComponent implements OnInit {
|
||||
* Get Rescheduling Type.
|
||||
*/
|
||||
getReschedulingType() {
|
||||
this.holidayForm.get('reschedulingType').valueChanges.subscribe( (option: any) => {
|
||||
this.holidayForm.get('reschedulingType').valueChanges.subscribe((option: any) => {
|
||||
this.reSchedulingType = option;
|
||||
if (option === 2) {
|
||||
this.holidayForm.addControl('repaymentsRescheduledTo', new UntypedFormControl(new Date(), Validators.required));
|
||||
@@ -105,7 +124,7 @@ export class EditHolidayComponent implements OnInit {
|
||||
const locale = this.settingsService.language.code;
|
||||
const dateFormat = this.settingsService.dateFormat;
|
||||
if (!this.isActiveHoliday) {
|
||||
if (this.reSchedulingType === 2 ) {
|
||||
if (this.reSchedulingType === 2) {
|
||||
const repaymentScheduledTo: Date = this.holidayForm.value.repaymentsRescheduledTo;
|
||||
holidayFormData.repaymentsRescheduledTo = this.dateUtils.formatDate(repaymentScheduledTo, dateFormat);
|
||||
}
|
||||
@@ -123,10 +142,9 @@ export class EditHolidayComponent implements OnInit {
|
||||
dateFormat,
|
||||
locale
|
||||
};
|
||||
this.organizatioService.updateHoliday(this.holidayData.id, data).subscribe(response => {
|
||||
this.organizatioService.updateHoliday(this.holidayData.id, data).subscribe((response) => {
|
||||
/** TODO Add Redirects to ViewMakerCheckerTask page. */
|
||||
this.router.navigate(['../'], { relativeTo: this.route });
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -13,7 +13,6 @@ import { OrganizationService } from 'app/organization/organization.service';
|
||||
*/
|
||||
@Injectable()
|
||||
export class HolidayTemplateResolver implements Resolve<Object> {
|
||||
|
||||
/**
|
||||
* @param {OrganizationService} organizationService Organization service.
|
||||
*/
|
||||
@@ -26,5 +25,4 @@ export class HolidayTemplateResolver implements Resolve<Object> {
|
||||
resolve(): Observable<any> {
|
||||
return this.organizationService.getHolidayTemplate();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -13,7 +13,6 @@ import { OrganizationService } from 'app/organization/organization.service';
|
||||
*/
|
||||
@Injectable()
|
||||
export class HolidayResolver implements Resolve<Object> {
|
||||
|
||||
/**
|
||||
* @param {OrganizationService} organizationService Organization service.
|
||||
*/
|
||||
@@ -24,8 +23,7 @@ export class HolidayResolver implements Resolve<Object> {
|
||||
* @returns {Observable<any>}
|
||||
*/
|
||||
resolve(route: ActivatedRouteSnapshot): Observable<any> {
|
||||
const holidayId = route.paramMap.get('id');
|
||||
const holidayId = route.paramMap.get('id');
|
||||
return this.organizationService.getHoliday(holidayId);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -8,9 +8,8 @@ describe('HolidaysComponent', () => {
|
||||
|
||||
beforeEach(async(() => {
|
||||
TestBed.configureTestingModule({
|
||||
declarations: [ HolidaysComponent ]
|
||||
})
|
||||
.compileComponents();
|
||||
declarations: [HolidaysComponent]
|
||||
}).compileComponents();
|
||||
}));
|
||||
|
||||
beforeEach(() => {
|
||||
|
||||
@@ -23,7 +23,6 @@ import { ConfigurationWizardService } from '../../configuration-wizard/configura
|
||||
styleUrls: ['./holidays.component.scss']
|
||||
})
|
||||
export class HolidaysComponent implements OnInit, AfterViewInit {
|
||||
|
||||
/** Office selector. */
|
||||
officeSelector = new UntypedFormControl();
|
||||
/** Holidays data. */
|
||||
@@ -31,7 +30,13 @@ export class HolidaysComponent implements OnInit, AfterViewInit {
|
||||
/** Offices data. */
|
||||
officeData: any;
|
||||
/** Columns to be displayed in holidays table. */
|
||||
displayedColumns: string[] = ['name', 'fromDate', 'toDate', 'repaymentsRescheduledTo', 'status'];
|
||||
displayedColumns: string[] = [
|
||||
'name',
|
||||
'fromDate',
|
||||
'toDate',
|
||||
'repaymentsRescheduledTo',
|
||||
'status'
|
||||
];
|
||||
/** Data source for holidays table. */
|
||||
dataSource: MatTableDataSource<any>;
|
||||
|
||||
@@ -58,12 +63,14 @@ export class HolidaysComponent implements OnInit, AfterViewInit {
|
||||
* @param {ConfigurationWizardService} configurationWizardService ConfigurationWizard Service.
|
||||
* @param {PopoverService} popoverService PopoverService.
|
||||
*/
|
||||
constructor(private organizationService: OrganizationService,
|
||||
private route: ActivatedRoute,
|
||||
private router: Router,
|
||||
private configurationWizardService: ConfigurationWizardService,
|
||||
private popoverService: PopoverService) {
|
||||
this.route.data.subscribe(( data: { offices: any }) => {
|
||||
constructor(
|
||||
private organizationService: OrganizationService,
|
||||
private route: ActivatedRoute,
|
||||
private router: Router,
|
||||
private configurationWizardService: ConfigurationWizardService,
|
||||
private popoverService: PopoverService
|
||||
) {
|
||||
this.route.data.subscribe((data: { offices: any }) => {
|
||||
this.officeData = data.offices;
|
||||
});
|
||||
}
|
||||
@@ -112,7 +119,12 @@ export class HolidaysComponent implements OnInit, AfterViewInit {
|
||||
* @param position String.
|
||||
* @param backdrop Boolean.
|
||||
*/
|
||||
showPopover(template: TemplateRef<any>, target: HTMLElement | ElementRef<any>, position: string, backdrop: boolean): void {
|
||||
showPopover(
|
||||
template: TemplateRef<any>,
|
||||
target: HTMLElement | ElementRef<any>,
|
||||
position: string,
|
||||
backdrop: boolean
|
||||
): void {
|
||||
setTimeout(() => this.popoverService.open(template, target, position, backdrop, {}), 200);
|
||||
}
|
||||
|
||||
@@ -122,13 +134,13 @@ export class HolidaysComponent implements OnInit, AfterViewInit {
|
||||
ngAfterViewInit() {
|
||||
if (this.configurationWizardService.showHolidayPage === true) {
|
||||
setTimeout(() => {
|
||||
this.showPopover(this.templateButtonCreateHoliday, this.buttonCreateHoliday.nativeElement, 'bottom', true);
|
||||
this.showPopover(this.templateButtonCreateHoliday, this.buttonCreateHoliday.nativeElement, 'bottom', true);
|
||||
});
|
||||
}
|
||||
|
||||
if (this.configurationWizardService.showHolidayFilter === true) {
|
||||
setTimeout(() => {
|
||||
this.showPopover(this.templateFilterRef, this.filterRef.nativeElement, 'bottom', true);
|
||||
this.showPopover(this.templateFilterRef, this.filterRef.nativeElement, 'bottom', true);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@@ -8,9 +8,8 @@ describe('ViewHolidaysComponent', () => {
|
||||
|
||||
beforeEach(async(() => {
|
||||
TestBed.configureTestingModule({
|
||||
declarations: [ ViewHolidaysComponent ]
|
||||
})
|
||||
.compileComponents();
|
||||
declarations: [ViewHolidaysComponent]
|
||||
}).compileComponents();
|
||||
}));
|
||||
|
||||
beforeEach(() => {
|
||||
|
||||
@@ -20,7 +20,6 @@ import { TranslateService } from '@ngx-translate/core';
|
||||
styleUrls: ['./view-holidays.component.scss']
|
||||
})
|
||||
export class ViewHolidaysComponent {
|
||||
|
||||
/** Holiday data. */
|
||||
holidayData: any;
|
||||
|
||||
@@ -28,11 +27,13 @@ export class ViewHolidaysComponent {
|
||||
* Retrieves hioliday data from `resolve`.
|
||||
* @param {ActivatedRoute} route Activated Route.
|
||||
*/
|
||||
constructor(private route: ActivatedRoute,
|
||||
constructor(
|
||||
private route: ActivatedRoute,
|
||||
private router: Router,
|
||||
private dialog: MatDialog,
|
||||
private translateService: TranslateService,
|
||||
private organizationService: OrganizationService) {
|
||||
private organizationService: OrganizationService
|
||||
) {
|
||||
this.route.data.subscribe((data: { holidays: any }) => {
|
||||
this.holidayData = data.holidays;
|
||||
});
|
||||
@@ -47,10 +48,9 @@ export class ViewHolidaysComponent {
|
||||
});
|
||||
deleteHolidayDialogRef.afterClosed().subscribe((response: any) => {
|
||||
if (response.delete) {
|
||||
this.organizationService.deleteHoliday(this.holidayData.id)
|
||||
.subscribe(() => {
|
||||
this.router.navigate(['../'], { relativeTo: this.route });
|
||||
});
|
||||
this.organizationService.deleteHoliday(this.holidayData.id).subscribe(() => {
|
||||
this.router.navigate(['../'], { relativeTo: this.route });
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
@@ -60,16 +60,20 @@ export class ViewHolidaysComponent {
|
||||
*/
|
||||
activateHoliday() {
|
||||
const unAssignStaffDialogRef = this.dialog.open(ConfirmationDialogComponent, {
|
||||
data: { heading: this.translateService.instant('labels.heading.Holiday'), dialogContext: this.translateService.instant('labels.dialogContext.Are you sure you want to activate') + ` ${this.holidayData.name} ` + this.translateService.instant('labels.dialogContext.holiday') }
|
||||
data: {
|
||||
heading: this.translateService.instant('labels.heading.Holiday'),
|
||||
dialogContext:
|
||||
this.translateService.instant('labels.dialogContext.Are you sure you want to activate') +
|
||||
` ${this.holidayData.name} ` +
|
||||
this.translateService.instant('labels.dialogContext.holiday')
|
||||
}
|
||||
});
|
||||
unAssignStaffDialogRef.afterClosed().subscribe((response: { confirm: any }) => {
|
||||
if (response.confirm) {
|
||||
this.organizationService.activateHoliday(this.holidayData.id)
|
||||
.subscribe(() => {
|
||||
this.router.navigate(['/organization/holidays']);
|
||||
});
|
||||
this.organizationService.activateHoliday(this.holidayData.id).subscribe(() => {
|
||||
this.router.navigate(['/organization/holidays']);
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -8,9 +8,8 @@ describe('InvestorsComponent', () => {
|
||||
|
||||
beforeEach(async () => {
|
||||
await TestBed.configureTestingModule({
|
||||
declarations: [ InvestorsComponent ]
|
||||
})
|
||||
.compileComponents();
|
||||
declarations: [InvestorsComponent]
|
||||
}).compileComponents();
|
||||
});
|
||||
|
||||
beforeEach(() => {
|
||||
|
||||
@@ -18,14 +18,13 @@ import { CancelDialogComponent } from 'app/shared/cancel-dialog/cancel-dialog.co
|
||||
styleUrls: ['./investors.component.scss'],
|
||||
animations: [
|
||||
trigger('detailExpand', [
|
||||
state('collapsed', style({height: '0px', minHeight: '0'})),
|
||||
state('expanded', style({height: '*'})),
|
||||
transition('expanded <=> collapsed', animate('225ms cubic-bezier(0.4, 0.0, 0.2, 1)')),
|
||||
]),
|
||||
],
|
||||
state('collapsed', style({ height: '0px', minHeight: '0' })),
|
||||
state('expanded', style({ height: '*' })),
|
||||
transition('expanded <=> collapsed', animate('225ms cubic-bezier(0.4, 0.0, 0.2, 1)'))])
|
||||
|
||||
]
|
||||
})
|
||||
export class InvestorsComponent implements OnInit {
|
||||
|
||||
/** Minimum transaction date allowed. */
|
||||
minDate = new Date(2000, 0, 1);
|
||||
/** Maximum transaction date allowed. */
|
||||
@@ -74,13 +73,25 @@ export class InvestorsComponent implements OnInit {
|
||||
];
|
||||
|
||||
/** Columns to be displayed in investors table. */
|
||||
displayedColumns: string[] = ['status', 'effectiveFrom', 'ownerExternalId', 'loanAccount', 'transferExternalId', 'settlementDate', 'purchasePriceRatio', 'totalAmount', 'actions'];
|
||||
constructor(private settingsService: SettingsService,
|
||||
displayedColumns: string[] = [
|
||||
'status',
|
||||
'effectiveFrom',
|
||||
'ownerExternalId',
|
||||
'loanAccount',
|
||||
'transferExternalId',
|
||||
'settlementDate',
|
||||
'purchasePriceRatio',
|
||||
'totalAmount',
|
||||
'actions'
|
||||
];
|
||||
constructor(
|
||||
private settingsService: SettingsService,
|
||||
private router: Router,
|
||||
private dialog: MatDialog,
|
||||
private externalAssetOwner: ExternalAssetOwner,
|
||||
private externalAssetOwnerService: ExternalAssetOwnerService,
|
||||
private dateUtils: Dates) { }
|
||||
private dateUtils: Dates
|
||||
) {}
|
||||
|
||||
ngOnInit(): void {
|
||||
this.maxDate = this.settingsService.maxAllowedDate;
|
||||
@@ -118,9 +129,9 @@ export class InvestorsComponent implements OnInit {
|
||||
searchEAO(): void {
|
||||
this.isLoading = true;
|
||||
const payload: any = {
|
||||
'request': {},
|
||||
'page': this.currentPage,
|
||||
'size': this.pageSize
|
||||
request: {},
|
||||
page: this.currentPage,
|
||||
size: this.pageSize
|
||||
};
|
||||
const dateFormat = 'yyyy-MM-dd';
|
||||
const request: any = {};
|
||||
@@ -142,12 +153,11 @@ export class InvestorsComponent implements OnInit {
|
||||
payload['request'] = request;
|
||||
this.externalAssetOwnerService.searchExternalAssetOwnerTransfer(payload).subscribe((response: any) => {
|
||||
this.totalRows = response.totalElements;
|
||||
this.existsDataToFilter = (response.totalElements > 0);
|
||||
this.existsDataToFilter = response.totalElements > 0;
|
||||
this.dataSource.data = response.content;
|
||||
this.searchResults = response.content;
|
||||
this.isLoading = false;
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
transform(data: any): any {
|
||||
@@ -169,18 +179,18 @@ export class InvestorsComponent implements OnInit {
|
||||
const payload: any = {
|
||||
transferExternalId: transfer.transferExternalId
|
||||
};
|
||||
this.externalAssetOwnerService.executeExternalAssetOwnerTransferCommand(transfer.transferId, payload, 'cancel')
|
||||
this.externalAssetOwnerService
|
||||
.executeExternalAssetOwnerTransferCommand(transfer.transferId, payload, 'cancel')
|
||||
.subscribe((result: any) => {
|
||||
this.reload();
|
||||
});
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
reload() {
|
||||
const url: string = this.router.url;
|
||||
this.router.navigateByUrl(`/`, {skipLocationChange: true})
|
||||
.then(() => this.router.navigate([url]));
|
||||
this.router.navigateByUrl(`/`, { skipLocationChange: true }).then(() => this.router.navigate([url]));
|
||||
}
|
||||
|
||||
private resetPaginator() {
|
||||
|
||||
-2
@@ -13,7 +13,6 @@ import { OrganizationService } from '../../organization.service';
|
||||
*/
|
||||
@Injectable()
|
||||
export class LoanProvisioningCriteriaAndTemplateResolver implements Resolve<Object> {
|
||||
|
||||
/**
|
||||
* @param {OrganizationService} organizationService Products service.
|
||||
*/
|
||||
@@ -27,5 +26,4 @@ export class LoanProvisioningCriteriaAndTemplateResolver implements Resolve<Obje
|
||||
const provisioningId = route.paramMap.get('id');
|
||||
return this.organizationService.getProvisioningCriteria(provisioningId, true);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
-2
@@ -13,7 +13,6 @@ import { OrganizationService } from '../../organization.service';
|
||||
*/
|
||||
@Injectable()
|
||||
export class LoanProvisioningCriteriaTemplateResolver implements Resolve<Object> {
|
||||
|
||||
/**
|
||||
* @param {OrganizationService} organizationService Products service.
|
||||
*/
|
||||
@@ -26,5 +25,4 @@ export class LoanProvisioningCriteriaTemplateResolver implements Resolve<Object>
|
||||
resolve(): Observable<any> {
|
||||
return this.organizationService.getProvisioningCriteriaTemplate();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
-2
@@ -13,7 +13,6 @@ import { OrganizationService } from '../../organization.service';
|
||||
*/
|
||||
@Injectable()
|
||||
export class LoanProvisioningCriteriaResolver implements Resolve<Object> {
|
||||
|
||||
/**
|
||||
* @param {OrganizationService} organizationService Organization service.
|
||||
*/
|
||||
@@ -27,5 +26,4 @@ export class LoanProvisioningCriteriaResolver implements Resolve<Object> {
|
||||
const provisioningId = route.paramMap.get('id');
|
||||
return this.organizationService.getProvisioningCriteria(provisioningId);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
-2
@@ -13,7 +13,6 @@ import { OrganizationService } from '../../organization.service';
|
||||
*/
|
||||
@Injectable()
|
||||
export class LoanProvisioningCriteriasResolver implements Resolve<Object> {
|
||||
|
||||
/**
|
||||
* @param {OrganizationService} organizationService Products service.
|
||||
*/
|
||||
@@ -26,5 +25,4 @@ export class LoanProvisioningCriteriasResolver implements Resolve<Object> {
|
||||
resolve(): Observable<any> {
|
||||
return this.organizationService.getProvisioningCriterias();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
+2
-3
@@ -8,9 +8,8 @@ describe('CreateLoanProvisioningCriteriaComponent', () => {
|
||||
|
||||
beforeEach(async(() => {
|
||||
TestBed.configureTestingModule({
|
||||
declarations: [ CreateLoanProvisioningCriteriaComponent ]
|
||||
})
|
||||
.compileComponents();
|
||||
declarations: [CreateLoanProvisioningCriteriaComponent]
|
||||
}).compileComponents();
|
||||
}));
|
||||
|
||||
beforeEach(() => {
|
||||
|
||||
+96
-64
@@ -26,7 +26,6 @@ import { SettingsService } from 'app/settings/settings.service';
|
||||
styleUrls: ['./create-loan-provisioning-criteria.component.scss']
|
||||
})
|
||||
export class CreateLoanProvisioningCriteriaComponent implements OnInit {
|
||||
|
||||
/** Loan Provisioning Criteria form. */
|
||||
provisioningCriteriaForm: UntypedFormGroup;
|
||||
/** Loan Provisioning Criteria Template */
|
||||
@@ -37,16 +36,24 @@ export class CreateLoanProvisioningCriteriaComponent implements OnInit {
|
||||
expenseAccounts: any;
|
||||
|
||||
/** Columns to be displayed in definitions table. */
|
||||
displayedColumns: string[] = ['category', 'minAge', 'maxAge', 'percentage', 'liabilityAccount', 'expenseAccount', 'edit'];
|
||||
displayedColumns: string[] = [
|
||||
'category',
|
||||
'minAge',
|
||||
'maxAge',
|
||||
'percentage',
|
||||
'liabilityAccount',
|
||||
'expenseAccount',
|
||||
'edit'
|
||||
];
|
||||
/** Criteria Definitions Array */
|
||||
definitions: {
|
||||
categoryId: number,
|
||||
categoryName: string,
|
||||
maxAge?: number,
|
||||
minAge?: number,
|
||||
liabilityAccount?: string,
|
||||
expenseAccount?: string,
|
||||
provisioningPercentage?: number
|
||||
categoryId: number;
|
||||
categoryName: string;
|
||||
maxAge?: number;
|
||||
minAge?: number;
|
||||
liabilityAccount?: string;
|
||||
expenseAccount?: string;
|
||||
provisioningPercentage?: number;
|
||||
}[] = [];
|
||||
/** Checks Definitons Table Validity */
|
||||
isDefinitionValid: any = {};
|
||||
@@ -59,18 +66,24 @@ export class CreateLoanProvisioningCriteriaComponent implements OnInit {
|
||||
* @param {ActivatedRoute} route Activated Route.
|
||||
* @param {Router} router Router for navigation.
|
||||
*/
|
||||
constructor(private formBuilder: UntypedFormBuilder,
|
||||
private organizationService: OrganizationService,
|
||||
private settingsService: SettingsService,
|
||||
private router: Router,
|
||||
public dialog: MatDialog,
|
||||
private route: ActivatedRoute) {
|
||||
this.route.data.subscribe((data: { loanProvisioningCriteriaTemplate: any }) => {
|
||||
constructor(
|
||||
private formBuilder: UntypedFormBuilder,
|
||||
private organizationService: OrganizationService,
|
||||
private settingsService: SettingsService,
|
||||
private router: Router,
|
||||
public dialog: MatDialog,
|
||||
private route: ActivatedRoute
|
||||
) {
|
||||
this.route.data.subscribe((data: { loanProvisioningCriteriaTemplate: any }) => {
|
||||
this.loanProvisioningCriteriaTemplate = data.loanProvisioningCriteriaTemplate;
|
||||
this.definitions = this.loanProvisioningCriteriaTemplate.definitions;
|
||||
this.liabilityAccounts = this.loanProvisioningCriteriaTemplate.glAccounts.filter((account: any) => account.type.value === 'LIABILITY');
|
||||
this.expenseAccounts = this.loanProvisioningCriteriaTemplate.glAccounts.filter((account: any) => account.type.value === 'EXPENSE');
|
||||
});
|
||||
this.liabilityAccounts = this.loanProvisioningCriteriaTemplate.glAccounts.filter(
|
||||
(account: any) => account.type.value === 'LIABILITY'
|
||||
);
|
||||
this.expenseAccounts = this.loanProvisioningCriteriaTemplate.glAccounts.filter(
|
||||
(account: any) => account.type.value === 'EXPENSE'
|
||||
);
|
||||
});
|
||||
}
|
||||
|
||||
ngOnInit() {
|
||||
@@ -82,8 +95,11 @@ export class CreateLoanProvisioningCriteriaComponent implements OnInit {
|
||||
*/
|
||||
createProvisioningCriteriaForm() {
|
||||
this.provisioningCriteriaForm = this.formBuilder.group({
|
||||
'criteriaName': ['', Validators.required],
|
||||
'loanProducts': ['']
|
||||
criteriaName: [
|
||||
'',
|
||||
Validators.required
|
||||
],
|
||||
loanProducts: ['']
|
||||
});
|
||||
}
|
||||
|
||||
@@ -119,46 +135,56 @@ export class CreateLoanProvisioningCriteriaComponent implements OnInit {
|
||||
*/
|
||||
getDefinitionFormFields(definition: any) {
|
||||
const formfields: FormfieldBase[] = [];
|
||||
formfields.push(new InputBase({
|
||||
controlName: 'minAge',
|
||||
label: 'Min Age',
|
||||
value: definition ? definition.minAge : '',
|
||||
type: 'number',
|
||||
required: true,
|
||||
order: 1
|
||||
}));
|
||||
formfields.push(new InputBase({
|
||||
controlName: 'maxAge',
|
||||
label: 'Max Age',
|
||||
value: definition ? definition.maxAge : '',
|
||||
type: 'number',
|
||||
required: true,
|
||||
order: 2
|
||||
}));
|
||||
formfields.push(new InputBase({
|
||||
controlName: 'provisioningPercentage',
|
||||
label: 'Percentage (%)',
|
||||
value: definition ? definition.provisioningPercentage : '',
|
||||
type: 'number',
|
||||
required: true,
|
||||
order: 3
|
||||
}));
|
||||
formfields.push(new SelectBase({
|
||||
controlName: 'liabilityAccount',
|
||||
label: 'Liability Account',
|
||||
value: definition ? definition.liabilityAccount : '',
|
||||
options: { label: 'name', value: 'id', data: this.liabilityAccounts },
|
||||
required: true,
|
||||
order: 4
|
||||
}));
|
||||
formfields.push(new SelectBase({
|
||||
controlName: 'expenseAccount',
|
||||
label: 'Expense Account',
|
||||
value: definition ? definition.expenseAccount : '',
|
||||
options: { label: 'name', value: 'id', data: this.expenseAccounts },
|
||||
required: true,
|
||||
order: 5
|
||||
}));
|
||||
formfields.push(
|
||||
new InputBase({
|
||||
controlName: 'minAge',
|
||||
label: 'Min Age',
|
||||
value: definition ? definition.minAge : '',
|
||||
type: 'number',
|
||||
required: true,
|
||||
order: 1
|
||||
})
|
||||
);
|
||||
formfields.push(
|
||||
new InputBase({
|
||||
controlName: 'maxAge',
|
||||
label: 'Max Age',
|
||||
value: definition ? definition.maxAge : '',
|
||||
type: 'number',
|
||||
required: true,
|
||||
order: 2
|
||||
})
|
||||
);
|
||||
formfields.push(
|
||||
new InputBase({
|
||||
controlName: 'provisioningPercentage',
|
||||
label: 'Percentage (%)',
|
||||
value: definition ? definition.provisioningPercentage : '',
|
||||
type: 'number',
|
||||
required: true,
|
||||
order: 3
|
||||
})
|
||||
);
|
||||
formfields.push(
|
||||
new SelectBase({
|
||||
controlName: 'liabilityAccount',
|
||||
label: 'Liability Account',
|
||||
value: definition ? definition.liabilityAccount : '',
|
||||
options: { label: 'name', value: 'id', data: this.liabilityAccounts },
|
||||
required: true,
|
||||
order: 4
|
||||
})
|
||||
);
|
||||
formfields.push(
|
||||
new SelectBase({
|
||||
controlName: 'expenseAccount',
|
||||
label: 'Expense Account',
|
||||
value: definition ? definition.expenseAccount : '',
|
||||
options: { label: 'name', value: 'id', data: this.expenseAccounts },
|
||||
required: true,
|
||||
order: 5
|
||||
})
|
||||
);
|
||||
return formfields;
|
||||
}
|
||||
|
||||
@@ -166,7 +192,8 @@ export class CreateLoanProvisioningCriteriaComponent implements OnInit {
|
||||
* Returns validity of form and table.
|
||||
*/
|
||||
get provisioningCriteriaFormValid() {
|
||||
const definitionsValid: boolean = Object.entries(this.isDefinitionValid).length === this.definitions.length ? true : false;
|
||||
const definitionsValid: boolean =
|
||||
Object.entries(this.isDefinitionValid).length === this.definitions.length ? true : false;
|
||||
return this.provisioningCriteriaForm.valid && definitionsValid;
|
||||
}
|
||||
|
||||
@@ -186,8 +213,13 @@ export class CreateLoanProvisioningCriteriaComponent implements OnInit {
|
||||
locale
|
||||
};
|
||||
this.organizationService.createProvisioningCriteria(loanProvisioningCriteria).subscribe((response: any) => {
|
||||
this.router.navigate(['../', response.resourceId], { relativeTo: this.route });
|
||||
this.router.navigate(
|
||||
[
|
||||
'../',
|
||||
response.resourceId
|
||||
],
|
||||
{ relativeTo: this.route }
|
||||
);
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
+2
-3
@@ -8,9 +8,8 @@ describe('EditLoanProvisioningCriteriaComponent', () => {
|
||||
|
||||
beforeEach(async(() => {
|
||||
TestBed.configureTestingModule({
|
||||
declarations: [ EditLoanProvisioningCriteriaComponent ]
|
||||
})
|
||||
.compileComponents();
|
||||
declarations: [EditLoanProvisioningCriteriaComponent]
|
||||
}).compileComponents();
|
||||
}));
|
||||
|
||||
beforeEach(() => {
|
||||
|
||||
+95
-66
@@ -26,7 +26,6 @@ import { SettingsService } from 'app/settings/settings.service';
|
||||
styleUrls: ['./edit-loan-provisioning-criteria.component.scss']
|
||||
})
|
||||
export class EditLoanProvisioningCriteriaComponent implements OnInit {
|
||||
|
||||
/** Loan Provisioning Criteria form. */
|
||||
provisioningCriteriaForm: UntypedFormGroup;
|
||||
/** Loan Provisioning Criteria Template */
|
||||
@@ -39,16 +38,24 @@ export class EditLoanProvisioningCriteriaComponent implements OnInit {
|
||||
loanProducts: any;
|
||||
|
||||
/** Columns to be displayed in definitions table. */
|
||||
displayedColumns: string[] = ['category', 'minAge', 'maxAge', 'percentage', 'liabilityAccount', 'expenseAccount', 'edit'];
|
||||
displayedColumns: string[] = [
|
||||
'category',
|
||||
'minAge',
|
||||
'maxAge',
|
||||
'percentage',
|
||||
'liabilityAccount',
|
||||
'expenseAccount',
|
||||
'edit'
|
||||
];
|
||||
/** Criteria Definitions Array */
|
||||
definitions: {
|
||||
categoryId: number,
|
||||
categoryName: string,
|
||||
maxAge?: number,
|
||||
minAge?: number,
|
||||
liabilityAccount?: string,
|
||||
expenseAccount?: string,
|
||||
provisioningPercentage?: number
|
||||
categoryId: number;
|
||||
categoryName: string;
|
||||
maxAge?: number;
|
||||
minAge?: number;
|
||||
liabilityAccount?: string;
|
||||
expenseAccount?: string;
|
||||
provisioningPercentage?: number;
|
||||
}[] = [];
|
||||
|
||||
/**
|
||||
@@ -59,19 +66,27 @@ export class EditLoanProvisioningCriteriaComponent implements OnInit {
|
||||
* @param {ActivatedRoute} route Activated Route.
|
||||
* @param {Router} router Router for navigation.
|
||||
*/
|
||||
constructor(private formBuilder: UntypedFormBuilder,
|
||||
private organizationService: OrganizationService,
|
||||
private router: Router,
|
||||
private settingsService: SettingsService,
|
||||
public dialog: MatDialog,
|
||||
private route: ActivatedRoute) {
|
||||
this.route.data.subscribe((data: { loanProvisioningCriteriaAndTemplate: any }) => {
|
||||
constructor(
|
||||
private formBuilder: UntypedFormBuilder,
|
||||
private organizationService: OrganizationService,
|
||||
private router: Router,
|
||||
private settingsService: SettingsService,
|
||||
public dialog: MatDialog,
|
||||
private route: ActivatedRoute
|
||||
) {
|
||||
this.route.data.subscribe((data: { loanProvisioningCriteriaAndTemplate: any }) => {
|
||||
this.loanProvisioningCriteriaAndTemplate = data.loanProvisioningCriteriaAndTemplate;
|
||||
this.definitions = this.loanProvisioningCriteriaAndTemplate.definitions;
|
||||
this.loanProducts = this.loanProvisioningCriteriaAndTemplate.loanProducts.concat(this.loanProvisioningCriteriaAndTemplate.selectedLoanProducts);
|
||||
this.liabilityAccounts = this.loanProvisioningCriteriaAndTemplate.glAccounts.filter((account: any) => account.type.value === 'LIABILITY');
|
||||
this.expenseAccounts = this.loanProvisioningCriteriaAndTemplate.glAccounts.filter((account: any) => account.type.value === 'EXPENSE');
|
||||
});
|
||||
this.loanProducts = this.loanProvisioningCriteriaAndTemplate.loanProducts.concat(
|
||||
this.loanProvisioningCriteriaAndTemplate.selectedLoanProducts
|
||||
);
|
||||
this.liabilityAccounts = this.loanProvisioningCriteriaAndTemplate.glAccounts.filter(
|
||||
(account: any) => account.type.value === 'LIABILITY'
|
||||
);
|
||||
this.expenseAccounts = this.loanProvisioningCriteriaAndTemplate.glAccounts.filter(
|
||||
(account: any) => account.type.value === 'EXPENSE'
|
||||
);
|
||||
});
|
||||
}
|
||||
|
||||
ngOnInit() {
|
||||
@@ -83,8 +98,11 @@ export class EditLoanProvisioningCriteriaComponent implements OnInit {
|
||||
*/
|
||||
createProvisioningCriteriaForm() {
|
||||
this.provisioningCriteriaForm = this.formBuilder.group({
|
||||
'criteriaName': [this.loanProvisioningCriteriaAndTemplate.criteriaName, Validators.required],
|
||||
'loanProducts': [this.loanProvisioningCriteriaAndTemplate.selectedLoanProducts]
|
||||
criteriaName: [
|
||||
this.loanProvisioningCriteriaAndTemplate.criteriaName,
|
||||
Validators.required
|
||||
],
|
||||
loanProducts: [this.loanProvisioningCriteriaAndTemplate.selectedLoanProducts]
|
||||
});
|
||||
}
|
||||
|
||||
@@ -128,46 +146,56 @@ export class EditLoanProvisioningCriteriaComponent implements OnInit {
|
||||
*/
|
||||
getDefinitionFormFields(definition: any) {
|
||||
const formfields: FormfieldBase[] = [];
|
||||
formfields.push(new InputBase({
|
||||
controlName: 'minAge',
|
||||
label: 'Min Age',
|
||||
value: definition ? definition.minAge : '',
|
||||
type: 'number',
|
||||
required: true,
|
||||
order: 1
|
||||
}));
|
||||
formfields.push(new InputBase({
|
||||
controlName: 'maxAge',
|
||||
label: 'Max Age',
|
||||
value: definition ? definition.maxAge : '',
|
||||
type: 'number',
|
||||
required: true,
|
||||
order: 2
|
||||
}));
|
||||
formfields.push(new InputBase({
|
||||
controlName: 'provisioningPercentage',
|
||||
label: 'Percentage (%)',
|
||||
value: definition ? definition.provisioningPercentage : '',
|
||||
type: 'number',
|
||||
required: true,
|
||||
order: 3
|
||||
}));
|
||||
formfields.push(new SelectBase({
|
||||
controlName: 'liabilityAccount',
|
||||
label: 'Liability Account',
|
||||
value: definition ? definition.liabilityAccount : '',
|
||||
options: { label: 'name', value: 'id', data: this.liabilityAccounts },
|
||||
required: true,
|
||||
order: 4
|
||||
}));
|
||||
formfields.push(new SelectBase({
|
||||
controlName: 'expenseAccount',
|
||||
label: 'Expense Account',
|
||||
value: definition ? definition.expenseAccount : '',
|
||||
options: { label: 'name', value: 'id', data: this.expenseAccounts },
|
||||
required: true,
|
||||
order: 5
|
||||
}));
|
||||
formfields.push(
|
||||
new InputBase({
|
||||
controlName: 'minAge',
|
||||
label: 'Min Age',
|
||||
value: definition ? definition.minAge : '',
|
||||
type: 'number',
|
||||
required: true,
|
||||
order: 1
|
||||
})
|
||||
);
|
||||
formfields.push(
|
||||
new InputBase({
|
||||
controlName: 'maxAge',
|
||||
label: 'Max Age',
|
||||
value: definition ? definition.maxAge : '',
|
||||
type: 'number',
|
||||
required: true,
|
||||
order: 2
|
||||
})
|
||||
);
|
||||
formfields.push(
|
||||
new InputBase({
|
||||
controlName: 'provisioningPercentage',
|
||||
label: 'Percentage (%)',
|
||||
value: definition ? definition.provisioningPercentage : '',
|
||||
type: 'number',
|
||||
required: true,
|
||||
order: 3
|
||||
})
|
||||
);
|
||||
formfields.push(
|
||||
new SelectBase({
|
||||
controlName: 'liabilityAccount',
|
||||
label: 'Liability Account',
|
||||
value: definition ? definition.liabilityAccount : '',
|
||||
options: { label: 'name', value: 'id', data: this.liabilityAccounts },
|
||||
required: true,
|
||||
order: 4
|
||||
})
|
||||
);
|
||||
formfields.push(
|
||||
new SelectBase({
|
||||
controlName: 'expenseAccount',
|
||||
label: 'Expense Account',
|
||||
value: definition ? definition.expenseAccount : '',
|
||||
options: { label: 'name', value: 'id', data: this.expenseAccounts },
|
||||
required: true,
|
||||
order: 5
|
||||
})
|
||||
);
|
||||
return formfields;
|
||||
}
|
||||
|
||||
@@ -193,9 +221,10 @@ export class EditLoanProvisioningCriteriaComponent implements OnInit {
|
||||
definitions: this.definitions,
|
||||
locale
|
||||
};
|
||||
this.organizationService.updateProvisioningCriteria(this.loanProvisioningCriteriaAndTemplate.criteriaId, loanProvisioningCriteria).subscribe((response: any) => {
|
||||
this.router.navigate(['../'], { relativeTo: this.route });
|
||||
});
|
||||
this.organizationService
|
||||
.updateProvisioningCriteria(this.loanProvisioningCriteriaAndTemplate.criteriaId, loanProvisioningCriteria)
|
||||
.subscribe((response: any) => {
|
||||
this.router.navigate(['../'], { relativeTo: this.route });
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
+2
-3
@@ -8,9 +8,8 @@ describe('LoanProvisioningCriteriaComponent', () => {
|
||||
|
||||
beforeEach(async(() => {
|
||||
TestBed.configureTestingModule({
|
||||
declarations: [ LoanProvisioningCriteriaComponent ]
|
||||
})
|
||||
.compileComponents();
|
||||
declarations: [LoanProvisioningCriteriaComponent]
|
||||
}).compileComponents();
|
||||
}));
|
||||
|
||||
beforeEach(() => {
|
||||
|
||||
+5
-4
@@ -17,11 +17,13 @@ import { of } from 'rxjs';
|
||||
styleUrls: ['./loan-provisioning-criteria.component.scss']
|
||||
})
|
||||
export class LoanProvisioningCriteriaComponent implements OnInit {
|
||||
|
||||
/** Loan Provisioning Criteria data. */
|
||||
loanProvisioningCriteriaData: any;
|
||||
/** Columns to be displayed in loan provisioning criteria table. */
|
||||
displayedColumns: string[] = ['criteriaName', 'createdBy'];
|
||||
displayedColumns: string[] = [
|
||||
'criteriaName',
|
||||
'createdBy'
|
||||
];
|
||||
/** Data source for loan provisioning criteria table. */
|
||||
dataSource: MatTableDataSource<any>;
|
||||
|
||||
@@ -35,7 +37,7 @@ export class LoanProvisioningCriteriaComponent implements OnInit {
|
||||
* @param {ActivatedRoute} route Activated Route.
|
||||
*/
|
||||
constructor(private route: ActivatedRoute) {
|
||||
this.route.data.subscribe(( data: { loanProvisioningCriterias: any }) => {
|
||||
this.route.data.subscribe((data: { loanProvisioningCriterias: any }) => {
|
||||
this.loanProvisioningCriteriaData = data.loanProvisioningCriterias;
|
||||
});
|
||||
}
|
||||
@@ -63,5 +65,4 @@ export class LoanProvisioningCriteriaComponent implements OnInit {
|
||||
this.dataSource.paginator = this.paginator;
|
||||
this.dataSource.sort = this.sort;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
+2
-3
@@ -8,9 +8,8 @@ describe('ViewLoanProvisioningCriteriaComponent', () => {
|
||||
|
||||
beforeEach(async(() => {
|
||||
TestBed.configureTestingModule({
|
||||
declarations: [ ViewLoanProvisioningCriteriaComponent ]
|
||||
})
|
||||
.compileComponents();
|
||||
declarations: [ViewLoanProvisioningCriteriaComponent]
|
||||
}).compileComponents();
|
||||
}));
|
||||
|
||||
beforeEach(() => {
|
||||
|
||||
+20
-14
@@ -19,13 +19,19 @@ import { DeleteDialogComponent } from 'app/shared/delete-dialog/delete-dialog.co
|
||||
styleUrls: ['./view-loan-provisioning-criteria.component.scss']
|
||||
})
|
||||
export class ViewLoanProvisioningCriteriaComponent implements OnInit {
|
||||
|
||||
/** Loan Provisioning data. */
|
||||
provisioningData: any;
|
||||
/** Loan Product String. */
|
||||
loanProducts = '';
|
||||
/** Column Headers for Mat Table. */
|
||||
displayedColumns: string[] = ['category', 'minAge', 'maxAge', 'percentage', 'liabilityAccount', 'expenseAccount'];
|
||||
displayedColumns: string[] = [
|
||||
'category',
|
||||
'minAge',
|
||||
'maxAge',
|
||||
'percentage',
|
||||
'liabilityAccount',
|
||||
'expenseAccount'
|
||||
];
|
||||
/** Data source for loan provisioning criteria table. */
|
||||
dataSource: MatTableDataSource<any>;
|
||||
|
||||
@@ -36,12 +42,14 @@ export class ViewLoanProvisioningCriteriaComponent implements OnInit {
|
||||
* @param {Router} router Router for navigation.
|
||||
* @param {MatDialog} dialog Dialog reference.
|
||||
*/
|
||||
constructor(private organizationService: OrganizationService,
|
||||
private route: ActivatedRoute,
|
||||
private router: Router,
|
||||
public dialog: MatDialog) {
|
||||
this.route.data.subscribe((data: { loanProvisioningCriteria: any }) => {
|
||||
this.provisioningData = data.loanProvisioningCriteria;
|
||||
constructor(
|
||||
private organizationService: OrganizationService,
|
||||
private route: ActivatedRoute,
|
||||
private router: Router,
|
||||
public dialog: MatDialog
|
||||
) {
|
||||
this.route.data.subscribe((data: { loanProvisioningCriteria: any }) => {
|
||||
this.provisioningData = data.loanProvisioningCriteria;
|
||||
});
|
||||
}
|
||||
|
||||
@@ -55,7 +63,7 @@ export class ViewLoanProvisioningCriteriaComponent implements OnInit {
|
||||
setLoanProvisioningSelectedCriteria() {
|
||||
this.dataSource = new MatTableDataSource(this.provisioningData.definitions);
|
||||
|
||||
/** Get load products as a string. */
|
||||
/** Get load products as a string. */
|
||||
for (let _id = 0; _id < this.provisioningData.loanProducts.length; _id++) {
|
||||
this.loanProducts += this.provisioningData.loanProducts[_id].name + ',';
|
||||
}
|
||||
@@ -70,12 +78,10 @@ export class ViewLoanProvisioningCriteriaComponent implements OnInit {
|
||||
});
|
||||
deleteCriteriaDialogRef.afterClosed().subscribe((response: any) => {
|
||||
if (response.delete) {
|
||||
this.organizationService.deleteProvisioningCriteria(this.provisioningData.criteriaId)
|
||||
.subscribe(() => {
|
||||
this.router.navigate(['/organization/provisioningcriteria']);
|
||||
});
|
||||
this.organizationService.deleteProvisioningCriteria(this.provisioningData.criteriaId).subscribe(() => {
|
||||
this.router.navigate(['/organization/provisioningcriteria']);
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -8,9 +8,8 @@ describe('CreateFundComponent', () => {
|
||||
|
||||
beforeEach(async () => {
|
||||
await TestBed.configureTestingModule({
|
||||
declarations: [ CreateFundComponent ]
|
||||
})
|
||||
.compileComponents();
|
||||
declarations: [CreateFundComponent]
|
||||
}).compileComponents();
|
||||
});
|
||||
|
||||
beforeEach(() => {
|
||||
|
||||
@@ -9,7 +9,6 @@ import { OrganizationService } from 'app/organization/organization.service';
|
||||
styleUrls: ['./create-fund.component.scss']
|
||||
})
|
||||
export class CreateFundComponent implements OnInit {
|
||||
|
||||
/** Charge form. */
|
||||
fundForm: UntypedFormGroup;
|
||||
|
||||
@@ -20,11 +19,12 @@ export class CreateFundComponent implements OnInit {
|
||||
* @param {ActivatedRoute} route Activated Route.
|
||||
* @param {Router} router Router for navigation.
|
||||
*/
|
||||
constructor(private organizationService: OrganizationService,
|
||||
private formBuilder: UntypedFormBuilder,
|
||||
private router: Router,
|
||||
private route: ActivatedRoute) {
|
||||
}
|
||||
constructor(
|
||||
private organizationService: OrganizationService,
|
||||
private formBuilder: UntypedFormBuilder,
|
||||
private router: Router,
|
||||
private route: ActivatedRoute
|
||||
) {}
|
||||
|
||||
ngOnInit() {
|
||||
this.createFundForm();
|
||||
@@ -35,19 +35,18 @@ export class CreateFundComponent implements OnInit {
|
||||
*/
|
||||
createFundForm() {
|
||||
this.fundForm = this.formBuilder.group({
|
||||
'name': ['', Validators.required],
|
||||
'externalId': ['']
|
||||
name: [
|
||||
'',
|
||||
Validators.required
|
||||
],
|
||||
externalId: ['']
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
submit() {
|
||||
const payload = this.fundForm.getRawValue();
|
||||
this.organizationService.createFund(payload)
|
||||
.subscribe((response: any) => {
|
||||
this.router.navigate(['../'], { relativeTo: this.route });
|
||||
});
|
||||
this.organizationService.createFund(payload).subscribe((response: any) => {
|
||||
this.router.navigate(['../'], { relativeTo: this.route });
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -8,9 +8,8 @@ describe('EditFundComponent', () => {
|
||||
|
||||
beforeEach(async () => {
|
||||
await TestBed.configureTestingModule({
|
||||
declarations: [ EditFundComponent ]
|
||||
})
|
||||
.compileComponents();
|
||||
declarations: [EditFundComponent]
|
||||
}).compileComponents();
|
||||
});
|
||||
|
||||
beforeEach(() => {
|
||||
|
||||
@@ -9,7 +9,6 @@ import { OrganizationService } from 'app/organization/organization.service';
|
||||
styleUrls: ['./edit-fund.component.scss']
|
||||
})
|
||||
export class EditFundComponent implements OnInit {
|
||||
|
||||
/** Selected Data. */
|
||||
fundData: any;
|
||||
/** Charge form. */
|
||||
@@ -22,10 +21,12 @@ export class EditFundComponent implements OnInit {
|
||||
* @param {ActivatedRoute} route Activated Route.
|
||||
* @param {Router} router Router for navigation.
|
||||
*/
|
||||
constructor(private organizationService: OrganizationService,
|
||||
private formBuilder: UntypedFormBuilder,
|
||||
private router: Router,
|
||||
private route: ActivatedRoute) {
|
||||
constructor(
|
||||
private organizationService: OrganizationService,
|
||||
private formBuilder: UntypedFormBuilder,
|
||||
private router: Router,
|
||||
private route: ActivatedRoute
|
||||
) {
|
||||
this.route.data.subscribe((data: { fundData: any }) => {
|
||||
this.fundData = data.fundData;
|
||||
});
|
||||
@@ -40,17 +41,18 @@ export class EditFundComponent implements OnInit {
|
||||
*/
|
||||
createFundForm() {
|
||||
this.fundForm = this.formBuilder.group({
|
||||
'name': [this.fundData.name, Validators.required],
|
||||
'externalId': [this.fundData.externalId]
|
||||
name: [
|
||||
this.fundData.name,
|
||||
Validators.required
|
||||
],
|
||||
externalId: [this.fundData.externalId]
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
submit() {
|
||||
const payload = this.fundForm.getRawValue();
|
||||
this.organizationService.editFund(this.fundData.id.toString(), payload)
|
||||
.subscribe((response: any) => {
|
||||
this.router.navigate(['../'], { relativeTo: this.route });
|
||||
});
|
||||
this.organizationService.editFund(this.fundData.id.toString(), payload).subscribe((response: any) => {
|
||||
this.router.navigate(['../'], { relativeTo: this.route });
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@@ -8,9 +8,8 @@ describe('ManageFundsComponent', () => {
|
||||
|
||||
beforeEach(async(() => {
|
||||
TestBed.configureTestingModule({
|
||||
declarations: [ ManageFundsComponent ]
|
||||
})
|
||||
.compileComponents();
|
||||
declarations: [ManageFundsComponent]
|
||||
}).compileComponents();
|
||||
}));
|
||||
|
||||
beforeEach(() => {
|
||||
|
||||
@@ -31,7 +31,6 @@ import { MatSort } from '@angular/material/sort';
|
||||
styleUrls: ['./manage-funds.component.scss']
|
||||
})
|
||||
export class ManageFundsComponent implements OnInit, AfterViewInit {
|
||||
|
||||
/** Manage Funds data. */
|
||||
fundsData: any;
|
||||
/** New Fund form */
|
||||
@@ -44,7 +43,10 @@ export class ManageFundsComponent implements OnInit, AfterViewInit {
|
||||
/* Template for popover on funds form */
|
||||
@ViewChild('templateFundFormRef') templateFundFormRef: TemplateRef<any>;
|
||||
/** Columns to be displayed in funds table. */
|
||||
displayedColumns: string[] = ['name', 'externalId'];
|
||||
displayedColumns: string[] = [
|
||||
'name',
|
||||
'externalId'
|
||||
];
|
||||
/** Data source for Funds table. */
|
||||
dataSource: MatTableDataSource<any>;
|
||||
|
||||
@@ -63,14 +65,16 @@ export class ManageFundsComponent implements OnInit, AfterViewInit {
|
||||
* @param {ConfigurationWizardService} configurationWizardService ConfigurationWizard Service.
|
||||
* @param {PopoverService} popoverService PopoverService.
|
||||
*/
|
||||
constructor(private route: ActivatedRoute,
|
||||
private formBuilder: UntypedFormBuilder,
|
||||
private organizationservice: OrganizationService,
|
||||
public dialog: MatDialog,
|
||||
private router: Router,
|
||||
private configurationWizardService: ConfigurationWizardService,
|
||||
private popoverService: PopoverService) {
|
||||
this.route.data.subscribe(( data: { funds: any }) => {
|
||||
constructor(
|
||||
private route: ActivatedRoute,
|
||||
private formBuilder: UntypedFormBuilder,
|
||||
private organizationservice: OrganizationService,
|
||||
public dialog: MatDialog,
|
||||
private router: Router,
|
||||
private configurationWizardService: ConfigurationWizardService,
|
||||
private popoverService: PopoverService
|
||||
) {
|
||||
this.route.data.subscribe((data: { funds: any }) => {
|
||||
this.fundsData = data.funds;
|
||||
});
|
||||
}
|
||||
@@ -79,7 +83,6 @@ export class ManageFundsComponent implements OnInit, AfterViewInit {
|
||||
this.dataSource = new MatTableDataSource(this.fundsData);
|
||||
this.dataSource.paginator = this.paginator;
|
||||
this.dataSource.sort = this.sort;
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -95,7 +98,10 @@ export class ManageFundsComponent implements OnInit, AfterViewInit {
|
||||
*/
|
||||
createFundForm() {
|
||||
this.fundForm = this.formBuilder.group({
|
||||
'name': ['', Validators.required]
|
||||
name: [
|
||||
'',
|
||||
Validators.required
|
||||
]
|
||||
});
|
||||
}
|
||||
|
||||
@@ -105,10 +111,10 @@ export class ManageFundsComponent implements OnInit, AfterViewInit {
|
||||
addFund() {
|
||||
const newFund = this.fundForm.value;
|
||||
this.organizationservice.createFund(newFund).subscribe((response: any) => {
|
||||
this.fundsData.push({
|
||||
id: response.resourceId,
|
||||
name: newFund.name
|
||||
});
|
||||
this.fundsData.push({
|
||||
id: response.resourceId,
|
||||
name: newFund.name
|
||||
});
|
||||
this.formRef.resetForm();
|
||||
if (this.configurationWizardService.showManageFunds === true) {
|
||||
this.configurationWizardService.showManageFunds = false;
|
||||
@@ -131,7 +137,8 @@ export class ManageFundsComponent implements OnInit, AfterViewInit {
|
||||
value: fundContent,
|
||||
type: 'text',
|
||||
required: true
|
||||
}),
|
||||
})
|
||||
|
||||
];
|
||||
const data = {
|
||||
title: 'Edit Fund',
|
||||
@@ -155,7 +162,12 @@ export class ManageFundsComponent implements OnInit, AfterViewInit {
|
||||
* @param position String.
|
||||
* @param backdrop Boolean.
|
||||
*/
|
||||
showPopover(template: TemplateRef<any>, target: HTMLElement | ElementRef<any>, position: string, backdrop: boolean): void {
|
||||
showPopover(
|
||||
template: TemplateRef<any>,
|
||||
target: HTMLElement | ElementRef<any>,
|
||||
position: string,
|
||||
backdrop: boolean
|
||||
): void {
|
||||
setTimeout(() => this.popoverService.open(template, target, position, backdrop, {}), 200);
|
||||
}
|
||||
|
||||
@@ -165,7 +177,7 @@ export class ManageFundsComponent implements OnInit, AfterViewInit {
|
||||
ngAfterViewInit() {
|
||||
if (this.configurationWizardService.showManageFunds === true) {
|
||||
setTimeout(() => {
|
||||
this.showPopover(this.templateFundFormRef, this.fundFormRef.nativeElement, 'bottom', true);
|
||||
this.showPopover(this.templateFundFormRef, this.fundFormRef.nativeElement, 'bottom', true);
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -193,10 +205,10 @@ export class ManageFundsComponent implements OnInit, AfterViewInit {
|
||||
const continueSetupDialogRef = this.dialog.open(ContinueSetupDialogComponent, {
|
||||
data: {
|
||||
stepName: 'fund'
|
||||
},
|
||||
}
|
||||
});
|
||||
continueSetupDialogRef.afterClosed().subscribe((response: { step: number }) => {
|
||||
if (response.step === 1) {
|
||||
if (response.step === 1) {
|
||||
this.configurationWizardService.showManageFunds = false;
|
||||
this.router.navigate(['../'], { relativeTo: this.route });
|
||||
} else if (response.step === 2) {
|
||||
|
||||
@@ -13,7 +13,6 @@ import { OrganizationService } from '../organization.service';
|
||||
*/
|
||||
@Injectable()
|
||||
export class ManageFundsResolver implements Resolve<Object> {
|
||||
|
||||
/**
|
||||
* @param {OrganizationService} organizationService Organization service.
|
||||
*/
|
||||
@@ -26,5 +25,4 @@ export class ManageFundsResolver implements Resolve<Object> {
|
||||
resolve(): Observable<any> {
|
||||
return this.organizationService.getFunds();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -8,9 +8,8 @@ describe('ViewFundComponent', () => {
|
||||
|
||||
beforeEach(async () => {
|
||||
await TestBed.configureTestingModule({
|
||||
declarations: [ ViewFundComponent ]
|
||||
})
|
||||
.compileComponents();
|
||||
declarations: [ViewFundComponent]
|
||||
}).compileComponents();
|
||||
});
|
||||
|
||||
beforeEach(() => {
|
||||
|
||||
@@ -7,7 +7,6 @@ import { ActivatedRoute } from '@angular/router';
|
||||
styleUrls: ['./view-fund.component.scss']
|
||||
})
|
||||
export class ViewFundComponent {
|
||||
|
||||
/** Fund data. */
|
||||
fundData: any;
|
||||
|
||||
@@ -20,5 +19,4 @@ export class ViewFundComponent {
|
||||
this.fundData = data.fundData;
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -13,7 +13,6 @@ import { OrganizationService } from '../../organization.service';
|
||||
*/
|
||||
@Injectable()
|
||||
export class EditOfficeResolver implements Resolve<Object> {
|
||||
|
||||
/**
|
||||
* @param {OrganizationService} organizationService Organization service.
|
||||
*/
|
||||
@@ -27,5 +26,4 @@ export class EditOfficeResolver implements Resolve<Object> {
|
||||
const officeId = route.paramMap.get('officeId');
|
||||
return this.organizationService.getOffice(officeId, true);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -11,11 +11,10 @@ import { Observable } from 'rxjs';
|
||||
*/
|
||||
@Injectable()
|
||||
export class OfficeDatatableResolver implements Resolve<Object> {
|
||||
|
||||
/**
|
||||
* @param {SystemService} systemService Products service.
|
||||
*/
|
||||
constructor(private systemService: SystemService) { }
|
||||
constructor(private systemService: SystemService) {}
|
||||
|
||||
/**
|
||||
* Returns the Office's Datatable data.
|
||||
@@ -26,5 +25,4 @@ export class OfficeDatatableResolver implements Resolve<Object> {
|
||||
const datatableName = route.paramMap.get('datatableName');
|
||||
return this.systemService.getEntityDatatable(officeId, datatableName);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -11,11 +11,10 @@ import { Observable } from 'rxjs';
|
||||
*/
|
||||
@Injectable()
|
||||
export class OfficeDatatablesResolver implements Resolve<Object> {
|
||||
|
||||
/**
|
||||
* @param {SystemService} systemService Products service.
|
||||
*/
|
||||
constructor(private systemService: SystemService) { }
|
||||
constructor(private systemService: SystemService) {}
|
||||
|
||||
/**
|
||||
* Returns the loan product data.
|
||||
@@ -24,5 +23,4 @@ export class OfficeDatatablesResolver implements Resolve<Object> {
|
||||
resolve(route: ActivatedRouteSnapshot): Observable<any> {
|
||||
return this.systemService.getEntityDatatables('m_office');
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -13,7 +13,6 @@ import { OrganizationService } from '../../organization.service';
|
||||
*/
|
||||
@Injectable()
|
||||
export class OfficeResolver implements Resolve<Object> {
|
||||
|
||||
/**
|
||||
* @param {OrganizationService} organizationService Organization service.
|
||||
*/
|
||||
@@ -27,5 +26,4 @@ export class OfficeResolver implements Resolve<Object> {
|
||||
const officeId = route.parent.paramMap.get('officeId');
|
||||
return this.organizationService.getOffice(officeId);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -13,7 +13,6 @@ import { OrganizationService } from '../../organization.service';
|
||||
*/
|
||||
@Injectable()
|
||||
export class OfficesResolver implements Resolve<Object> {
|
||||
|
||||
/**
|
||||
* @param {OrganizationService} organizationService Organization service.
|
||||
*/
|
||||
@@ -26,5 +25,4 @@ export class OfficesResolver implements Resolve<Object> {
|
||||
resolve(): Observable<any> {
|
||||
return this.organizationService.getOffices();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -8,9 +8,8 @@ describe('CreateOfficeComponent', () => {
|
||||
|
||||
beforeEach(async(() => {
|
||||
TestBed.configureTestingModule({
|
||||
declarations: [ CreateOfficeComponent ]
|
||||
})
|
||||
.compileComponents();
|
||||
declarations: [CreateOfficeComponent]
|
||||
}).compileComponents();
|
||||
}));
|
||||
|
||||
beforeEach(() => {
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
/** Angular Imports */
|
||||
import { Component, OnInit, TemplateRef, ElementRef , ViewChild,
|
||||
AfterViewInit } from '@angular/core';
|
||||
import { Component, OnInit, TemplateRef, ElementRef, ViewChild, AfterViewInit } from '@angular/core';
|
||||
import { UntypedFormGroup, UntypedFormBuilder, Validators } from '@angular/forms';
|
||||
import { Router, ActivatedRoute } from '@angular/router';
|
||||
|
||||
@@ -24,7 +23,6 @@ import { ContinueSetupDialogComponent } from '../../../configuration-wizard/cont
|
||||
styleUrls: ['./create-office.component.scss']
|
||||
})
|
||||
export class CreateOfficeComponent implements OnInit, AfterViewInit {
|
||||
|
||||
/** Office form. */
|
||||
officeForm: UntypedFormGroup;
|
||||
/** Office Data */
|
||||
@@ -51,15 +49,17 @@ export class CreateOfficeComponent implements OnInit, AfterViewInit {
|
||||
* @param {ConfigurationWizardService} configurationWizardService ConfigurationWizard Service.
|
||||
* @param {PopoverService} popoverService PopoverService.
|
||||
*/
|
||||
constructor(private formBuilder: UntypedFormBuilder,
|
||||
private organizationService: OrganizationService,
|
||||
private settingsService: SettingsService,
|
||||
private router: Router,
|
||||
private route: ActivatedRoute,
|
||||
private dateUtils: Dates,
|
||||
private popoverService: PopoverService,
|
||||
private configurationWizardService: ConfigurationWizardService,
|
||||
public dialog: MatDialog) {
|
||||
constructor(
|
||||
private formBuilder: UntypedFormBuilder,
|
||||
private organizationService: OrganizationService,
|
||||
private settingsService: SettingsService,
|
||||
private router: Router,
|
||||
private route: ActivatedRoute,
|
||||
private dateUtils: Dates,
|
||||
private popoverService: PopoverService,
|
||||
private configurationWizardService: ConfigurationWizardService,
|
||||
public dialog: MatDialog
|
||||
) {
|
||||
this.route.data.subscribe((data: { offices: any }) => {
|
||||
this.officeData = data.offices;
|
||||
});
|
||||
@@ -75,10 +75,19 @@ export class CreateOfficeComponent implements OnInit, AfterViewInit {
|
||||
*/
|
||||
createofficeForm() {
|
||||
this.officeForm = this.formBuilder.group({
|
||||
'name': ['', Validators.required],
|
||||
'parentId': ['', Validators.required],
|
||||
'openingDate': ['', Validators.required],
|
||||
'externalId': [''],
|
||||
name: [
|
||||
'',
|
||||
Validators.required
|
||||
],
|
||||
parentId: [
|
||||
'',
|
||||
Validators.required
|
||||
],
|
||||
openingDate: [
|
||||
'',
|
||||
Validators.required
|
||||
],
|
||||
externalId: ['']
|
||||
});
|
||||
}
|
||||
|
||||
@@ -99,7 +108,7 @@ export class CreateOfficeComponent implements OnInit, AfterViewInit {
|
||||
dateFormat,
|
||||
locale
|
||||
};
|
||||
this.organizationService.createOffice(data).subscribe(response => {
|
||||
this.organizationService.createOffice(data).subscribe((response) => {
|
||||
if (this.configurationWizardService.showOfficeForm === true) {
|
||||
this.configurationWizardService.showOfficeForm = false;
|
||||
this.openDialog();
|
||||
@@ -116,21 +125,21 @@ export class CreateOfficeComponent implements OnInit, AfterViewInit {
|
||||
const continueSetupDialogRef = this.dialog.open(ContinueSetupDialogComponent, {
|
||||
data: {
|
||||
stepName: 'office'
|
||||
},
|
||||
}
|
||||
});
|
||||
continueSetupDialogRef.afterClosed().subscribe((response: { step: number }) => {
|
||||
if (response.step === 1) {
|
||||
this.configurationWizardService.showOfficeForm = false;
|
||||
this.router.navigate(['../'], { relativeTo: this.route });
|
||||
} else if (response.step === 2) {
|
||||
this.configurationWizardService.showOfficeForm = true;
|
||||
this.router.routeReuseStrategy.shouldReuseRoute = () => false;
|
||||
this.router.onSameUrlNavigation = 'reload';
|
||||
this.router.navigate(['/organization/offices/create']);
|
||||
} else if (response.step === 3) {
|
||||
this.configurationWizardService.showOfficeForm = false;
|
||||
this.configurationWizardService.showAddEditCurrency = true;
|
||||
this.router.navigate(['/organization']);
|
||||
this.configurationWizardService.showOfficeForm = false;
|
||||
this.router.navigate(['../'], { relativeTo: this.route });
|
||||
} else if (response.step === 2) {
|
||||
this.configurationWizardService.showOfficeForm = true;
|
||||
this.router.routeReuseStrategy.shouldReuseRoute = () => false;
|
||||
this.router.onSameUrlNavigation = 'reload';
|
||||
this.router.navigate(['/organization/offices/create']);
|
||||
} else if (response.step === 3) {
|
||||
this.configurationWizardService.showOfficeForm = false;
|
||||
this.configurationWizardService.showAddEditCurrency = true;
|
||||
this.router.navigate(['/organization']);
|
||||
}
|
||||
});
|
||||
}
|
||||
@@ -142,7 +151,12 @@ export class CreateOfficeComponent implements OnInit, AfterViewInit {
|
||||
* @param position String.
|
||||
* @param backdrop Boolean.
|
||||
*/
|
||||
showPopover(template: TemplateRef<any>, target: HTMLElement | ElementRef<any>, position: string, backdrop: boolean): void {
|
||||
showPopover(
|
||||
template: TemplateRef<any>,
|
||||
target: HTMLElement | ElementRef<any>,
|
||||
position: string,
|
||||
backdrop: boolean
|
||||
): void {
|
||||
setTimeout(() => this.popoverService.open(template, target, position, backdrop, {}), 200);
|
||||
}
|
||||
|
||||
@@ -152,7 +166,7 @@ export class CreateOfficeComponent implements OnInit, AfterViewInit {
|
||||
ngAfterViewInit() {
|
||||
if (this.configurationWizardService.showOfficeForm === true) {
|
||||
setTimeout(() => {
|
||||
this.showPopover(this.templateCreateOfficeForm, this.createOfficeFormRef.nativeElement, 'right', true);
|
||||
this.showPopover(this.templateCreateOfficeForm, this.createOfficeFormRef.nativeElement, 'right', true);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@@ -8,9 +8,8 @@ describe('EditOfficeComponent', () => {
|
||||
|
||||
beforeEach(async(() => {
|
||||
TestBed.configureTestingModule({
|
||||
declarations: [ EditOfficeComponent ]
|
||||
})
|
||||
.compileComponents();
|
||||
declarations: [EditOfficeComponent]
|
||||
}).compileComponents();
|
||||
}));
|
||||
|
||||
beforeEach(() => {
|
||||
|
||||
@@ -17,7 +17,6 @@ import { SettingsService } from 'app/settings/settings.service';
|
||||
styleUrls: ['./edit-office.component.scss']
|
||||
})
|
||||
export class EditOfficeComponent implements OnInit {
|
||||
|
||||
/** Selected Data. */
|
||||
officeData: any;
|
||||
/** Office form. */
|
||||
@@ -27,26 +26,28 @@ export class EditOfficeComponent implements OnInit {
|
||||
/** Maximum Date allowed. */
|
||||
maxDate = new Date();
|
||||
|
||||
/**
|
||||
* Retrieves the charge data from `resolve`.
|
||||
* @param {ProductsService} organizationService Organization Service.
|
||||
* @param {SettingsService} settingsService Settings Service.
|
||||
* @param {FormBuilder} formBuilder Form Builder.
|
||||
* @param {ActivatedRoute} route Activated Route.
|
||||
* @param {Router} router Router for navigation.
|
||||
* @param {MatDialog} dialog Dialog reference.
|
||||
* @param {Dates} dateUtils Date Utils
|
||||
*/
|
||||
constructor(private organizationService: OrganizationService,
|
||||
private settingsService: SettingsService,
|
||||
private formBuilder: UntypedFormBuilder,
|
||||
private route: ActivatedRoute,
|
||||
private router: Router,
|
||||
private dateUtils: Dates) {
|
||||
this.route.data.subscribe((data: { officeTemplate: any }) => {
|
||||
this.officeData = data.officeTemplate;
|
||||
});
|
||||
}
|
||||
/**
|
||||
* Retrieves the charge data from `resolve`.
|
||||
* @param {ProductsService} organizationService Organization Service.
|
||||
* @param {SettingsService} settingsService Settings Service.
|
||||
* @param {FormBuilder} formBuilder Form Builder.
|
||||
* @param {ActivatedRoute} route Activated Route.
|
||||
* @param {Router} router Router for navigation.
|
||||
* @param {MatDialog} dialog Dialog reference.
|
||||
* @param {Dates} dateUtils Date Utils
|
||||
*/
|
||||
constructor(
|
||||
private organizationService: OrganizationService,
|
||||
private settingsService: SettingsService,
|
||||
private formBuilder: UntypedFormBuilder,
|
||||
private route: ActivatedRoute,
|
||||
private router: Router,
|
||||
private dateUtils: Dates
|
||||
) {
|
||||
this.route.data.subscribe((data: { officeTemplate: any }) => {
|
||||
this.officeData = data.officeTemplate;
|
||||
});
|
||||
}
|
||||
|
||||
ngOnInit() {
|
||||
this.maxDate = this.settingsService.businessDate;
|
||||
@@ -58,9 +59,15 @@ export class EditOfficeComponent implements OnInit {
|
||||
*/
|
||||
createOfficeForm() {
|
||||
this.officeForm = this.formBuilder.group({
|
||||
'name': [this.officeData.name, Validators.required],
|
||||
'openingDate': [this.officeData.openingDate && new Date(this.officeData.openingDate), Validators.required],
|
||||
'externalId': [this.officeData.externalId],
|
||||
name: [
|
||||
this.officeData.name,
|
||||
Validators.required
|
||||
],
|
||||
openingDate: [
|
||||
this.officeData.openingDate && new Date(this.officeData.openingDate),
|
||||
Validators.required
|
||||
],
|
||||
externalId: [this.officeData.externalId]
|
||||
});
|
||||
if (this.officeData.allowedParents.length) {
|
||||
this.officeForm.addControl('parentId', this.formBuilder.control(this.officeData.parentId, Validators.required));
|
||||
@@ -87,5 +94,4 @@ export class EditOfficeComponent implements OnInit {
|
||||
this.router.navigate(['../'], { relativeTo: this.route });
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,8 +1,7 @@
|
||||
/**
|
||||
* Office Node model.
|
||||
*/
|
||||
export class OfficeNode {
|
||||
|
||||
export class OfficeNode {
|
||||
/** Office Node children. */
|
||||
children: OfficeNode[];
|
||||
|
||||
@@ -14,13 +13,15 @@
|
||||
parentName: string;
|
||||
openingDate: string;
|
||||
|
||||
constructor(name: string,
|
||||
id: string = '',
|
||||
parentId: string = '',
|
||||
hierarchy: string = '',
|
||||
externalId: string = '',
|
||||
parentName: string = '',
|
||||
openingDate: string = '') {
|
||||
constructor(
|
||||
name: string,
|
||||
id: string = '',
|
||||
parentId: string = '',
|
||||
hierarchy: string = '',
|
||||
externalId: string = '',
|
||||
parentName: string = '',
|
||||
openingDate: string = ''
|
||||
) {
|
||||
this.name = name;
|
||||
this.id = id;
|
||||
this.parentId = parentId;
|
||||
@@ -30,5 +31,4 @@
|
||||
this.openingDate = openingDate;
|
||||
this.children = [];
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -14,7 +14,6 @@ import { OfficeNode } from './office-node.model';
|
||||
providedIn: 'root'
|
||||
})
|
||||
export class OfficeTreeService {
|
||||
|
||||
/** Office data. */
|
||||
officesData: any;
|
||||
/** Offices tree data behavior subject to represent offices tree nodes. */
|
||||
@@ -23,9 +22,11 @@ export class OfficeTreeService {
|
||||
/**
|
||||
* Gets the offices tree nodes.
|
||||
*/
|
||||
get treeData(): OfficeNode[] { return this.treeDataChange.value; }
|
||||
get treeData(): OfficeNode[] {
|
||||
return this.treeDataChange.value;
|
||||
}
|
||||
|
||||
constructor() { }
|
||||
constructor() {}
|
||||
|
||||
/**
|
||||
* Builds the offices tree and emits the value.
|
||||
@@ -60,8 +61,15 @@ export class OfficeTreeService {
|
||||
|
||||
// Add offices to any array where index for each is denoted by its id
|
||||
for (const office of officesData) {
|
||||
offices[office.id] =
|
||||
new OfficeNode(office.name, office.id, office.parentId, office.hierarchy, office.externalId, office.parentName, office.openingDate);
|
||||
offices[office.id] = new OfficeNode(
|
||||
office.name,
|
||||
office.id,
|
||||
office.parentId,
|
||||
office.hierarchy,
|
||||
office.externalId,
|
||||
office.parentName,
|
||||
office.openingDate
|
||||
);
|
||||
}
|
||||
|
||||
// Construct offices tree by adding all nodes belonging to headers (with parent id = 0),
|
||||
@@ -77,5 +85,4 @@ export class OfficeTreeService {
|
||||
}
|
||||
return officeTree;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -8,9 +8,8 @@ describe('OfficesComponent', () => {
|
||||
|
||||
beforeEach(async(() => {
|
||||
TestBed.configureTestingModule({
|
||||
declarations: [ OfficesComponent ]
|
||||
})
|
||||
.compileComponents();
|
||||
declarations: [OfficesComponent]
|
||||
}).compileComponents();
|
||||
}));
|
||||
|
||||
beforeEach(() => {
|
||||
|
||||
@@ -3,7 +3,7 @@ import { Component, OnInit, TemplateRef, ElementRef, ViewChild, AfterViewInit }
|
||||
import { MatPaginator } from '@angular/material/paginator';
|
||||
import { MatSort } from '@angular/material/sort';
|
||||
import { MatTableDataSource } from '@angular/material/table';
|
||||
import { ActivatedRoute, Router, } from '@angular/router';
|
||||
import { ActivatedRoute, Router } from '@angular/router';
|
||||
|
||||
/** rxjs Imports */
|
||||
import { of } from 'rxjs';
|
||||
@@ -33,7 +33,12 @@ export class OfficesComponent implements OnInit, AfterViewInit {
|
||||
/** Offices data. */
|
||||
officesData: any;
|
||||
/** Columns to be displayed in offices table. */
|
||||
displayedColumns: string[] = ['name', 'externalId', 'parentName', 'openingDate'];
|
||||
displayedColumns: string[] = [
|
||||
'name',
|
||||
'externalId',
|
||||
'parentName',
|
||||
'openingDate'
|
||||
];
|
||||
/** Data source for offices table. */
|
||||
dataSource: MatTableDataSource<any>;
|
||||
/** Nested tree control for offices tree. */
|
||||
@@ -52,7 +57,6 @@ export class OfficesComponent implements OnInit, AfterViewInit {
|
||||
/** Sorter for offices table. */
|
||||
@ViewChild(MatSort, { static: true }) sort: MatSort;
|
||||
|
||||
|
||||
/* Reference of tree view button */
|
||||
@ViewChild('buttonTreeView') buttonTreeView: ElementRef<any>;
|
||||
/* Template for popover on tree view button */
|
||||
@@ -70,13 +74,15 @@ export class OfficesComponent implements OnInit, AfterViewInit {
|
||||
* @param {ConfigurationWizardService} configurationWizardService ConfigurationWizard Service.
|
||||
* @param {PopoverService} popoverService PopoverService.
|
||||
*/
|
||||
constructor(private route: ActivatedRoute,
|
||||
constructor(
|
||||
private route: ActivatedRoute,
|
||||
private router: Router,
|
||||
private officeTreeService: OfficeTreeService,
|
||||
private treeControlService: TreeControlService,
|
||||
private configurationWizardService: ConfigurationWizardService,
|
||||
private popoverService: PopoverService) {
|
||||
this.route.data.subscribe(( data: { offices: any, officeDataTables: any }) => {
|
||||
private popoverService: PopoverService
|
||||
) {
|
||||
this.route.data.subscribe((data: { offices: any; officeDataTables: any }) => {
|
||||
this.officesData = data.offices;
|
||||
officeTreeService.initialize(this.officesData);
|
||||
this.dataTablesData = data.officeDataTables;
|
||||
@@ -96,7 +102,7 @@ export class OfficesComponent implements OnInit, AfterViewInit {
|
||||
/**
|
||||
* Sets the offices table.
|
||||
*/
|
||||
ngOnInit() {
|
||||
ngOnInit() {
|
||||
this.setOffices();
|
||||
this.officeTreeService.treeDataChange.subscribe((officeTreeData: OfficeNode[]) => {
|
||||
this.nestedTreeDataSource.data = officeTreeData;
|
||||
@@ -118,7 +124,7 @@ export class OfficesComponent implements OnInit, AfterViewInit {
|
||||
* View selected office.
|
||||
* @param {OfficeNode} office Office to be viewed.
|
||||
*/
|
||||
viewOfficeNode(office: OfficeNode) {
|
||||
viewOfficeNode(office: OfficeNode) {
|
||||
if (office.id) {
|
||||
this.office = office;
|
||||
} else {
|
||||
@@ -150,7 +156,12 @@ export class OfficesComponent implements OnInit, AfterViewInit {
|
||||
* @param position String.
|
||||
* @param backdrop Boolean.
|
||||
*/
|
||||
showPopover(template: TemplateRef<any>, target: HTMLElement | ElementRef<any>, position: string, backdrop: boolean): void {
|
||||
showPopover(
|
||||
template: TemplateRef<any>,
|
||||
target: HTMLElement | ElementRef<any>,
|
||||
position: string,
|
||||
backdrop: boolean
|
||||
): void {
|
||||
setTimeout(() => this.popoverService.open(template, target, position, backdrop, {}), 200);
|
||||
}
|
||||
|
||||
@@ -160,12 +171,12 @@ export class OfficesComponent implements OnInit, AfterViewInit {
|
||||
ngAfterViewInit() {
|
||||
if (this.configurationWizardService.showOfficeList === true) {
|
||||
setTimeout(() => {
|
||||
this.showPopover(this.templateButtonTreeView, this.buttonTreeView.nativeElement, 'bottom', true);
|
||||
this.showPopover(this.templateButtonTreeView, this.buttonTreeView.nativeElement, 'bottom', true);
|
||||
});
|
||||
}
|
||||
if (this.configurationWizardService.showOfficeTable === true) {
|
||||
setTimeout(() => {
|
||||
this.showPopover(this.templateTableOffices, this.tableOffices.nativeElement, 'top', true);
|
||||
this.showPopover(this.templateTableOffices, this.tableOffices.nativeElement, 'top', true);
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -196,5 +207,4 @@ export class OfficesComponent implements OnInit, AfterViewInit {
|
||||
toggleExpandCollapse() {
|
||||
this.isTreeExpanded = this.treeControlService.toggleExpandCollapse(this.nestedTreeControl, this.isTreeExpanded);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
+2
-3
@@ -8,9 +8,8 @@ describe('DatatableTabsComponent', () => {
|
||||
|
||||
beforeEach(async(() => {
|
||||
TestBed.configureTestingModule({
|
||||
declarations: [ DatatableTabsComponent ]
|
||||
})
|
||||
.compileComponents();
|
||||
declarations: [DatatableTabsComponent]
|
||||
}).compileComponents();
|
||||
}));
|
||||
|
||||
beforeEach(() => {
|
||||
|
||||
@@ -29,5 +29,4 @@ export class DatatableTabsComponent {
|
||||
this.multiRowDatatableFlag = this.entityDatatable.columnHeaders[0].columnName === 'id' ? true : false;
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -8,9 +8,8 @@ describe('GeneralTabComponent', () => {
|
||||
|
||||
beforeEach(async(() => {
|
||||
TestBed.configureTestingModule({
|
||||
declarations: [ GeneralTabComponent ]
|
||||
})
|
||||
.compileComponents();
|
||||
declarations: [GeneralTabComponent]
|
||||
}).compileComponents();
|
||||
}));
|
||||
|
||||
beforeEach(() => {
|
||||
|
||||
@@ -11,7 +11,6 @@ import { ActivatedRoute } from '@angular/router';
|
||||
styleUrls: ['./general-tab.component.scss']
|
||||
})
|
||||
export class GeneralTabComponent {
|
||||
|
||||
/** Office data */
|
||||
officeData: any;
|
||||
|
||||
@@ -24,5 +23,4 @@ export class GeneralTabComponent {
|
||||
this.officeData = data.office;
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -8,9 +8,8 @@ describe('ViewOfficeComponent', () => {
|
||||
|
||||
beforeEach(async(() => {
|
||||
TestBed.configureTestingModule({
|
||||
declarations: [ ViewOfficeComponent ]
|
||||
})
|
||||
.compileComponents();
|
||||
declarations: [ViewOfficeComponent]
|
||||
}).compileComponents();
|
||||
}));
|
||||
|
||||
beforeEach(() => {
|
||||
|
||||
@@ -11,7 +11,6 @@ import { ActivatedRoute } from '@angular/router';
|
||||
styleUrls: ['./view-office.component.scss']
|
||||
})
|
||||
export class ViewOfficeComponent {
|
||||
|
||||
/** Office datatables data */
|
||||
officeDatatables: any;
|
||||
|
||||
@@ -24,5 +23,4 @@ export class ViewOfficeComponent {
|
||||
this.officeDatatables = data.officeDatatables;
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user