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('ActivateCenterComponent', () => {
beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [ ActivateCenterComponent ]
})
.compileComponents();
declarations: [ActivateCenterComponent]
}).compileComponents();
}));
beforeEach(() => {
@@ -17,7 +17,6 @@ import { SettingsService } from 'app/settings/settings.service';
styleUrls: ['./activate-center.component.scss']
})
export class ActivateCenterComponent implements OnInit {
/** Minimum date allowed. */
minDate = new Date(2000, 0, 1);
/** Maximum date allowed. */
@@ -35,12 +34,14 @@ export class ActivateCenterComponent implements OnInit {
* @param {ActivatedRoute} route Activated Route
* @param {Router} router Router
*/
constructor(private formBuilder: UntypedFormBuilder,
private centersService: CentersService,
private settingsService: SettingsService,
private dateUtils: Dates,
private route: ActivatedRoute,
private router: Router) {
constructor(
private formBuilder: UntypedFormBuilder,
private centersService: CentersService,
private settingsService: SettingsService,
private dateUtils: Dates,
private route: ActivatedRoute,
private router: Router
) {
this.centerId = this.route.parent.snapshot.params['centerId'];
}
@@ -57,7 +58,10 @@ export class ActivateCenterComponent implements OnInit {
*/
createActivateCenterForm() {
this.activateCenterForm = this.formBuilder.group({
'activationDate': [new Date(), Validators.required]
activationDate: [
new Date(),
Validators.required
]
});
}
@@ -82,5 +86,4 @@ export class ActivateCenterComponent implements OnInit {
this.router.navigate(['../../'], { relativeTo: this.route });
});
}
}
@@ -8,9 +8,8 @@ describe('AttachCenterMeetingComponent', () => {
beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [ AttachCenterMeetingComponent ]
})
.compileComponents();
declarations: [AttachCenterMeetingComponent]
}).compileComponents();
}));
beforeEach(() => {
@@ -17,7 +17,6 @@ import { SettingsService } from 'app/settings/settings.service';
styleUrls: ['./attach-center-meeting.component.scss']
})
export class AttachCenterMeetingComponent implements OnInit {
/** Minimum date allowed. */
minDate = new Date(2000, 0, 1);
/** Maximum date allowed. */
@@ -44,12 +43,14 @@ export class AttachCenterMeetingComponent implements OnInit {
* @param {ActivatedRoute} route Activated Route
* @param {Router} router Router
*/
constructor(private formBuilder: UntypedFormBuilder,
private centersService: CentersService,
private settingsService: SettingsService,
private dateUtils: Dates,
private route: ActivatedRoute,
private router: Router) {
constructor(
private formBuilder: UntypedFormBuilder,
private centersService: CentersService,
private settingsService: SettingsService,
private dateUtils: Dates,
private route: ActivatedRoute,
private router: Router
) {
this.route.data.subscribe((data: { centersActionData: any }) => {
this.calendarTemplate = data.centersActionData;
this.frequencyOptions = this.calendarTemplate.frequencyOptions;
@@ -69,8 +70,11 @@ export class AttachCenterMeetingComponent implements OnInit {
*/
createCenterMeetingForm() {
this.centerMeetingForm = this.formBuilder.group({
'startDate': ['', Validators.required],
'repeating': [false]
startDate: [
'',
Validators.required
],
repeating: [false]
});
}
@@ -86,23 +90,49 @@ export class AttachCenterMeetingComponent implements OnInit {
this.centerMeetingForm.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.centerMeetingForm.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.centerMeetingForm.patchValue({
'frequency': 1,
'interval': '1'
frequency: 1,
interval: '1'
});
} else {
this.centerMeetingForm.removeControl('frequency');
@@ -135,5 +165,4 @@ export class AttachCenterMeetingComponent implements OnInit {
this.router.navigate(['../../'], { relativeTo: this.route });
});
}
}
@@ -8,9 +8,8 @@ describe('CenterActionsComponent', () => {
beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [ CenterActionsComponent ]
})
.compileComponents();
declarations: [CenterActionsComponent]
}).compileComponents();
}));
beforeEach(() => {
@@ -11,23 +11,22 @@ import { ActivatedRoute, Router } from '@angular/router';
styleUrls: ['./center-actions.component.scss']
})
export class CenterActionsComponent {
/** Flag object to store possible actions and render appropriate UI to the user */
actions: {
'Activate': boolean,
'Assign Staff': boolean,
'Close': boolean,
'Attendance': boolean,
'Attach Meeting': boolean,
'Edit Meeting': boolean,
'Edit Meeting Schedule': boolean,
'Manage Groups': boolean,
'Staff Assignment History': boolean
Activate: boolean;
'Assign Staff': boolean;
Close: boolean;
Attendance: boolean;
'Attach Meeting': boolean;
'Edit Meeting': boolean;
'Edit Meeting Schedule': boolean;
'Manage Groups': boolean;
'Staff Assignment History': boolean;
} = {
'Activate': false,
Activate: false,
'Assign Staff': false,
'Close': false,
'Attendance': false,
Close: false,
Attendance: false,
'Attach Meeting': false,
'Edit Meeting': false,
'Edit Meeting Schedule': false,
@@ -38,11 +37,12 @@ export class CenterActionsComponent {
/**
* @param {ActivatedRoute} route Activated Route
*/
constructor(private route: ActivatedRoute,
private router: Router) {
constructor(
private route: ActivatedRoute,
private router: Router
) {
this.router.routeReuseStrategy.shouldReuseRoute = () => false;
const name = this.route.snapshot.params['name'];
this.actions[name] = true;
}
}
@@ -8,9 +8,8 @@ describe('CenterAssignStaffComponent', () => {
beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [ CenterAssignStaffComponent ]
})
.compileComponents();
declarations: [CenterAssignStaffComponent]
}).compileComponents();
}));
beforeEach(() => {
@@ -15,7 +15,6 @@ import { CentersService } from 'app/centers/centers.service';
styleUrls: ['./center-assign-staff.component.scss']
})
export class CenterAssignStaffComponent implements OnInit {
/** Center Assign Staff form. */
centerAssignStaffForm: UntypedFormGroup;
/** Field Officer Data */
@@ -30,10 +29,12 @@ export class CenterAssignStaffComponent implements OnInit {
* @param {ActivatedRoute} route Activated Route
* @param {Router} router Router
*/
constructor(private formBuilder: UntypedFormBuilder,
private centersService: CentersService,
private route: ActivatedRoute,
private router: Router) {
constructor(
private formBuilder: UntypedFormBuilder,
private centersService: CentersService,
private route: ActivatedRoute,
private router: Router
) {
this.route.data.subscribe((data: { centersActionData: any }) => {
this.centerData = data.centersActionData;
});
@@ -52,7 +53,7 @@ export class CenterAssignStaffComponent implements OnInit {
*/
createCenterAssignStaffForm() {
this.centerAssignStaffForm = this.formBuilder.group({
'staffId': ['']
staffId: ['']
});
}
@@ -60,10 +61,10 @@ export class CenterAssignStaffComponent implements OnInit {
* Submits the form and assigns staff for the center.
*/
submit() {
this.centersService.executeGroupActionCommand(this.centerData.id, 'assignStaff', this.centerAssignStaffForm.value)
this.centersService
.executeGroupActionCommand(this.centerData.id, 'assignStaff', this.centerAssignStaffForm.value)
.subscribe(() => {
this.router.navigate(['../../'], { relativeTo: this.route });
});
}
}
@@ -8,9 +8,8 @@ describe('CenterAttendanceComponent', () => {
beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [ CenterAttendanceComponent ]
})
.compileComponents();
declarations: [CenterAttendanceComponent]
}).compileComponents();
}));
beforeEach(() => {
@@ -26,7 +26,6 @@ import { SelectBase } from 'app/shared/form-dialog/formfield/model/select-base';
styleUrls: ['./center-attendance.component.scss']
})
export class CenterAttendanceComponent implements OnInit {
/** Members data. */
membersData: any;
/** Center Data */
@@ -34,7 +33,10 @@ export class CenterAttendanceComponent 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 */
@@ -55,14 +57,16 @@ export class CenterAttendanceComponent implements OnInit {
* @param {SettingsService} settingsService Settings Service.
* @param {MatDialog} dialog Mat Dialog
*/
constructor(private route: ActivatedRoute,
private dateUtils: Dates,
private router: Router,
private centersService: CentersService,
private settingsService: SettingsService,
public dialog: MatDialog,
private translateService: TranslateService) {
this.route.data.subscribe(( data: { centersActionData: any }) => {
constructor(
private route: ActivatedRoute,
private dateUtils: Dates,
private router: Router,
private centersService: CentersService,
private settingsService: SettingsService,
public dialog: MatDialog,
private translateService: TranslateService
) {
this.route.data.subscribe((data: { centersActionData: any }) => {
this.centerData = data.centersActionData;
this.membersData = data.centersActionData.clients;
});
@@ -76,8 +80,9 @@ export class CenterAttendanceComponent implements OnInit {
if (this.membersData !== undefined && this.membersData !== null) {
this.dataSource = this.membersData.map((member: any) => ({ clientId: member.id, attendanceType: 1 }));
}
this.meetingDates = this.centerData.collectionMeetingCalendar.recurringDates
.filter((date: any) => new Date(date).getTime() < new Date().getTime());
this.meetingDates = this.centerData.collectionMeetingCalendar.recurringDates.filter(
(date: any) => new Date(date).getTime() < new Date().getTime()
);
this.getAttendanceOptions();
}
@@ -85,7 +90,8 @@ export class CenterAttendanceComponent implements OnInit {
* Gets attendance type options based on calendar id.
*/
getAttendanceOptions() {
this.centersService.getMeetingsTemplate(this.centerData.id, this.centerData.collectionMeetingCalendar.id)
this.centersService
.getMeetingsTemplate(this.centerData.id, this.centerData.collectionMeetingCalendar.id)
.subscribe((response: any) => {
this.attendanceTypeOptions = response.attendanceTypeOptions;
});
@@ -103,10 +109,14 @@ export class CenterAttendanceComponent implements OnInit {
value: member.attendanceType,
options: { label: 'value', value: 'id', data: this.attendanceTypeOptions },
required: false
}),
})
];
const data = {
title: this.translateService.instant('labels.buttons.Assign Member') + ' ' + this.translateService.instant('labels.buttons.Attendance'),
title:
this.translateService.instant('labels.buttons.Assign Member') +
' ' +
this.translateService.instant('labels.buttons.Attendance'),
layout: { addButtonText: 'Confirm' },
formfields: formfields
};
@@ -135,9 +145,10 @@ export class CenterAttendanceComponent implements OnInit {
dateFormat,
locale
};
this.centersService.assignCenterAttendance(this.centerData.id, this.centerData.collectionMeetingCalendar.id, data).subscribe(() => {
this.router.navigate(['../../'], { relativeTo: this.route });
});
this.centersService
.assignCenterAttendance(this.centerData.id, this.centerData.collectionMeetingCalendar.id, data)
.subscribe(() => {
this.router.navigate(['../../'], { relativeTo: this.route });
});
}
}
@@ -8,9 +8,8 @@ describe('CloseCenterComponent', () => {
beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [ CloseCenterComponent ]
})
.compileComponents();
declarations: [CloseCenterComponent]
}).compileComponents();
}));
beforeEach(() => {
@@ -17,7 +17,6 @@ import { SettingsService } from 'app/settings/settings.service';
styleUrls: ['./close-center.component.scss']
})
export class CloseCenterComponent implements OnInit {
/** Minimum date allowed. */
minDate = new Date(2000, 0, 1);
/** Maximum date allowed. */
@@ -37,12 +36,14 @@ export class CloseCenterComponent implements OnInit {
* @param {ActivatedRoute} route Activated Route
* @param {Router} router Router
*/
constructor(private formBuilder: UntypedFormBuilder,
private centersService: CentersService,
private settingsService: SettingsService,
private dateUtils: Dates,
private route: ActivatedRoute,
private router: Router) {
constructor(
private formBuilder: UntypedFormBuilder,
private centersService: CentersService,
private settingsService: SettingsService,
private dateUtils: Dates,
private route: ActivatedRoute,
private router: Router
) {
this.route.data.subscribe((data: { centeractionData: any }) => {
this.closureData = data.centeractionData.closureReasons;
});
@@ -59,8 +60,14 @@ export class CloseCenterComponent implements OnInit {
*/
createCloseCenterForm() {
this.closeCenterForm = this.formBuilder.group({
'closureDate': ['', Validators.required],
'closureReasonId': ['', Validators.required]
closureDate: [
'',
Validators.required
],
closureReasonId: [
'',
Validators.required
]
});
}
@@ -84,5 +91,4 @@ export class CloseCenterComponent implements OnInit {
this.router.navigate(['../../'], { relativeTo: this.route });
});
}
}
@@ -8,9 +8,8 @@ describe('EditCenterMeetingScheduleComponent', () => {
beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [ EditCenterMeetingScheduleComponent ]
})
.compileComponents();
declarations: [EditCenterMeetingScheduleComponent]
}).compileComponents();
}));
beforeEach(() => {
@@ -17,7 +17,6 @@ import { SettingsService } from 'app/settings/settings.service';
styleUrls: ['./edit-center-meeting-schedule.component.scss']
})
export class EditCenterMeetingScheduleComponent implements OnInit {
/** Minimum date allowed. */
minDate = new Date(2000, 0, 1);
/** Maximum date allowed. */
@@ -42,12 +41,14 @@ export class EditCenterMeetingScheduleComponent implements OnInit {
* @param {ActivatedRoute} route Activated Route
* @param {Router} router Router
*/
constructor(private formBuilder: UntypedFormBuilder,
private centersService: CentersService,
private settingsService: SettingsService,
private dateUtils: Dates,
private route: ActivatedRoute,
private router: Router) {
constructor(
private formBuilder: UntypedFormBuilder,
private centersService: CentersService,
private settingsService: SettingsService,
private dateUtils: Dates,
private route: ActivatedRoute,
private router: Router
) {
this.route.data.subscribe((data: { centersActionData: any }) => {
this.calendarTemplate = data.centersActionData;
this.nextMeetingDates = this.calendarTemplate.nextTenRecurringDates;
@@ -66,8 +67,14 @@ export class EditCenterMeetingScheduleComponent implements OnInit {
*/
createEditMeetingScheduleForm() {
this.centerEditMeetingScheduleForm = this.formBuilder.group({
'presentMeetingDate': ['', Validators.required],
'newMeetingDate': ['', Validators.required]
presentMeetingDate: [
'',
Validators.required
],
newMeetingDate: [
'',
Validators.required
]
});
}
@@ -97,5 +104,4 @@ export class EditCenterMeetingScheduleComponent implements OnInit {
this.router.navigate(['../../'], { relativeTo: this.route });
});
}
}
@@ -8,9 +8,8 @@ describe('EditCenterMeetingComponent', () => {
beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [ EditCenterMeetingComponent ]
})
.compileComponents();
declarations: [EditCenterMeetingComponent]
}).compileComponents();
}));
beforeEach(() => {
@@ -17,7 +17,6 @@ import { SettingsService } from 'app/settings/settings.service';
styleUrls: ['./edit-center-meeting.component.scss']
})
export class EditCenterMeetingComponent implements OnInit {
/** Minimum date allowed. */
minDate = new Date(2000, 0, 1);
/** Maximum date allowed. */
@@ -46,12 +45,14 @@ export class EditCenterMeetingComponent implements OnInit {
* @param {ActivatedRoute} route Activated Route
* @param {Router} router Router
*/
constructor(private formBuilder: UntypedFormBuilder,
private centersService: CentersService,
private settingsService: SettingsService,
private dateUtils: Dates,
private route: ActivatedRoute,
private router: Router) {
constructor(
private formBuilder: UntypedFormBuilder,
private centersService: CentersService,
private settingsService: SettingsService,
private dateUtils: Dates,
private route: ActivatedRoute,
private router: Router
) {
this.route.data.subscribe((data: { centersActionData: any }) => {
this.calendarTemplate = data.centersActionData;
this.frequencyOptions = this.calendarTemplate.frequencyOptions;
@@ -72,9 +73,18 @@ export class EditCenterMeetingComponent implements OnInit {
*/
createEditCenterMeetingForm() {
this.centerEditMeetingForm = 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 EditCenterMeetingComponent implements OnInit {
this.centerEditMeetingForm.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.centerEditMeetingForm.addControl('repeatsOnDay', new UntypedFormControl('', Validators.required));
this.centerEditMeetingForm.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.centerEditMeetingForm.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 EditCenterMeetingComponent implements OnInit {
this.router.navigate(['../../'], { relativeTo: this.route });
});
}
}
@@ -8,9 +8,8 @@ describe('ManageGroupsComponent', () => {
beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [ ManageGroupsComponent ]
})
.compileComponents();
declarations: [ManageGroupsComponent]
}).compileComponents();
}));
beforeEach(() => {
@@ -11,14 +11,12 @@ import { CentersService } from 'app/centers/centers.service';
import { GroupsService } from 'app/groups/groups.service';
import { MatDialog } from '@angular/material/dialog';
@Component({
selector: 'mifosx-manage-groups',
templateUrl: './manage-groups.component.html',
styleUrls: ['./manage-groups.component.scss']
})
export class ManageGroupsComponent implements AfterViewInit {
/** Center Data */
centerData: any;
/** Group data. */
@@ -35,24 +33,26 @@ export class ManageGroupsComponent implements AfterViewInit {
* @param {GroupsService} groupsService Groups Service
* @param {MatDialog} dialog Mat Dialog
*/
constructor(private route: ActivatedRoute,
private centersService: CentersService,
private groupsService: GroupsService,
public dialog: MatDialog) {
constructor(
private route: ActivatedRoute,
private centersService: CentersService,
private groupsService: GroupsService,
public dialog: MatDialog
) {
this.route.data.subscribe((data: { centersActionData: any }) => {
this.centerData = data.centersActionData;
this.groupMembers = data.centersActionData.groupMembers;
});
}
/**
* Subscribes to Groups search filter:
*/
ngAfterViewInit() {
this.groupChoice.valueChanges.subscribe( (value: string) => {
this.groupChoice.valueChanges.subscribe((value: string) => {
if (value.length >= 2) {
this.groupsService.getFilteredGroups('name', 'ASC', value, this.centerData.officeId, 'true')
this.groupsService
.getFilteredGroups('name', 'ASC', value, this.centerData.officeId, 'true')
.subscribe((data: any) => {
this.groupsData = data;
});
@@ -66,12 +66,22 @@ export class ManageGroupsComponent implements AfterViewInit {
addGroup() {
if (this.groupMembers !== null && this.groupMembers !== undefined) {
if (!this.groupMembers.includes(this.groupChoice.value)) {
this.centersService.executeCenterActionCommand(this.centerData.id, 'associateGroups', {groupMembers: [this.groupChoice.value.id]})
.subscribe(() => { this.groupMembers.push(this.groupChoice.value); });
this.centersService
.executeCenterActionCommand(this.centerData.id, 'associateGroups', {
groupMembers: [this.groupChoice.value.id]
})
.subscribe(() => {
this.groupMembers.push(this.groupChoice.value);
});
}
} else {
this.centersService.executeCenterActionCommand(this.centerData.id, 'associateGroups', {groupMembers: [this.groupChoice.value.id]})
.subscribe(() => { this.groupMembers.push(this.groupChoice.value); });
this.centersService
.executeCenterActionCommand(this.centerData.id, 'associateGroups', {
groupMembers: [this.groupChoice.value.id]
})
.subscribe(() => {
this.groupMembers.push(this.groupChoice.value);
});
}
}
@@ -85,8 +95,11 @@ export class ManageGroupsComponent implements AfterViewInit {
});
removeMemberDialogRef.afterClosed().subscribe((response: any) => {
if (response.delete) {
this.centersService.executeCenterActionCommand(this.centerData.id, 'disassociateGroups', {groupMembers: [group.id]})
.subscribe(() => { this.groupMembers.splice(index, 1); });
this.centersService
.executeCenterActionCommand(this.centerData.id, 'disassociateGroups', { groupMembers: [group.id] })
.subscribe(() => {
this.groupMembers.splice(index, 1);
});
}
});
}
@@ -99,5 +112,4 @@ export class ManageGroupsComponent implements AfterViewInit {
displayGroup(group: any): string | undefined {
return group ? group.name : undefined;
}
}
@@ -8,9 +8,8 @@ describe('StaffAssignmentHistoryComponent', () => {
beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [ StaffAssignmentHistoryComponent ]
})
.compileComponents();
declarations: [StaffAssignmentHistoryComponent]
}).compileComponents();
}));
beforeEach(() => {
@@ -15,7 +15,6 @@ import { CentersService } from '../../../centers.service';
styleUrls: ['./staff-assignment-history.component.scss']
})
export class StaffAssignmentHistoryComponent implements OnInit {
/** Staff Assignment History Data */
staffAssignmentHistoryData: any;
/** trusted resource url for pentaho output */
@@ -24,8 +23,10 @@ export class StaffAssignmentHistoryComponent implements OnInit {
/**
* @param {DomSanitizer} sanitizer DOM Sanitizer
*/
constructor(private sanitizer: DomSanitizer,
private route: ActivatedRoute) {
constructor(
private sanitizer: DomSanitizer,
private route: ActivatedRoute
) {
this.route.data.subscribe((data: { centersActionData: any }) => {
this.staffAssignmentHistoryData = data.centersActionData;
});
@@ -37,5 +38,4 @@ export class StaffAssignmentHistoryComponent implements OnInit {
const filecontent = URL.createObjectURL(file);
this.pentahoUrl = this.sanitizer.bypassSecurityTrustResourceUrl(filecontent);
}
}
@@ -8,9 +8,8 @@ describe('CentersViewComponent', () => {
beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [ CentersViewComponent ]
})
.compileComponents();
declarations: [CentersViewComponent]
}).compileComponents();
}));
beforeEach(() => {
@@ -19,7 +19,6 @@ import { TranslateService } from '@ngx-translate/core';
styleUrls: ['./centers-view.component.scss']
})
export class CentersViewComponent implements OnInit {
/** Stores Center View Data */
centerViewData: any;
/** Center datatable */
@@ -31,15 +30,14 @@ export class CentersViewComponent implements OnInit {
* Retrieves the data for center
* @param route route Activated Route.
*/
constructor(private route: ActivatedRoute,
constructor(
private route: ActivatedRoute,
private router: Router,
public dialog: MatDialog,
public centersService: CentersService,
private translateService: TranslateService) {
this.route.data.subscribe((data: {
centerViewData: any,
centerDatatables: any
}) => {
private translateService: TranslateService
) {
this.route.data.subscribe((data: { centerViewData: any; centerDatatables: any }) => {
this.centerViewData = data.centerViewData;
this.centerDatatables = data.centerDatatables;
});
@@ -48,7 +46,9 @@ export class CentersViewComponent implements OnInit {
ngOnInit() {
if (this.centerViewData.collectionMeetingCalendar) {
this.meetingData = true;
} else { this.meetingData = false; }
} else {
this.meetingData = false;
}
}
/**
@@ -99,11 +99,15 @@ export class CentersViewComponent implements OnInit {
*/
private centersUnassignStaff() {
const unAssignStaffDialogRef = this.dialog.open(ConfirmationDialogComponent, {
data: { heading: this.translateService.instant('labels.heading.Unassign Staff'), dialogContext: this.translateService.instant('labels.dialogContext.Are you sure you want Unassign Staff') }
data: {
heading: this.translateService.instant('labels.heading.Unassign Staff'),
dialogContext: this.translateService.instant('labels.dialogContext.Are you sure you want Unassign Staff')
}
});
unAssignStaffDialogRef.afterClosed().subscribe((response: { confirm: any }) => {
if (response.confirm) {
this.centersService.executeGroupActionCommand(this.centerViewData.id, 'unassignStaff', { staffId: this.centerViewData.staffId })
this.centersService
.executeGroupActionCommand(this.centerViewData.id, 'unassignStaff', { staffId: this.centerViewData.staffId })
.subscribe(() => {
this.reload();
});
@@ -133,8 +137,6 @@ export class CentersViewComponent implements OnInit {
*/
reload() {
const url: string = this.router.url;
this.router.navigateByUrl(`/centers`, { skipLocationChange: true })
.then(() => this.router.navigate([url]));
this.router.navigateByUrl(`/centers`, { skipLocationChange: true }).then(() => this.router.navigate([url]));
}
}
@@ -8,9 +8,8 @@ describe('DatatableTabComponent', () => {
beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [ DatatableTabComponent ]
})
.compileComponents();
declarations: [DatatableTabComponent]
}).compileComponents();
}));
beforeEach(() => {
@@ -25,5 +25,4 @@ export class DatatableTabComponent {
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,11 +11,20 @@ import { ActivatedRoute } from '@angular/router';
styleUrls: ['./general-tab.component.scss']
})
export class GeneralTabComponent {
/** Savings Account Table Columns */
savingsAccountColumns: string[] = ['Account No', 'Products', 'Balance', 'Actions'];
savingsAccountColumns: string[] = [
'Account No',
'Products',
'Balance',
'Actions'
];
/** Groups Table Columns */
groupsColumns: string[] = ['Account No', 'Group Name', 'Office Name', 'Submitted On'];
groupsColumns: string[] = [
'Account No',
'Group Name',
'Office Name',
'Submitted On'
];
/** Stores the summary of center */
centerSummaryData: any;
/** Stores Center Data for particular center */
@@ -30,11 +39,7 @@ export class GeneralTabComponent {
* @param {ActivatedRoute} route Activated Route.
*/
constructor(private route: ActivatedRoute) {
this.route.data.subscribe((data: {
centerSummaryData: any,
centerViewData: any,
savingsAccountData: any
}) => {
this.route.data.subscribe((data: { centerSummaryData: any; centerViewData: any; savingsAccountData: any }) => {
this.centerSummaryData = data.centerSummaryData[0];
this.centerViewData = data.centerViewData;
this.savingsAccountData = data.savingsAccountData.savingsAccounts;
@@ -49,5 +54,4 @@ export class GeneralTabComponent {
routeEdit($event: MouseEvent) {
$event.stopPropagation();
}
}
@@ -8,9 +8,8 @@ describe('NotesTabComponent', () => {
beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [ NotesTabComponent ]
})
.compileComponents();
declarations: [NotesTabComponent]
}).compileComponents();
}));
beforeEach(() => {
@@ -24,13 +24,14 @@ export class NotesTabComponent implements OnInit {
noteForm: UntypedFormGroup;
@ViewChild('formRef', { static: true }) formRef: any;
constructor(private route: ActivatedRoute,
constructor(
private route: ActivatedRoute,
private formBuilder: UntypedFormBuilder,
private centersService: CentersService,
private authenticationService: AuthenticationService,
private dialog: MatDialog,
private translateService: TranslateService) {
private translateService: TranslateService
) {
const savedCredentials = this.authenticationService.getCredentials();
this.username = savedCredentials.username;
this.centerId = this.route.parent.snapshot.params['centerId'];
@@ -45,7 +46,10 @@ export class NotesTabComponent implements OnInit {
createNoteForm() {
this.noteForm = this.formBuilder.group({
'note': ['', Validators.required]
note: [
'',
Validators.required
]
});
}
@@ -63,19 +67,22 @@ export class NotesTabComponent implements OnInit {
editNote(noteId: string, noteContent: string, index: number) {
const editNoteDialogRef = this.dialog.open(FormDialogComponent, {
data: { formfields: [{
controlName: 'note',
required: true,
value: noteContent,
controlType: 'input',
label: this.translateService.instant('labels.inputs.Note')
}],
layout: {
columns: 1,
addButtonText: 'Confirm'
},
title: this.translateService.instant('labels.heading.Edit Note')
}
data: {
formfields: [
{
controlName: 'note',
required: true,
value: noteContent,
controlType: 'input',
label: this.translateService.instant('labels.inputs.Note')
}
],
layout: {
columns: 1,
addButtonText: 'Confirm'
},
title: this.translateService.instant('labels.heading.Edit Note')
}
});
editNoteDialogRef.afterClosed().subscribe((response: any) => {
if (response.data) {
@@ -88,14 +95,15 @@ export class NotesTabComponent implements OnInit {
deleteNote(noteId: string, index: number) {
const deleteNoteDialogRef = this.dialog.open(DeleteDialogComponent, {
data: { deleteContext: `${this.translateService.instant('labels.inputs.Note')} ${this.translateService.instant('labels.inputs.Id')}:${noteId}` }
data: {
deleteContext: `${this.translateService.instant('labels.inputs.Note')} ${this.translateService.instant('labels.inputs.Id')}:${noteId}`
}
});
deleteNoteDialogRef.afterClosed().subscribe((response: any) => {
if (response.delete) {
this.centersService.deleteCenterNote(this.centerId, noteId)
.subscribe(() => {
this.centerNotes.splice(index, 1);
});
this.centersService.deleteCenterNote(this.centerId, noteId).subscribe(() => {
this.centerNotes.splice(index, 1);
});
}
});
}