Skip to content

Commit f70d4a3

Browse files
Copilotrenemadsen
andcommitted
Fix duplicate ngOnInit in working-hours-table component
Co-authored-by: renemadsen <[email protected]>
1 parent e5a7f29 commit f70d4a3

File tree

1 file changed

+19
-18
lines changed

1 file changed

+19
-18
lines changed

eform-client/src/app/plugins/modules/time-planning-pn/modules/working-hours/components/working-hours-table/working-hours-table.component.ts

Lines changed: 19 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -78,30 +78,15 @@ export class WorkingHoursTableComponent implements OnInit, OnChanges, OnDestroy
7878

7979

8080

81-
constructor() {
81+
ngOnInit(): void {
8282
this.selectCurrentUserLocaleSub$ = this.selectCurrentUserLocale$.subscribe(() => this.messages = messages(this.translateService));
8383
this.selectCurrentUserIsFirstUserSub$ = this.selectCurrentUserIsFirstUser$.subscribe((data) => {
8484
this.isFirstUser = data;
8585
});
86+
this.updateTableHeaders();
8687
}
8788

88-
getIsWeekend(workingHoursModel: AbstractControl): boolean {
89-
if (workingHoursModel != null) {
90-
return workingHoursModel.get('isWeekend').value;
91-
}
92-
}
93-
94-
getIsLocked(workingHoursModel: AbstractControl): boolean {
95-
if (workingHoursModel != null) {
96-
return workingHoursModel.disabled;
97-
}
98-
}
99-
100-
get hoursPickerArray() {
101-
return HOURS_PICKER_ARRAY;
102-
}
103-
104-
ngOnInit(): void {
89+
updateTableHeaders(): void {
10590
this.tableHeaders = this.isFirstUser ? [
10691
{
10792
header: this.translateService.stream('Id'),
@@ -187,6 +172,22 @@ export class WorkingHoursTableComponent implements OnInit, OnChanges, OnDestroy
187172
];
188173
}
189174

175+
getIsWeekend(workingHoursModel: AbstractControl): boolean {
176+
if (workingHoursModel != null) {
177+
return workingHoursModel.get('isWeekend').value;
178+
}
179+
}
180+
181+
getIsLocked(workingHoursModel: AbstractControl): boolean {
182+
if (workingHoursModel != null) {
183+
return workingHoursModel.disabled;
184+
}
185+
}
186+
187+
get hoursPickerArray() {
188+
return HOURS_PICKER_ARRAY;
189+
}
190+
190191
rowClassFormatter: MtxGridRowClassFormatter = {
191192
'background-powder': (data: FormControl, index) => data.get('isLocked').value === true,
192193
'background-yellow': (data: FormControl, index) => data.get('isWeekend').value === true,

0 commit comments

Comments
 (0)