build: Use prettier for typescript

Stop ignoring .ts files in prettier and fix existing issues.
This commit is contained in:
Ralph Hopman
2025-01-15 11:59:30 +00:00
committed by Adam Saghy
parent 9d6cf1514a
commit cac1d11ad7
1812 changed files with 22516 additions and 16862 deletions
@@ -8,9 +8,8 @@ describe('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;
}
}