build: Use prettier for typescript

Stop ignoring .ts files in prettier and fix existing issues.
This commit is contained in:
Ralph Hopman
2025-01-15 11:59:30 +00:00
committed by Adam Saghy
parent 9d6cf1514a
commit cac1d11ad7
1812 changed files with 22516 additions and 16862 deletions
@@ -13,11 +13,10 @@ import { GroupsService } from '../groups.service';
*/
@Injectable()
export class GLIMAccountsResolver implements Resolve<Object> {
/**
* @param {GroupsService} groupsService Groups service.
*/
constructor(private groupsService: GroupsService) { }
constructor(private groupsService: GroupsService) {}
/**
* Returns the Group's GLIM Loans Acccounts data.
@@ -28,5 +27,4 @@ export class GLIMAccountsResolver implements Resolve<Object> {
const groupId = route.parent.paramMap.get('groupId');
return this.groupsService.getGLIMAccountsData(groupId);
}
}
@@ -13,11 +13,10 @@ import { GroupsService } from '../groups.service';
*/
@Injectable()
export class GroupAccountsResolver implements Resolve<Object> {
/**
* @param {GroupsService} GroupsService Groups service.
*/
constructor(private groupsService: GroupsService) { }
constructor(private groupsService: GroupsService) {}
/**
* Returns the Group's Acccounts data.
@@ -28,5 +27,4 @@ export class GroupAccountsResolver implements Resolve<Object> {
const groupId = route.parent.paramMap.get('groupId');
return this.groupsService.getGroupAccountsData(groupId);
}
}
@@ -13,11 +13,10 @@ import { GroupsService } from '../groups.service';
*/
@Injectable()
export class GroupActionsResolver implements Resolve<Object> {
/**
* @param {GroupsService} groupsService Groups service.
*/
constructor(private groupsService: GroupsService) { }
constructor(private groupsService: GroupsService) {}
/**
* Returns the group actions data.
@@ -46,5 +45,4 @@ export class GroupActionsResolver implements Resolve<Object> {
return undefined;
}
}
}
@@ -13,11 +13,10 @@ import { GroupsService } from '../groups.service';
*/
@Injectable()
export class GroupDataAndTemplateResolver implements Resolve<Object> {
/**
* @param {GroupsService} GroupsService Groups service.
*/
constructor(private groupsService: GroupsService) { }
constructor(private groupsService: GroupsService) {}
/**
* Returns the Groups data and template.
@@ -28,5 +27,4 @@ export class GroupDataAndTemplateResolver implements Resolve<Object> {
const groupId = route.paramMap.get('groupId');
return this.groupsService.getGroupData(groupId, 'true');
}
}
@@ -13,11 +13,10 @@ import { GroupsService } from '../groups.service';
*/
@Injectable()
export class GroupDatatableResolver implements Resolve<Object> {
/**
* @param {GroupsService} GroupsService Groups service.
*/
constructor(private groupsService: GroupsService) { }
constructor(private groupsService: GroupsService) {}
/**
* Returns the Group's Datatable data.
@@ -28,5 +27,4 @@ export class GroupDatatableResolver implements Resolve<Object> {
const datatableName = route.paramMap.get('datatableName');
return this.groupsService.getGroupDatatable(groupId, datatableName);
}
}
@@ -13,11 +13,10 @@ import { GroupsService } from '../groups.service';
*/
@Injectable()
export class GroupDatatablesResolver implements Resolve<Object> {
/**
* @param {GroupsService} GroupsService Groups service.
*/
constructor(private groupsService: GroupsService) { }
constructor(private groupsService: GroupsService) {}
/**
* Returns the Group's Datatables data.
@@ -26,5 +25,4 @@ export class GroupDatatablesResolver implements Resolve<Object> {
resolve(): Observable<any> {
return this.groupsService.getGroupDatatables();
}
}
@@ -13,11 +13,10 @@ import { GroupsService } from '../groups.service';
*/
@Injectable()
export class GroupNotesResolver implements Resolve<Object> {
/**
* @param {GroupsService} GroupsService Groups service.
*/
constructor(private groupsService: GroupsService) { }
constructor(private groupsService: GroupsService) {}
/**
* Returns the Group's Notes data.
@@ -28,5 +27,4 @@ export class GroupNotesResolver implements Resolve<Object> {
const groupId = route.parent.paramMap.get('groupId');
return this.groupsService.getGroupNotes(groupId);
}
}
@@ -13,11 +13,10 @@ import { GroupsService } from '../groups.service';
*/
@Injectable()
export class GroupSummaryResolver implements Resolve<Object> {
/**
* @param {GroupsService} GroupsService Groups service.
*/
constructor(private groupsService: GroupsService) { }
constructor(private groupsService: GroupsService) {}
/**
* Returns the Group Summary data.
@@ -28,5 +27,4 @@ export class GroupSummaryResolver implements Resolve<Object> {
const groupId = route.parent.paramMap.get('groupId');
return this.groupsService.getGroupSummary(groupId);
}
}
@@ -13,11 +13,10 @@ import { GroupsService } from '../groups.service';
*/
@Injectable()
export class GroupViewResolver implements Resolve<Object> {
/**
* @param {GroupsService} GroupsService Groups service.
*/
constructor(private groupsService: GroupsService) { }
constructor(private groupsService: GroupsService) {}
/**
* Returns the Groups data.
@@ -28,5 +27,4 @@ export class GroupViewResolver implements Resolve<Object> {
const groupId = route.paramMap.get('groupId');
return this.groupsService.getGroupData(groupId);
}
}
@@ -13,11 +13,10 @@ import { GroupsService } from '../groups.service';
*/
@Injectable()
export class GSIMAccountsResolver implements Resolve<Object> {
/**
* @param {GroupsService} groupsService Groups service.
*/
constructor(private groupsService: GroupsService) { }
constructor(private groupsService: GroupsService) {}
/**
* Returns the Group's GSIM Acccounts data.
@@ -28,5 +27,4 @@ export class GSIMAccountsResolver implements Resolve<Object> {
const groupId = route.parent.paramMap.get('groupId');
return this.groupsService.getGSIMAccountsData(groupId);
}
}
@@ -8,9 +8,8 @@ describe('CreateGroupComponent', () => {
beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [ CreateGroupComponent ]
})
.compileComponents();
declarations: [CreateGroupComponent]
}).compileComponents();
}));
beforeEach(() => {
@@ -18,7 +18,6 @@ import { Dates } from 'app/core/utils/dates';
styleUrls: ['./create-group.component.scss']
})
export class CreateGroupComponent implements OnInit, AfterViewInit {
/** Minimum date allowed. */
minDate = new Date(2000, 0, 1);
/** Maximum date allowed. */
@@ -46,14 +45,16 @@ export class CreateGroupComponent implements OnInit, AfterViewInit {
* @param {Dates} dateUtils Date Utils to format date.
* @param {SettingsService} settingsService SettingsService
*/
constructor(private formBuilder: UntypedFormBuilder,
private route: ActivatedRoute,
private router: Router,
private clientsService: ClientsService,
private groupService: GroupsService,
private dateUtils: Dates,
private settingsService: SettingsService) {
this.route.data.subscribe( (data: {offices: any} ) => {
constructor(
private formBuilder: UntypedFormBuilder,
private route: ActivatedRoute,
private router: Router,
private clientsService: ClientsService,
private groupService: GroupsService,
private dateUtils: Dates,
private settingsService: SettingsService
) {
this.route.data.subscribe((data: { offices: any }) => {
this.officeData = data.offices;
});
}
@@ -70,12 +71,13 @@ export class CreateGroupComponent implements OnInit, AfterViewInit {
* Subscribes to Clients search filter:
*/
ngAfterViewInit() {
this.clientChoice.valueChanges.subscribe( (value: string) => {
this.clientChoice.valueChanges.subscribe((value: string) => {
if (value.length >= 2) {
this.clientsService.getFilteredClients('displayName', 'ASC', true, value, this.groupForm.get('officeId').value)
.subscribe( (data: any) => {
this.clientsData = data.pageItems;
});
this.clientsService
.getFilteredClients('displayName', 'ASC', true, value, this.groupForm.get('officeId').value)
.subscribe((data: any) => {
this.clientsData = data.pageItems;
});
}
});
}
@@ -85,12 +87,23 @@ export class CreateGroupComponent implements OnInit, AfterViewInit {
*/
createGroupForm() {
this.groupForm = this.formBuilder.group({
'name': ['', [Validators.required, Validators.pattern('(^[A-z]).*')]],
'officeId': ['', Validators.required],
'submittedOnDate': [this.settingsService.businessDate, Validators.required],
'staffId': [''],
'externalId': [''],
'active': [false],
name: [
'',
[
Validators.required,
Validators.pattern('(^[A-z]).*')]
],
officeId: [
'',
Validators.required
],
submittedOnDate: [
this.settingsService.businessDate,
Validators.required
],
staffId: [''],
externalId: [''],
active: [false]
});
this.buildDependencies();
}
@@ -101,7 +114,7 @@ export class CreateGroupComponent implements OnInit, AfterViewInit {
*/
buildDependencies() {
this.groupForm.get('officeId').valueChanges.subscribe((option: any) => {
this.groupService.getStaff(option).subscribe(data => {
this.groupService.getStaff(option).subscribe((data) => {
this.staffData = data['staffOptions'];
if (this.staffData === undefined) {
this.groupForm.controls['staffId'].disable();
@@ -169,8 +182,11 @@ export class CreateGroupComponent implements OnInit, AfterViewInit {
data.clientMembers = [];
this.clientMembers.forEach((client: any) => data.clientMembers.push(client.id));
this.groupService.createGroup(data).subscribe((response: any) => {
this.router.navigate(['../groups', response.resourceId, 'general']);
this.router.navigate([
'../groups',
response.resourceId,
'general'
]);
});
}
}
@@ -8,9 +8,8 @@ describe('EditGroupComponent', () => {
beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [ EditGroupComponent ]
})
.compileComponents();
declarations: [EditGroupComponent]
}).compileComponents();
}));
beforeEach(() => {
@@ -17,7 +17,6 @@ import { Dates } from 'app/core/utils/dates';
styleUrls: ['./edit-group.component.scss']
})
export class EditGroupComponent implements OnInit {
/** Minimum date allowed. */
minDate = new Date(2000, 0, 1);
/** Maximum date allowed. */
@@ -40,16 +39,19 @@ export class EditGroupComponent implements OnInit {
* @param {Dates} dateUtils Date Utils to format date.
* @param {SettingsService} settingsService SettingsService
*/
constructor(private formBuilder: UntypedFormBuilder,
private route: ActivatedRoute,
private router: Router,
private groupService: GroupsService,
private dateUtils: Dates,
private settingsService: SettingsService) {
this.route.data.subscribe( (data: { groupAndTemplateData: any, groupViewData: any } ) => {
constructor(
private formBuilder: UntypedFormBuilder,
private route: ActivatedRoute,
private router: Router,
private groupService: GroupsService,
private dateUtils: Dates,
private settingsService: SettingsService
) {
this.route.data.subscribe((data: { groupAndTemplateData: any; groupViewData: any }) => {
this.staffData = data.groupAndTemplateData.staffOptions;
this.groupData = data.groupAndTemplateData;
this.submittedOnDate = data.groupViewData.timeline.submittedOnDate && new Date(data.groupViewData.timeline.submittedOnDate);
this.submittedOnDate =
data.groupViewData.timeline.submittedOnDate && new Date(data.groupViewData.timeline.submittedOnDate);
});
}
@@ -60,10 +62,10 @@ export class EditGroupComponent implements OnInit {
this.maxDate = this.settingsService.businessDate;
this.createEditGroupForm();
this.editGroupForm.patchValue({
'name': this.groupData.name,
'submittedOnDate': this.submittedOnDate,
'staffId': this.groupData.staffId,
'externalId': this.groupData.externalId
name: this.groupData.name,
submittedOnDate: this.submittedOnDate,
staffId: this.groupData.staffId,
externalId: this.groupData.externalId
});
}
@@ -72,10 +74,18 @@ export class EditGroupComponent implements OnInit {
*/
createEditGroupForm() {
this.editGroupForm = this.formBuilder.group({
'name': ['', [Validators.required, Validators.pattern('(^[A-z]).*')]],
'submittedOnDate': ['', Validators.required],
'staffId': [''],
'externalId': ['']
name: [
'',
[
Validators.required,
Validators.pattern('(^[A-z]).*')]
],
submittedOnDate: [
'',
Validators.required
],
staffId: [''],
externalId: ['']
});
this.buildDependencies();
}
@@ -86,7 +96,9 @@ export class EditGroupComponent implements OnInit {
buildDependencies() {
if (this.groupData.active) {
this.editGroupForm.addControl('activationDate', new UntypedFormControl('', Validators.required));
this.editGroupForm.get('activationDate').patchValue(this.groupData.activationDate && new Date(this.groupData.activationDate));
this.editGroupForm
.get('activationDate')
.patchValue(this.groupData.activationDate && new Date(this.groupData.activationDate));
} else {
this.editGroupForm.removeControl('activationDate');
}
@@ -117,5 +129,4 @@ export class EditGroupComponent implements OnInit {
this.router.navigate(['../'], { relativeTo: this.route });
});
}
}
+20 -16
View File
@@ -39,7 +39,7 @@ const routes: Routes = [
children: [
{
path: '',
component: GroupsComponent,
component: GroupsComponent
},
{
path: 'create',
@@ -122,7 +122,8 @@ const routes: Routes = [
children: [
{
path: '',
redirectTo: '../committee', pathMatch: 'prefix'
redirectTo: '../committee',
pathMatch: 'prefix'
},
{
path: 'add-role',
@@ -131,7 +132,7 @@ const routes: Routes = [
resolve: {
groupAndTemplateData: GroupDataAndTemplateResolver
}
},
}
]
},
{
@@ -144,17 +145,18 @@ const routes: Routes = [
},
{
path: 'loans-accounts',
loadChildren: () => import('../loans/loans.module').then(m => m.LoansModule)
loadChildren: () => import('../loans/loans.module').then((m) => m.LoansModule)
},
{
path: 'savings-accounts',
loadChildren: () => import('../savings/savings.module').then(m => m.SavingsModule)
loadChildren: () => import('../savings/savings.module').then((m) => m.SavingsModule)
}
]
}
]
}
])
];
/**
@@ -165,15 +167,17 @@ const routes: Routes = [
@NgModule({
imports: [RouterModule.forChild(routes)],
exports: [RouterModule],
providers: [GroupViewResolver,
GroupAccountsResolver,
GroupSummaryResolver,
GroupNotesResolver,
GroupDatatablesResolver,
GroupDatatableResolver,
GroupDataAndTemplateResolver,
GroupActionsResolver,
GSIMAccountsResolver,
GLIMAccountsResolver]
providers: [
GroupViewResolver,
GroupAccountsResolver,
GroupSummaryResolver,
GroupNotesResolver,
GroupDatatablesResolver,
GroupDatatableResolver,
GroupDataAndTemplateResolver,
GroupActionsResolver,
GSIMAccountsResolver,
GLIMAccountsResolver
]
})
export class GroupsRoutingModule { }
export class GroupsRoutingModule {}
@@ -8,9 +8,8 @@ describe('AddRoleComponent', () => {
beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [ AddRoleComponent ]
})
.compileComponents();
declarations: [AddRoleComponent]
}).compileComponents();
}));
beforeEach(() => {
@@ -15,7 +15,6 @@ import { GroupsService } from '../../groups.service';
styleUrls: ['./add-role.component.scss']
})
export class AddRoleComponent implements OnInit {
/** Groups Add Role Form */
groupsAddRoleForm: UntypedFormGroup;
/** Client Member Data */
@@ -31,10 +30,12 @@ export class AddRoleComponent implements OnInit {
* @param {ActivatedRoute} route Activated Route
* @param {Router} router Router
*/
constructor(private formBuilder: UntypedFormBuilder,
private groupsService: GroupsService,
private route: ActivatedRoute,
private router: Router) {
constructor(
private formBuilder: UntypedFormBuilder,
private groupsService: GroupsService,
private route: ActivatedRoute,
private router: Router
) {
this.route.data.subscribe((data: { groupAndTemplateData: any }) => {
this.groupAndTemplateData = data.groupAndTemplateData;
});
@@ -51,8 +52,14 @@ export class AddRoleComponent implements OnInit {
*/
createGroupsAddRoleForm() {
this.groupsAddRoleForm = this.formBuilder.group({
'clientId': ['', Validators.required],
'role': ['', Validators.required]
clientId: [
'',
Validators.required
],
role: [
'',
Validators.required
]
});
}
@@ -60,9 +67,10 @@ export class AddRoleComponent implements OnInit {
* Submits the form and assigns the group role.
*/
submit() {
this.groupsService.executeGroupCommand(this.groupAndTemplateData.id, 'assignRole', this.groupsAddRoleForm.value).subscribe(() => {
this.router.navigate(['../'], { relativeTo: this.route });
});
this.groupsService
.executeGroupCommand(this.groupAndTemplateData.id, 'assignRole', this.groupsAddRoleForm.value)
.subscribe(() => {
this.router.navigate(['../'], { relativeTo: this.route });
});
}
}
@@ -8,9 +8,8 @@ describe('CommitteeTabComponent', () => {
beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [ CommitteeTabComponent ]
})
.compileComponents();
declarations: [CommitteeTabComponent]
}).compileComponents();
}));
beforeEach(() => {
@@ -19,7 +19,6 @@ import { GroupsService } from 'app/groups/groups.service';
styleUrls: ['./committee-tab.component.scss']
})
export class CommitteeTabComponent {
/** Group Status */
groupStatus: any;
/** Group Roles Data */
@@ -27,7 +26,12 @@ export class CommitteeTabComponent {
/** Groups View Data */
groupViewData: any;
/** Columns to be Displayed for client members table */
groupRolesColumns: string[] = ['Name', 'Role', 'Client Id', 'Actions'];
groupRolesColumns: string[] = [
'Name',
'Role',
'Client Id',
'Actions'
];
/** Roles Table */
@ViewChild('rolesTable') rolesTableRef: MatTable<Element>;
@@ -38,9 +42,11 @@ export class CommitteeTabComponent {
* @param {GroupsService} groupsService Groups Service
* @param {MatDialog} dialog Mat Dialog
*/
constructor(private route: ActivatedRoute,
private groupsService: GroupsService,
public dialog: MatDialog) {
constructor(
private route: ActivatedRoute,
private groupsService: GroupsService,
public dialog: MatDialog
) {
this.route.parent.data.subscribe((data: { groupViewData: any }) => {
this.groupViewData = data.groupViewData;
this.groupRolesData = this.groupViewData.groupRoles;
@@ -65,5 +71,4 @@ export class CommitteeTabComponent {
}
});
}
}
@@ -8,9 +8,8 @@ describe('UnassignRoleDialogComponent', () => {
beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [ UnassignRoleDialogComponent ]
})
.compileComponents();
declarations: [UnassignRoleDialogComponent]
}).compileComponents();
}));
beforeEach(() => {
@@ -11,12 +11,12 @@ import { MatDialogRef, MAT_DIALOG_DATA } from '@angular/material/dialog';
styleUrls: ['./unassign-role-dialog.component.scss']
})
export class UnassignRoleDialogComponent {
/**
* @param {MatDialogRef} dialogRef Component reference to dialog.
* @param {any} data.
*/
constructor(public dialogRef: MatDialogRef<UnassignRoleDialogComponent>,
@Inject(MAT_DIALOG_DATA) public data: any) { }
constructor(
public dialogRef: MatDialogRef<UnassignRoleDialogComponent>,
@Inject(MAT_DIALOG_DATA) public data: any
) {}
}
@@ -8,9 +8,8 @@ describe('UnassignStaffDialogComponent', () => {
beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [ UnassignStaffDialogComponent ]
})
.compileComponents();
declarations: [UnassignStaffDialogComponent]
}).compileComponents();
}));
beforeEach(() => {
@@ -11,10 +11,8 @@ import { MatDialogRef, MAT_DIALOG_DATA } from '@angular/material/dialog';
styleUrls: ['./unassign-staff-dialog.component.scss']
})
export class UnassignStaffDialogComponent {
/**
* @param {MatDialogRef} dialogRef Component reference to dialog.
*/
constructor(public dialogRef: MatDialogRef<UnassignStaffDialogComponent>) { }
constructor(public dialogRef: MatDialogRef<UnassignStaffDialogComponent>) {}
}
@@ -8,9 +8,8 @@ describe('DatatableTabsComponent', () => {
beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [ DatatableTabsComponent ]
})
.compileComponents();
declarations: [DatatableTabsComponent]
}).compileComponents();
}));
beforeEach(() => {
@@ -11,7 +11,6 @@ import { ActivatedRoute } from '@angular/router';
styleUrls: ['./datatable-tabs.component.scss']
})
export class DatatableTabsComponent {
entityId: string;
/** Group Datatable */
entityDatatable: any;
@@ -30,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 {
/** Group's all accounts data */
groupAccountData: any;
/** Group's loan accounts data */
@@ -27,19 +26,62 @@ export class GeneralTabComponent {
/** Group's Client Members */
groupClientMembers: any;
/** Columns to be Displayed for client members table */
clientMemberColumns: string[] = ['Name', 'Account No', 'Office', 'JLG Loan Application'];
clientMemberColumns: string[] = [
'Name',
'Account No',
'Office',
'JLG Loan Application'
];
/** Columns to be displayed for open loan accounts table */
openLoansColumns: string[] = ['Account No', 'Loan Account', 'Original Loan', 'Loan Balance', 'Amount Paid', 'Type', 'Actions'];
openLoansColumns: string[] = [
'Account No',
'Loan Account',
'Original Loan',
'Loan Balance',
'Amount Paid',
'Type',
'Actions'
];
/** Columns to be displayed for closed loan accounts table */
closedLoansColumns: string[] = ['Account No', 'Loan Account', 'Original Loan', 'Loan Balance', 'Amount Paid', 'Type', 'Closed Date'];
closedLoansColumns: string[] = [
'Account No',
'Loan Account',
'Original Loan',
'Loan Balance',
'Amount Paid',
'Type',
'Closed Date'
];
/** Columns to be displayed for open savings accounts table */
openSavingsColumns: string[] = ['Account No', 'Saving Account', 'Last Active', 'Balance', 'Actions'];
openSavingsColumns: string[] = [
'Account No',
'Saving Account',
'Last Active',
'Balance',
'Actions'
];
/** Columns to be displayed for closed accounts table */
closedSavingsColumns: string[] = ['Account No', 'Saving Account', 'Closed Date'];
closedSavingsColumns: string[] = [
'Account No',
'Saving Account',
'Closed Date'
];
/** Columns to be displayed for GSIM Accounts Table */
gsimAccountsColumns: string[] = ['GSIM Id', 'Account Number', 'Product', 'Balance', 'Status'];
gsimAccountsColumns: string[] = [
'GSIM Id',
'Account Number',
'Product',
'Balance',
'Status'
];
/** Columns to be displayed for GLIM Accounts Table */
glimAccountsColumns: string[] = ['GLIM Id', 'Account Number', 'Product', 'Original Loan', 'Status'];
glimAccountsColumns: string[] = [
'GLIM Id',
'Account Number',
'Product',
'Original Loan',
'Status'
];
/** Boolean for toggling loan accounts table */
showClosedLoanAccounts = false;
/** Boolean for toggling savings accounts table */
@@ -50,14 +92,16 @@ export class GeneralTabComponent {
* @param {ActivatedRoute} route Activated Route.
*/
constructor(private route: ActivatedRoute) {
this.route.data.subscribe((data: { groupAccountsData: any, groupClientMembers: any, groupSummary: any, glimData: any, gsimData: any }) => {
this.glimAccounts = data.glimData;
this.gsimAccounts = data.gsimData;
this.groupAccountData = data.groupAccountsData;
this.savingAccounts = data.groupAccountsData.savingsAccounts;
this.loanAccounts = data.groupAccountsData.loanAccounts;
this.groupSummary = data.groupSummary[0];
});
this.route.data.subscribe(
(data: { groupAccountsData: any; groupClientMembers: any; groupSummary: any; glimData: any; gsimData: any }) => {
this.glimAccounts = data.glimData;
this.gsimAccounts = data.gsimData;
this.groupAccountData = data.groupAccountsData;
this.savingAccounts = data.groupAccountsData.savingsAccounts;
this.loanAccounts = data.groupAccountsData.loanAccounts;
this.groupSummary = data.groupSummary[0];
}
);
this.route.parent.data.subscribe((data: { groupViewData: any }) => {
this.groupClientMembers = data.groupViewData.clientMembers;
});
@@ -84,5 +128,4 @@ export class GeneralTabComponent {
routeEdit($event: MouseEvent) {
$event.stopPropagation();
}
}
@@ -8,9 +8,8 @@ describe('ActivateGroupComponent', () => {
beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [ ActivateGroupComponent ]
})
.compileComponents();
declarations: [ActivateGroupComponent]
}).compileComponents();
}));
beforeEach(() => {
@@ -17,7 +17,6 @@ import { SettingsService } from 'app/settings/settings.service';
styleUrls: ['./activate-group.component.scss']
})
export class ActivateGroupComponent implements OnInit {
/** Minimum date allowed. */
minDate = new Date(2000, 0, 1);
/** Maximum date allowed. */
@@ -35,12 +34,14 @@ export class ActivateGroupComponent implements OnInit {
* @param {Router} router Router
* @param {SettingsService} settingsService SettingsService
*/
constructor(private formBuilder: UntypedFormBuilder,
private groupsService: GroupsService,
private dateUtils: Dates,
private route: ActivatedRoute,
private router: Router,
private settingsService: SettingsService) {
constructor(
private formBuilder: UntypedFormBuilder,
private groupsService: GroupsService,
private dateUtils: Dates,
private route: ActivatedRoute,
private router: Router,
private settingsService: SettingsService
) {
this.groupId = this.route.parent.snapshot.params['groupId'];
}
@@ -54,7 +55,10 @@ export class ActivateGroupComponent implements OnInit {
*/
createActivateGroupForm() {
this.activateGroupForm = this.formBuilder.group({
'activationDate': ['', Validators.required]
activationDate: [
'',
Validators.required
]
});
}
@@ -79,5 +83,4 @@ export class ActivateGroupComponent implements OnInit {
this.router.navigate(['../../'], { relativeTo: this.route });
});
}
}
@@ -8,9 +8,8 @@ describe('AttachGroupMeetingComponent', () => {
beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [ AttachGroupMeetingComponent ]
})
.compileComponents();
declarations: [AttachGroupMeetingComponent]
}).compileComponents();
}));
beforeEach(() => {
@@ -17,7 +17,6 @@ import { SettingsService } from 'app/settings/settings.service';
styleUrls: ['./attach-group-meeting.component.scss']
})
export class AttachGroupMeetingComponent implements OnInit {
/** Minimum date allowed. */
minDate = new Date(2000, 0, 1);
/** Maximum date allowed. */
@@ -44,12 +43,14 @@ export class AttachGroupMeetingComponent implements OnInit {
* @param {Router} router Router
* @param {SettingsService} settingsService SettingsService
*/
constructor(private formBuilder: UntypedFormBuilder,
private groupsService: GroupsService,
private dateUtils: Dates,
private route: ActivatedRoute,
private router: Router,
private settingsService: SettingsService) {
constructor(
private formBuilder: UntypedFormBuilder,
private groupsService: GroupsService,
private dateUtils: Dates,
private route: ActivatedRoute,
private router: Router,
private settingsService: SettingsService
) {
this.route.data.subscribe((data: { groupActionData: any }) => {
this.calendarTemplate = data.groupActionData;
this.frequencyOptions = this.calendarTemplate.frequencyOptions;
@@ -69,8 +70,11 @@ export class AttachGroupMeetingComponent implements OnInit {
*/
createGroupMeetingForm() {
this.groupMeetingForm = this.formBuilder.group({
'startDate': ['', Validators.required],
'repeating': [false]
startDate: [
'',
Validators.required
],
repeating: [false]
});
}
@@ -86,23 +90,49 @@ export class AttachGroupMeetingComponent implements OnInit {
this.groupMeetingForm.removeControl('repeatsOnDay');
switch (frequency) {
case 1: // Daily
this.repetitionIntervals = ['1', '2', '3'];
break;
this.repetitionIntervals = [
'1',
'2',
'3'
];
break;
case 2: // Weekly
this.repetitionIntervals = ['1', '2', '3'];
this.repetitionIntervals = [
'1',
'2',
'3'
];
this.groupMeetingForm.addControl('repeatsOnDay', new UntypedFormControl('', Validators.required));
break;
break;
case 3: // Monthly
this.repetitionIntervals = ['1', '2', '3', '4', '5', '6', '7', '8', '9', '10', '11'];
break;
this.repetitionIntervals = [
'1',
'2',
'3',
'4',
'5',
'6',
'7',
'8',
'9',
'10',
'11'
];
break;
case 4: // Yearly
this.repetitionIntervals = ['1', '2', '3', '4', '5'];
break;
this.repetitionIntervals = [
'1',
'2',
'3',
'4',
'5'
];
break;
}
});
this.groupMeetingForm.patchValue({
'frequency': 1,
'interval': '1'
frequency: 1,
interval: '1'
});
} else {
this.groupMeetingForm.removeControl('frequency');
@@ -119,7 +149,7 @@ export class AttachGroupMeetingComponent implements OnInit {
const locale = this.settingsService.language.code;
const dateFormat = this.settingsService.dateFormat;
const title = `groups_${this.groupId}_CollectionMeeting`;
const typeId = groupMeetingFormData.repeating ? '1' : '4' ;
const typeId = groupMeetingFormData.repeating ? '1' : '4';
const prevStartDate: Date = this.groupMeetingForm.value.startDate;
if (groupMeetingFormData.startDate instanceof Date) {
groupMeetingFormData.startDate = this.dateUtils.formatDate(prevStartDate, dateFormat);
@@ -135,5 +165,4 @@ export class AttachGroupMeetingComponent implements OnInit {
this.router.navigate(['../../'], { relativeTo: this.route });
});
}
}
@@ -8,9 +8,8 @@ describe('CloseGroupComponent', () => {
beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [ CloseGroupComponent ]
})
.compileComponents();
declarations: [CloseGroupComponent]
}).compileComponents();
}));
beforeEach(() => {
@@ -17,7 +17,6 @@ import { SettingsService } from 'app/settings/settings.service';
styleUrls: ['./close-group.component.scss']
})
export class CloseGroupComponent implements OnInit {
/** Minimum date allowed. */
minDate = new Date(2000, 0, 1);
/** Maximum date allowed. */
@@ -37,12 +36,14 @@ export class CloseGroupComponent implements OnInit {
* @param {Router} router Router
* @param {SettingsService} settingsService SettingsService
*/
constructor(private formBuilder: UntypedFormBuilder,
private groupsService: GroupsService,
private dateUtils: Dates,
private route: ActivatedRoute,
private router: Router,
private settingsService: SettingsService) {
constructor(
private formBuilder: UntypedFormBuilder,
private groupsService: GroupsService,
private dateUtils: Dates,
private route: ActivatedRoute,
private router: Router,
private settingsService: SettingsService
) {
this.route.data.subscribe((data: { groupActionData: any }) => {
this.closureData = data.groupActionData.closureReasons;
});
@@ -59,8 +60,14 @@ export class CloseGroupComponent implements OnInit {
*/
createCloseGroupForm() {
this.closeGroupForm = this.formBuilder.group({
'closureDate': ['', Validators.required],
'closureReasonId': ['', Validators.required]
closureDate: [
'',
Validators.required
],
closureReasonId: [
'',
Validators.required
]
});
}
@@ -84,5 +91,4 @@ export class CloseGroupComponent implements OnInit {
this.router.navigate(['../../'], { relativeTo: this.route });
});
}
}
@@ -8,9 +8,8 @@ describe('EditGroupMeetingScheduleComponent', () => {
beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [ EditGroupMeetingScheduleComponent ]
})
.compileComponents();
declarations: [EditGroupMeetingScheduleComponent]
}).compileComponents();
}));
beforeEach(() => {
@@ -17,7 +17,6 @@ import { SettingsService } from 'app/settings/settings.service';
styleUrls: ['./edit-group-meeting-schedule.component.scss']
})
export class EditGroupMeetingScheduleComponent implements OnInit {
/** Minimum date allowed. */
minDate = new Date(2000, 0, 1);
/** Maximum date allowed. */
@@ -42,12 +41,14 @@ export class EditGroupMeetingScheduleComponent implements OnInit {
* @param {Router} router Router
* @param {SettingsService} settingsService SettingsService
*/
constructor(private formBuilder: UntypedFormBuilder,
private groupsService: GroupsService,
private dateUtils: Dates,
private route: ActivatedRoute,
private router: Router,
private settingsService: SettingsService) {
constructor(
private formBuilder: UntypedFormBuilder,
private groupsService: GroupsService,
private dateUtils: Dates,
private route: ActivatedRoute,
private router: Router,
private settingsService: SettingsService
) {
this.route.data.subscribe((data: { groupActionData: any }) => {
this.calendarTemplate = data.groupActionData;
this.nextMeetingDates = this.calendarTemplate.nextTenRecurringDates;
@@ -66,8 +67,14 @@ export class EditGroupMeetingScheduleComponent implements OnInit {
*/
createEditMeetingScheduleForm() {
this.groupEditMeetingScheduleForm = this.formBuilder.group({
'presentMeetingDate': ['', Validators.required],
'newMeetingDate': ['', Validators.required]
presentMeetingDate: [
'',
Validators.required
],
newMeetingDate: [
'',
Validators.required
]
});
}
@@ -97,5 +104,4 @@ export class EditGroupMeetingScheduleComponent implements OnInit {
this.router.navigate(['../../'], { relativeTo: this.route });
});
}
}
@@ -8,9 +8,8 @@ describe('EditGroupMeetingComponent', () => {
beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [ EditGroupMeetingComponent ]
})
.compileComponents();
declarations: [EditGroupMeetingComponent]
}).compileComponents();
}));
beforeEach(() => {
@@ -17,7 +17,6 @@ import { SettingsService } from 'app/settings/settings.service';
styleUrls: ['./edit-group-meeting.component.scss']
})
export class EditGroupMeetingComponent implements OnInit {
/** Minimum date allowed. */
minDate = new Date(2000, 0, 1);
/** Maximum date allowed. */
@@ -46,12 +45,14 @@ export class EditGroupMeetingComponent implements OnInit {
* @param {Router} router Router
* @param {SettingsService} settingsService SettingsService
*/
constructor(private formBuilder: UntypedFormBuilder,
private groupsService: GroupsService,
private dateUtils: Dates,
private route: ActivatedRoute,
private router: Router,
private settingsService: SettingsService) {
constructor(
private formBuilder: UntypedFormBuilder,
private groupsService: GroupsService,
private dateUtils: Dates,
private route: ActivatedRoute,
private router: Router,
private settingsService: SettingsService
) {
this.route.data.subscribe((data: { groupActionData: any }) => {
this.calendarTemplate = data.groupActionData;
this.frequencyOptions = this.calendarTemplate.frequencyOptions;
@@ -72,9 +73,18 @@ export class EditGroupMeetingComponent implements OnInit {
*/
createEditGroupMeetingForm() {
this.groupEditMeetingForm = this.formBuilder.group({
'startDate': ['', Validators.required],
'frequency': ['', Validators.required],
'interval': ['', Validators.required]
startDate: [
'',
Validators.required
],
frequency: [
'',
Validators.required
],
interval: [
'',
Validators.required
]
});
}
@@ -86,25 +96,51 @@ export class EditGroupMeetingComponent implements OnInit {
this.groupEditMeetingForm.removeControl('repeatsOnDay');
switch (frequency) {
case 1: // Daily
this.repetitionIntervals = ['1', '2', '3'];
break;
this.repetitionIntervals = [
'1',
'2',
'3'
];
break;
case 2: // Weekly
this.repetitionIntervals = ['1', '2', '3'];
this.repetitionIntervals = [
'1',
'2',
'3'
];
this.groupEditMeetingForm.addControl('repeatsOnDay', new UntypedFormControl('', Validators.required));
this.groupEditMeetingForm.get('repeatsOnDay').patchValue(this.calendarTemplate.repeatsOnDay.id);
break;
break;
case 3: // Monthly
this.repetitionIntervals = ['1', '2', '3', '4', '5', '6', '7', '8', '9', '10', '11'];
break;
this.repetitionIntervals = [
'1',
'2',
'3',
'4',
'5',
'6',
'7',
'8',
'9',
'10',
'11'
];
break;
case 4: // Yearly
this.repetitionIntervals = ['1', '2', '3', '4', '5'];
break;
this.repetitionIntervals = [
'1',
'2',
'3',
'4',
'5'
];
break;
}
});
this.groupEditMeetingForm.patchValue({
'startDate': this.calendarTemplate.startDate && new Date(this.calendarTemplate.startDate),
'frequency': this.calendarTemplate.frequency.id,
'interval': `${this.calendarTemplate.interval}`
startDate: this.calendarTemplate.startDate && new Date(this.calendarTemplate.startDate),
frequency: this.calendarTemplate.frequency.id,
interval: `${this.calendarTemplate.interval}`
});
}
@@ -141,5 +177,4 @@ export class EditGroupMeetingComponent implements OnInit {
this.router.navigate(['../../'], { relativeTo: this.route });
});
}
}
@@ -8,9 +8,8 @@ describe('GroupActionsComponent', () => {
beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [ GroupActionsComponent ]
})
.compileComponents();
declarations: [GroupActionsComponent]
}).compileComponents();
}));
beforeEach(() => {
@@ -11,24 +11,23 @@ import { ActivatedRoute, Router } from '@angular/router';
styleUrls: ['./group-actions.component.scss']
})
export class GroupActionsComponent {
/** Flag object to store possible actions and render appropriate UI to the user */
actions: {
'Assign Staff': boolean
'Close': boolean
'Activate': boolean
'Attach Meeting': boolean
'Attendance': boolean
'Manage Members': boolean
'Edit Meeting': boolean
'Edit Meeting Schedule': boolean
'Transfer Clients': boolean
'Assign Staff': boolean;
Close: boolean;
Activate: boolean;
'Attach Meeting': boolean;
Attendance: boolean;
'Manage Members': boolean;
'Edit Meeting': boolean;
'Edit Meeting Schedule': boolean;
'Transfer Clients': boolean;
} = {
'Assign Staff': false,
'Close': false,
'Activate': false,
Close: false,
Activate: false,
'Attach Meeting': false,
'Attendance': false,
Attendance: false,
'Manage Members': false,
'Edit Meeting': false,
'Edit Meeting Schedule': false,
@@ -39,11 +38,12 @@ export class GroupActionsComponent {
* @param {ActivatedRoute} route Activated Route
* @param {Router} router Router
*/
constructor(private route: ActivatedRoute,
private router: Router) {
constructor(
private route: ActivatedRoute,
private router: Router
) {
this.router.routeReuseStrategy.shouldReuseRoute = () => false;
const action = this.route.snapshot.params['action'];
this.actions[action] = true;
}
}
@@ -8,9 +8,8 @@ describe('GroupAssignStaffComponent', () => {
beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [ GroupAssignStaffComponent ]
})
.compileComponents();
declarations: [GroupAssignStaffComponent]
}).compileComponents();
}));
beforeEach(() => {
@@ -15,7 +15,6 @@ import { GroupsService } from 'app/groups/groups.service';
styleUrls: ['./group-assign-staff.component.scss']
})
export class GroupAssignStaffComponent implements OnInit {
/** Group Assign Staff form. */
groupAssignStaffForm: UntypedFormGroup;
/** Staff Data */
@@ -30,10 +29,12 @@ export class GroupAssignStaffComponent implements OnInit {
* @param {ActivatedRoute} route Activated Route
* @param {Router} router Router
*/
constructor(private formBuilder: UntypedFormBuilder,
private groupsService: GroupsService,
private route: ActivatedRoute,
private router: Router) {
constructor(
private formBuilder: UntypedFormBuilder,
private groupsService: GroupsService,
private route: ActivatedRoute,
private router: Router
) {
this.route.data.subscribe((data: { groupActionData: any }) => {
this.groupData = data.groupActionData;
});
@@ -49,7 +50,7 @@ export class GroupAssignStaffComponent implements OnInit {
*/
createGroupAssignStaffForm() {
this.groupAssignStaffForm = this.formBuilder.group({
'staffId': ['']
staffId: ['']
});
}
@@ -57,10 +58,10 @@ export class GroupAssignStaffComponent implements OnInit {
* Submits the form and assigns staff for the group.
*/
submit() {
this.groupsService.executeGroupCommand(this.groupData.id, 'assignStaff', this.groupAssignStaffForm.value)
this.groupsService
.executeGroupCommand(this.groupData.id, 'assignStaff', this.groupAssignStaffForm.value)
.subscribe(() => {
this.router.navigate(['../../'], { relativeTo: this.route });
});
}
}
@@ -8,9 +8,8 @@ describe('GroupAttendanceComponent', () => {
beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [ GroupAttendanceComponent ]
})
.compileComponents();
declarations: [GroupAttendanceComponent]
}).compileComponents();
}));
beforeEach(() => {
@@ -25,7 +25,6 @@ import { Dates } from 'app/core/utils/dates';
styleUrls: ['./group-attendance.component.scss']
})
export class GroupAttendanceComponent implements OnInit {
/** Members data. */
membersData: any;
/** Group Data */
@@ -33,7 +32,10 @@ export class GroupAttendanceComponent implements OnInit {
/** Attendance Type Options */
attendanceTypeOptions: any;
/** Columns to be displayed in member's attendance table. */
displayedColumns: string[] = ['name', 'attendance'];
displayedColumns: string[] = [
'name',
'attendance'
];
/** Start Date Form Control */
meetingDate = new UntypedFormControl();
/** Meeting Dates Data */
@@ -50,13 +52,15 @@ export class GroupAttendanceComponent implements OnInit {
* @param {MatDialog} dialog Mat Dialog
* @param {SettingsService} settingsService SettingsService
*/
constructor(private route: ActivatedRoute,
private dateUtils: Dates,
private router: Router,
private groupsService: GroupsService,
public dialog: MatDialog,
private settingsService: SettingsService) {
this.route.data.subscribe(( data: { groupActionData: any }) => {
constructor(
private route: ActivatedRoute,
private dateUtils: Dates,
private router: Router,
private groupsService: GroupsService,
public dialog: MatDialog,
private settingsService: SettingsService
) {
this.route.data.subscribe((data: { groupActionData: any }) => {
this.groupData = data.groupActionData;
this.membersData = data.groupActionData.clientMembers;
});
@@ -67,8 +71,9 @@ export class GroupAttendanceComponent implements OnInit {
*/
ngOnInit() {
this.dataSource = this.membersData.map((member: any) => ({ clientId: member.id, attendanceType: 1 }));
this.meetingDates = this.groupData.collectionMeetingCalendar.recurringDates
.filter((date: any) => new Date(date).getTime() < new Date().getTime());
this.meetingDates = this.groupData.collectionMeetingCalendar.recurringDates.filter(
(date: any) => new Date(date).getTime() < new Date().getTime()
);
this.getAttendanceOptions();
}
@@ -76,7 +81,8 @@ export class GroupAttendanceComponent implements OnInit {
* Gets attendance type options based on calendar id.
*/
getAttendanceOptions() {
this.groupsService.getMeetingsTemplate(this.groupData.id, this.groupData.collectionMeetingCalendar.id)
this.groupsService
.getMeetingsTemplate(this.groupData.id, this.groupData.collectionMeetingCalendar.id)
.subscribe((response: any) => {
this.attendanceTypeOptions = response.attendanceTypeOptions;
});
@@ -94,7 +100,8 @@ export class GroupAttendanceComponent implements OnInit {
value: member.attendanceType,
options: { label: 'value', value: 'id', data: this.attendanceTypeOptions },
required: false
}),
})
];
const data = {
title: 'Assign Member Attendance',
@@ -126,9 +133,10 @@ export class GroupAttendanceComponent implements OnInit {
dateFormat,
locale
};
this.groupsService.assignGroupAttendance(this.groupData.id, this.groupData.collectionMeetingCalendar.id, data).subscribe(() => {
this.router.navigate(['../../'], { relativeTo: this.route });
});
this.groupsService
.assignGroupAttendance(this.groupData.id, this.groupData.collectionMeetingCalendar.id, data)
.subscribe(() => {
this.router.navigate(['../../'], { relativeTo: this.route });
});
}
}
@@ -8,9 +8,8 @@ describe('GroupTransferClientsComponent', () => {
beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [ GroupTransferClientsComponent ]
})
.compileComponents();
declarations: [GroupTransferClientsComponent]
}).compileComponents();
}));
beforeEach(() => {
@@ -16,7 +16,6 @@ import { SettingsService } from 'app/settings/settings.service';
styleUrls: ['./group-transfer-clients.component.scss']
})
export class GroupTransferClientsComponent implements OnInit, AfterViewInit {
/** Transfer Clients form. */
transferClientsForm: UntypedFormGroup;
/** Group Data */
@@ -36,11 +35,13 @@ export class GroupTransferClientsComponent implements OnInit, AfterViewInit {
* @param {GroupsService} groupsService GroupsService.
* @param {SettingsService} settingsService SettingsService
*/
constructor(private formBuilder: UntypedFormBuilder,
private route: ActivatedRoute,
private router: Router,
private groupsService: GroupsService,
private settingsService: SettingsService) {
constructor(
private formBuilder: UntypedFormBuilder,
private route: ActivatedRoute,
private router: Router,
private groupsService: GroupsService,
private settingsService: SettingsService
) {
this.route.data.subscribe((data: { groupActionData: any }) => {
this.groupData = data.groupActionData;
this.clientMembers = this.groupData.clientMembers;
@@ -55,12 +56,11 @@ export class GroupTransferClientsComponent implements OnInit, AfterViewInit {
* Subscribes to Groups search filter:
*/
ngAfterViewInit() {
this.transferClientsForm.get('destinationGroupId').valueChanges.subscribe( (value: string) => {
this.transferClientsForm.get('destinationGroupId').valueChanges.subscribe((value: string) => {
if (value.length >= 2) {
this.groupsService.getFilteredGroups('name', 'ASC', value, this.groupData.officeId)
.subscribe( (data: any) => {
this.groupsData = data;
});
this.groupsService.getFilteredGroups('name', 'ASC', value, this.groupData.officeId).subscribe((data: any) => {
this.groupsData = data;
});
}
});
}
@@ -70,9 +70,15 @@ export class GroupTransferClientsComponent implements OnInit, AfterViewInit {
*/
createTransferClientsForm() {
this.transferClientsForm = this.formBuilder.group({
'clients': ['', Validators.required],
'inheritDestinationGroupLoanOfficer': [false],
'destinationGroupId': ['', Validators.required]
clients: [
'',
Validators.required
],
inheritDestinationGroupLoanOfficer: [false],
destinationGroupId: [
'',
Validators.required
]
});
}
@@ -100,5 +106,4 @@ export class GroupTransferClientsComponent implements OnInit, AfterViewInit {
this.router.navigate(['../../'], { relativeTo: this.route });
});
}
}
@@ -8,9 +8,8 @@ describe('ManageGroupMembersComponent', () => {
beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [ ManageGroupMembersComponent ]
})
.compileComponents();
declarations: [ManageGroupMembersComponent]
}).compileComponents();
}));
beforeEach(() => {
@@ -20,7 +20,6 @@ import { MatDialog } from '@angular/material/dialog';
styleUrls: ['./manage-group-members.component.scss']
})
export class ManageGroupMembersComponent implements AfterViewInit {
/** Group Data */
groupData: any;
/** Client data. */
@@ -37,24 +36,26 @@ export class ManageGroupMembersComponent implements AfterViewInit {
* @param {ClientsService} clientsService Clients Service
* @param {MatDialog} dialog Mat Dialog
*/
constructor(private route: ActivatedRoute,
private groupsService: GroupsService,
private clientsService: ClientsService,
public dialog: MatDialog) {
constructor(
private route: ActivatedRoute,
private groupsService: GroupsService,
private clientsService: ClientsService,
public dialog: MatDialog
) {
this.route.data.subscribe((data: { groupActionData: any }) => {
this.groupData = data.groupActionData;
this.clientMembers = data.groupActionData.clientMembers || [];
});
}
/**
* Subscribes to Clients search filter:
*/
ngAfterViewInit() {
this.clientChoice.valueChanges.subscribe( (value: string) => {
this.clientChoice.valueChanges.subscribe((value: string) => {
if (value.length >= 2) {
this.clientsService.getFilteredClients('displayName', 'ASC', true, value, this.groupData.officeId)
this.clientsService
.getFilteredClients('displayName', 'ASC', true, value, this.groupData.officeId)
.subscribe((data: any) => {
this.clientsData = data.pageItems;
});
@@ -67,8 +68,11 @@ export class ManageGroupMembersComponent implements AfterViewInit {
*/
addClient() {
if (!this.clientMembers.includes(this.clientChoice.value)) {
this.groupsService.executeGroupCommand(this.groupData.id, 'associateClients', {clientMembers: [this.clientChoice.value.id]})
.subscribe(() => { this.clientMembers.push(this.clientChoice.value); });
this.groupsService
.executeGroupCommand(this.groupData.id, 'associateClients', { clientMembers: [this.clientChoice.value.id] })
.subscribe(() => {
this.clientMembers.push(this.clientChoice.value);
});
}
}
@@ -83,8 +87,11 @@ export class ManageGroupMembersComponent implements AfterViewInit {
});
removeMemberDialogRef.afterClosed().subscribe((response: any) => {
if (response.delete) {
this.groupsService.executeGroupCommand(this.groupData.id, 'disassociateClients', {clientMembers: [client.id]})
.subscribe(() => { this.clientMembers.splice(index, 1); });
this.groupsService
.executeGroupCommand(this.groupData.id, 'disassociateClients', { clientMembers: [client.id] })
.subscribe(() => {
this.clientMembers.splice(index, 1);
});
}
});
}
@@ -97,5 +104,4 @@ export class ManageGroupMembersComponent implements AfterViewInit {
displayClient(client: any): string | undefined {
return client ? client.displayName : undefined;
}
}
@@ -8,9 +8,8 @@ describe('GroupsViewComponent', () => {
beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [ GroupsViewComponent ]
})
.compileComponents();
declarations: [GroupsViewComponent]
}).compileComponents();
}));
beforeEach(() => {
@@ -19,7 +19,6 @@ import { GroupsService } from '../groups.service';
styleUrls: ['./groups-view.component.scss']
})
export class GroupsViewComponent {
/** Group view data */
groupViewData: any;
/** Group datatables data */
@@ -32,11 +31,13 @@ export class GroupsViewComponent {
* @param {Router} router Router
* @param {MatDialog} dialog Dialog
*/
constructor(private route: ActivatedRoute,
private groupsService: GroupsService,
private router: Router,
public dialog: MatDialog) {
this.route.data.subscribe((data: { groupViewData: any, groupDatatables: any }) => {
constructor(
private route: ActivatedRoute,
private groupsService: GroupsService,
private router: Router,
public dialog: MatDialog
) {
this.route.data.subscribe((data: { groupViewData: any; groupDatatables: any }) => {
this.groupViewData = data.groupViewData;
this.groupDatatables = data.groupDatatables;
});
@@ -79,7 +80,7 @@ export class GroupsViewComponent {
get editMeeting() {
if (this.groupViewData.collectionMeetingCalendar) {
const entityType = this.groupViewData.collectionMeetingCalendar.entityType.value;
if (entityType === 'GROUPS' && this.groupViewData.hierarchy === '.' + this.groupViewData.id + '.' ) {
if (entityType === 'GROUPS' && this.groupViewData.hierarchy === '.' + this.groupViewData.id + '.') {
return true;
}
}
@@ -92,8 +93,7 @@ export class GroupsViewComponent {
*/
reload() {
const url: string = this.router.url;
this.router.navigateByUrl(`/groups`, {skipLocationChange: true})
.then(() => this.router.navigate([url]));
this.router.navigateByUrl(`/groups`, { skipLocationChange: true }).then(() => this.router.navigate([url]));
}
/**
@@ -103,7 +103,8 @@ export class GroupsViewComponent {
const unAssignStaffDialogRef = this.dialog.open(UnassignStaffDialogComponent);
unAssignStaffDialogRef.afterClosed().subscribe((response: { confirm: any }) => {
if (response.confirm) {
this.groupsService.executeGroupCommand(this.groupViewData.id, 'unassignStaff', { staffId: this.groupViewData.staffId })
this.groupsService
.executeGroupCommand(this.groupViewData.id, 'unassignStaff', { staffId: this.groupViewData.staffId })
.subscribe(() => {
this.reload();
});
@@ -126,5 +127,4 @@ export class GroupsViewComponent {
}
});
}
}
@@ -8,9 +8,8 @@ describe('NotesTabComponent', () => {
beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [ NotesTabComponent ]
})
.compileComponents();
declarations: [NotesTabComponent]
}).compileComponents();
}));
beforeEach(() => {
@@ -17,7 +17,6 @@ import { GroupsService } from '../../groups.service';
styleUrls: ['./notes-tab.component.scss']
})
export class NotesTabComponent {
/** Group ID */
entityId: string;
/** Username */
@@ -31,9 +30,11 @@ export class NotesTabComponent {
* @param {GroupsService} groupsService Groups Service
* @param {AuthenticationService} authenticationService Authentication Service.
*/
constructor(private route: ActivatedRoute,
private authenticationService: AuthenticationService,
private groupsService: GroupsService) {
constructor(
private route: ActivatedRoute,
private authenticationService: AuthenticationService,
private groupsService: GroupsService
) {
const savedCredentials = this.authenticationService.getCredentials();
this.username = savedCredentials.username;
this.entityId = this.route.parent.snapshot.params['groupId'];
@@ -72,10 +73,8 @@ export class NotesTabComponent {
* @param {string} noteId Note Id.
*/
deleteNote(noteId: string, index: number) {
this.groupsService.deleteGroupNote(this.entityId, noteId)
.subscribe(() => {
this.groupsService.deleteGroupNote(this.entityId, noteId).subscribe(() => {
this.entityNotes.splice(index, 1);
});
}
}
+27 -12
View File
@@ -7,7 +7,7 @@ import { UntypedFormControl } from '@angular/forms';
/** rxjs Imports */
import { merge } from 'rxjs';
import { tap, startWith, map, distinctUntilChanged, debounceTime} from 'rxjs/operators';
import { tap, startWith, map, distinctUntilChanged, debounceTime } from 'rxjs/operators';
/** Custom Services */
import { GroupsService } from './groups.service';
@@ -29,7 +29,13 @@ export class GroupsComponent implements OnInit, AfterViewInit {
/** Name form control. */
name = new UntypedFormControl();
/** Columns to be displayed in groups table. */
displayedColumns = ['name', 'accountNo', 'externalId', 'status', 'officeName'];
displayedColumns = [
'name',
'accountNo',
'externalId',
'status',
'officeName'
];
/** Data source for groups table. */
dataSource: GroupsDataSource;
/** Groups filter. */
@@ -48,7 +54,7 @@ export class GroupsComponent implements OnInit, AfterViewInit {
/**
* @param {GroupsService} groupsService Groups Service
*/
constructor(private groupsService: GroupsService) { }
constructor(private groupsService: GroupsService) {}
ngOnInit() {
this.getGroups();
@@ -60,7 +66,6 @@ export class GroupsComponent implements OnInit, AfterViewInit {
* sort change and page change.
*/
ngAfterViewInit() {
this.name.valueChanges
.pipe(
debounceTime(500),
@@ -71,12 +76,10 @@ export class GroupsComponent implements OnInit, AfterViewInit {
)
.subscribe();
this.sort.sortChange.subscribe(() => this.paginator.pageIndex = 0);
this.sort.sortChange.subscribe(() => (this.paginator.pageIndex = 0));
merge(this.sort.sortChange, this.paginator.page)
.pipe(
tap(() => this.loadGroupsPage())
)
.pipe(tap(() => this.loadGroupsPage()))
.subscribe();
}
@@ -91,7 +94,14 @@ export class GroupsComponent implements OnInit, AfterViewInit {
if (!this.sort.direction) {
delete this.sort.active;
}
this.dataSource.getGroups(this.filterGroupsBy, this.sort.active, this.sort.direction, this.paginator.pageIndex, this.paginator.pageSize, !this.showClosedGroups.checked);
this.dataSource.getGroups(
this.filterGroupsBy,
this.sort.active,
this.sort.direction,
this.paginator.pageIndex,
this.paginator.pageSize,
!this.showClosedGroups.checked
);
}
/**
@@ -101,7 +111,7 @@ export class GroupsComponent implements OnInit, AfterViewInit {
*/
applyFilter(filterValue: string, property: string) {
this.paginator.pageIndex = 0;
const findIndex = this.filterGroupsBy.findIndex(filter => filter.type === property);
const findIndex = this.filterGroupsBy.findIndex((filter) => filter.type === property);
this.filterGroupsBy[findIndex].value = filterValue;
this.loadGroupsPage();
}
@@ -111,7 +121,12 @@ export class GroupsComponent implements OnInit, AfterViewInit {
*/
getGroups() {
this.dataSource = new GroupsDataSource(this.groupsService);
this.dataSource.getGroups(this.filterGroupsBy, this.sort.active, this.sort.direction, this.paginator.pageIndex, this.paginator.pageSize);
this.dataSource.getGroups(
this.filterGroupsBy,
this.sort.active,
this.sort.direction,
this.paginator.pageIndex,
this.paginator.pageSize
);
}
}
+14 -10
View File
@@ -11,7 +11,6 @@ import { GroupsService } from './groups.service';
* Groups custom data source to implement server side filtering, pagination and sorting.
*/
export class GroupsDataSource implements DataSource<any> {
/** groups behavior subject to represent loaded groups page. */
private groupsSubject = new BehaviorSubject<any[]>([]);
/** Records subject to represent total number of filtered groups records. */
@@ -22,7 +21,7 @@ export class GroupsDataSource implements DataSource<any> {
/**
* @param {GroupsService} groupsService Groups Service
*/
constructor(private groupsService: GroupsService) { }
constructor(private groupsService: GroupsService) {}
/**
* Gets groups on the basis of provided parameters and emits the value.
@@ -33,14 +32,20 @@ export class GroupsDataSource implements DataSource<any> {
* @param {number} limit Number of entries within the page.
* @param {boolean} groupActive Specify whether to only filter active groups.
*/
getGroups(filterBy: any, orderBy: string = '', sortOrder: string = '', pageIndex: number = 0, limit: number = 10, groupActive: boolean = true) {
getGroups(
filterBy: any,
orderBy: string = '',
sortOrder: string = '',
pageIndex: number = 0,
limit: number = 10,
groupActive: boolean = true
) {
this.groupsSubject.next([]);
this.groupsService.getGroups(filterBy, orderBy, sortOrder, pageIndex * limit, limit)
.subscribe((groups: any) => {
groups.pageItems = (groupActive) ? (groups.pageItems.filter((group: any) => group.active)) : groups.pageItems;
this.recordsSubject.next(groups.totalFilteredRecords);
this.groupsSubject.next(groups.pageItems);
});
this.groupsService.getGroups(filterBy, orderBy, sortOrder, pageIndex * limit, limit).subscribe((groups: any) => {
groups.pageItems = groupActive ? groups.pageItems.filter((group: any) => group.active) : groups.pageItems;
this.recordsSubject.next(groups.totalFilteredRecords);
this.groupsSubject.next(groups.pageItems);
});
}
/**
@@ -57,5 +62,4 @@ export class GroupsDataSource implements DataSource<any> {
this.groupsSubject.complete();
this.recordsSubject.complete();
}
}
+2 -2
View File
@@ -65,6 +65,6 @@ import { GroupTransferClientsComponent } from './groups-view/group-actions/group
EditGroupMeetingScheduleComponent,
GroupTransferClientsComponent
],
providers: [ ]
providers: []
})
export class GroupsModule { }
export class GroupsModule {}
+16 -20
View File
@@ -9,14 +9,13 @@ import { Observable } from 'rxjs';
* Groups service.
*/
@Injectable({
providedIn: 'root'
providedIn: 'root'
})
export class GroupsService {
/**
* @param {HttpClient} http Http Client to send requests.
*/
constructor(private http: HttpClient) { }
constructor(private http: HttpClient) {}
/**
* @param {any} filterBy Properties by which entries should be filtered.
@@ -50,11 +49,14 @@ export class GroupsService {
* @param {any} orphansOnly? Orphans Only.
* @returns {Observable<any>} Groups.
*/
getFilteredGroups(orderBy: string, sortOrder: string, name: string, officeId?: any, orphansOnly?: any): Observable<any> {
let httpParams = new HttpParams()
.set('name', name)
.set('sortOrder', sortOrder)
.set('orderBy', orderBy);
getFilteredGroups(
orderBy: string,
sortOrder: string,
name: string,
officeId?: any,
orphansOnly?: any
): Observable<any> {
let httpParams = new HttpParams().set('name', name).set('sortOrder', sortOrder).set('orderBy', orderBy);
if (officeId) {
httpParams = httpParams.set('officeId', officeId);
}
@@ -68,7 +70,7 @@ export class GroupsService {
*/
getGroupsByOfficeId(officeId: number): Observable<any> {
const httpParams = new HttpParams().set('officeId', officeId.toString());
return this.http.get('/groups', { params: httpParams } );
return this.http.get('/groups', { params: httpParams });
}
/**
@@ -87,8 +89,7 @@ export class GroupsService {
* @returns {Observable<any>} Group Summary data.
*/
getGroupSummary(groupId: string): Observable<any> {
const httpParams = new HttpParams().set('R_groupId', groupId)
.set('genericResultSet', 'false');
const httpParams = new HttpParams().set('R_groupId', groupId).set('genericResultSet', 'false');
return this.http.get(`/runreports/GroupSummaryCounts`, { params: httpParams });
}
@@ -212,9 +213,7 @@ export class GroupsService {
* @returns {Observable<any>}
*/
unAssignRoleCommand(groupId: string, roleId: any): Observable<any> {
const httpParams = new HttpParams()
.set('command', 'unassignRole')
.set('roleId', roleId);
const httpParams = new HttpParams().set('command', 'unassignRole').set('roleId', roleId);
return this.http.post(`/groups/${groupId}`, {}, { params: httpParams });
}
@@ -306,9 +305,7 @@ export class GroupsService {
* @returns {Observable<any>} Staff Data for group.
*/
getStaff(id: number): Observable<any> {
const httpParams = new HttpParams()
.set('officeId', id.toString())
.set('staffInSelectedOfficeOnly', 'true');
const httpParams = new HttpParams().set('officeId', id.toString()).set('staffInSelectedOfficeOnly', 'true');
return this.http.get('/groups/template', { params: httpParams });
}
@@ -316,7 +313,7 @@ export class GroupsService {
* @param groupId Group Id of group to get data for.
* @returns {Observable<any>} Group GLIM Accounts data.
*/
getGLIMAccountsData(groupId: string): Observable<any> {
getGLIMAccountsData(groupId: string): Observable<any> {
return this.http.get(`/groups/${groupId}/glimaccounts`);
}
@@ -324,8 +321,7 @@ export class GroupsService {
* @param groupId Group Id of group to get data for.
* @returns {Observable<any>} Group GSIM Accounts data.
*/
getGSIMAccountsData(groupId: string): Observable<any> {
getGSIMAccountsData(groupId: string): Observable<any> {
return this.http.get(`/groups/${groupId}/gsimaccounts`);
}
}