Skip to content
This repository was archived by the owner on Feb 24, 2026. It is now read-only.

Commit 9c6ef90

Browse files
authored
GZY-424: Add supporting employment type filters across main views of the system (#100)
* feat: add supporting employment type filters across main views of the system * feat: add styles to filter employment type component
1 parent f298fa1 commit 9c6ef90

28 files changed

Lines changed: 358 additions & 77 deletions

File tree

apps/gauzy/src/app/pages/employees/employees.component.ts

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,8 @@ import {
2424
EmployeeViewModel,
2525
CrudActionEnum,
2626
IEmployee,
27-
ITag,
28-
PermissionsEnum
27+
PermissionsEnum,
28+
IOrganizationEmploymentType
2929
} from '@gauzy/contracts';
3030
import { API_PREFIX, ComponentEnum, distinctUntilChange } from '@gauzy/ui-core/common';
3131
import {
@@ -36,12 +36,12 @@ import {
3636
EmployeeEndWorkComponent,
3737
EmployeeMutationComponent,
3838
EmployeeStartWorkComponent,
39+
EmploymentTypeComponent,
40+
EmploymentTypeFilterComponent,
3941
InputFilterComponent,
4042
InviteMutationComponent,
4143
PaginationFilterBaseComponent,
4244
PictureNameTagsComponent,
43-
TagsColorFilterComponent,
44-
TagsOnlyComponent,
4545
ToggleFilterComponent
4646
} from '@gauzy/ui-core/shared';
4747
import { EmployeeTimeTrackingStatusComponent, EmployeeWorkStatusComponent } from './table-components';
@@ -547,7 +547,7 @@ export class EmployeesComponent extends PaginationFilterBaseComponent implements
547547

548548
this.smartTableSource = new ServerDataSource(this._httpClient, {
549549
endPoint: `${API_PREFIX}/employee/pagination`,
550-
relations: ['user', 'tags'],
550+
relations: ['user', 'tags', 'organizationEmploymentTypes'],
551551
withDeleted: this.includeDeleted, // Include soft-deleted records if flag is true
552552
where: {
553553
organizationId,
@@ -621,7 +621,7 @@ export class EmployeesComponent extends PaginationFilterBaseComponent implements
621621
user = {},
622622
isActive,
623623
endWork,
624-
tags,
624+
organizationEmploymentTypes,
625625
// Hidden from the table according to the task https://trello.com/c/78ttN8d4/409-remove-average-income-expenses-and-bonus-columns-from-table
626626
/*averageIncome = 0,
627627
averageExpenses = 0,
@@ -647,7 +647,7 @@ export class EmployeesComponent extends PaginationFilterBaseComponent implements
647647
endWork: endWork ? new Date(endWork) : '',
648648
workStatus: endWork ? workStatus : '',
649649
imageUrl: imageUrl || '',
650-
tags: tags || [],
650+
organizationEmploymentTypes: organizationEmploymentTypes || [],
651651
bonus: this.bonusForSelectedMonth, // TODO: load real bonus and bonusDate
652652
// Hidden from the table according to the task https://trello.com/c/78ttN8d4/409-remove-average-income-expenses-and-bonus-columns-from-table
653653
//averageIncome: Math.floor(averageIncome),
@@ -772,24 +772,24 @@ export class EmployeesComponent extends PaginationFilterBaseComponent implements
772772
},
773773
{
774774
dataTableId: this.dataTableId,
775-
columnId: 'tags',
775+
columnId: 'organizationEmploymentTypes',
776776
order: 3,
777-
title: () => this.getTranslation('SM_TABLE.TAGS'),
777+
title: () => this.getTranslation('EMPLOYEES_PAGE.EDIT_EMPLOYEE.EMPLOYMENT_TYPE'),
778778
type: 'custom',
779-
width: '20%',
779+
width: '15%',
780780
isFilterable: true,
781781
isSortable: false,
782782
filter: {
783783
type: 'custom',
784-
component: TagsColorFilterComponent
784+
component: EmploymentTypeFilterComponent
785785
},
786-
filterFunction: (tags: ITag[]) => {
787-
const tagIds = tags.map((tag) => tag.id);
788-
this.setFilter({ field: 'tags', search: tagIds });
789-
return tags.length > 0;
786+
filterFunction: (employmentTypes: IOrganizationEmploymentType[]) => {
787+
const typeIds = employmentTypes.map((t) => t.id);
788+
this.setFilter({ field: 'organizationEmploymentTypes', search: typeIds });
789+
return true;
790790
},
791-
renderComponent: TagsOnlyComponent,
792-
componentInitFunction: (instance: TagsOnlyComponent, cell: Cell) => {
791+
renderComponent: EmploymentTypeComponent,
792+
componentInitFunction: (instance: EmploymentTypeComponent, cell: Cell) => {
793793
instance.rowData = cell.getRow().getData();
794794
instance.value = cell.getValue();
795795
}

apps/gauzy/src/app/pages/employees/timesheet/calendar/calendar/calendar.component.html

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
</div>
2020
<ngx-gauzy-filters
2121
[isTimeFormat]="true"
22+
[hasEmploymentTypes]="true"
2223
[filters]="filters"
2324
[saveFilters]="(datePickerConfig$ | async).isSaveDatePicker"
2425
(filtersChange)="filtersChange($event)"

apps/gauzy/src/app/pages/employees/timesheet/calendar/calendar/calendar.component.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -255,7 +255,7 @@ export class CalendarComponent extends BaseSelectorFilterComponent implements On
255255
const timeZone = this.timeZoneService.currentTimeZone;
256256
const startDate = moment(arg.start).startOf('day').format('YYYY-MM-DD HH:mm:ss');
257257
const endDate = moment(arg.end).subtract(1, 'days').endOf('day').format('YYYY-MM-DD HH:mm:ss');
258-
const appliedFilter = pick(this.filters, 'source', 'activityLevel', 'logType');
258+
const appliedFilter = pick(this.filters, 'source', 'employmentTypes', 'activityLevel', 'logType');
259259
const request: IGetTimeLogInput = {
260260
...appliedFilter,
261261
...this.getFilterRequest({ startDate, endDate })
@@ -267,7 +267,8 @@ export class CalendarComponent extends BaseSelectorFilterComponent implements On
267267
'project',
268268
'task',
269269
'organizationContact',
270-
'employee.user'
270+
'employee.user',
271+
'employee.organizationEmploymentTypes'
271272
]);
272273
timeLogs$.then((logs: ITimeLog[]) => {
273274
const events = logs.map((log: ITimeLog): EventInput => {

apps/gauzy/src/app/pages/employees/timesheet/daily/daily/daily.component.html

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
<ngx-gauzy-filters
1818
[isTimeFormat]="true"
1919
[hasWorkedPerDay]="true"
20+
[hasEmploymentTypes]="true"
2021
[saveFilters]="(datePickerConfig$ | async).isSaveDatePicker"
2122
(filtersChange)="filtersChange($event)"
2223
></ngx-gauzy-filters>

apps/gauzy/src/app/pages/employees/timesheet/daily/daily/daily.component.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@ import {
2626
ITimeLog,
2727
PermissionsEnum,
2828
ITimeLogFilters,
29-
TimeLogSourceEnum,
3029
TimeLogPartialStatus,
3130
IDeleteTimeLogData,
3231
IDateRangePicker,
@@ -293,7 +292,8 @@ export class DailyComponent extends BaseSelectorFilterComponent implements After
293292
'project',
294293
'task',
295294
'organizationContact',
296-
'employee.user'
295+
'employee.user',
296+
'employee.organizationEmploymentTypes'
297297
])
298298
).pipe(
299299
// Handle errors gracefully and return empty result
@@ -381,7 +381,7 @@ export class DailyComponent extends BaseSelectorFilterComponent implements After
381381
}
382382

383383
// Pick specific properties from filters
384-
const appliedFilter = pick(this.filters, 'source', 'activityLevel', 'logType');
384+
const appliedFilter = pick(this.filters, 'source', 'employmentTypes', 'activityLevel', 'logType');
385385

386386
// Create a request object by combining appliedFilter and processed request
387387
const request: IGetTimeLogInput = {

apps/gauzy/src/app/pages/employees/timesheet/weekly/weekly/weekly.component.html

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
<ngx-gauzy-filters
2121
[saveFilters]="(datePickerConfig$ | async).isSaveDatePicker"
2222
[hasWorkedPerWeek]="true"
23+
[hasEmploymentTypes]="true"
2324
(filtersChange)="filtersChange($event)"
2425
></ngx-gauzy-filters>
2526
</div>

apps/gauzy/src/app/pages/employees/timesheet/weekly/weekly/weekly.component.ts

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -206,7 +206,7 @@ export class WeeklyComponent extends BaseSelectorFilterComponent implements OnIn
206206
if (isEmpty(this.request) || isEmpty(this.filters)) {
207207
return; // Early return to avoid further processing
208208
}
209-
const appliedFilter = pick(this.filters, 'source', 'activityLevel', 'logType');
209+
const appliedFilter = pick(this.filters, 'source', 'employmentTypes', 'activityLevel', 'logType');
210210
const request: IGetTimeLogInput = {
211211
...appliedFilter,
212212
...this.getFilterRequest(this.request)
@@ -229,7 +229,12 @@ export class WeeklyComponent extends BaseSelectorFilterComponent implements OnIn
229229

230230
this.loading = true;
231231
try {
232-
const logs = await this.timesheetService.getTimeLogsChunk(payloads, ['project', 'employee.user', 'task']);
232+
const logs = await this.timesheetService.getTimeLogsChunk(payloads, [
233+
'project',
234+
'employee.user',
235+
'task',
236+
'employee.organizationEmploymentTypes'
237+
]);
233238

234239
this.weekData = chain(logs)
235240
.groupBy('projectId')

apps/gauzy/src/app/pages/reports/time-reports/time-reports/time-reports.component.html

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ <h4>
2020
<div class="col-auto ml-auto">
2121
<ngx-gauzy-filters
2222
[filters]="filters"
23+
[hasEmploymentTypes]="true"
2324
[saveFilters]="(datePickerConfig$ | async).isSaveDatePicker"
2425
(filtersChange)="filtersChange($event)"
2526
></ngx-gauzy-filters>

apps/gauzy/src/app/pages/reports/time-reports/time-reports/time-reports.component.ts

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { AfterViewInit, ChangeDetectorRef, Component, OnDestroy, OnInit, ViewChild } from '@angular/core';
1+
import { AfterViewInit, ChangeDetectorRef, Component, OnInit, ViewChild } from '@angular/core';
22
import { BehaviorSubject, Observable } from 'rxjs';
33
import { filter, tap } from 'rxjs/operators';
44
import { UntilDestroy, untilDestroyed } from '@ngneat/until-destroy';
@@ -23,14 +23,14 @@ import {
2323

2424
@UntilDestroy({ checkProperties: true })
2525
@Component({
26-
selector: 'ga-time-reports',
27-
templateUrl: './time-reports.component.html',
28-
styleUrls: ['./time-reports.component.scss'],
29-
standalone: false
26+
selector: 'ga-time-reports',
27+
templateUrl: './time-reports.component.html',
28+
styleUrls: ['./time-reports.component.scss'],
29+
standalone: false
3030
})
31-
export class TimeReportsComponent extends BaseSelectorFilterComponent implements OnInit, AfterViewInit, OnDestroy {
31+
export class TimeReportsComponent extends BaseSelectorFilterComponent implements OnInit, AfterViewInit {
3232
public filters: ITimeLogFilters;
33-
public loading: boolean = false;
33+
public loading = false;
3434
public charts: IChartData;
3535
public groupBy: ReportGroupByFilter = ReportGroupFilterEnum.date;
3636
public datePickerConfig$: Observable<any> = this.dateRangePickerBuilderService.datePickerConfig$;
@@ -103,8 +103,8 @@ export class TimeReportsComponent extends BaseSelectorFilterComponent implements
103103
if (isEmpty(this.request) || isEmpty(this.filters)) {
104104
return;
105105
}
106-
// Pick specific properties ('source', 'activityLevel', 'logType') from this.filters
107-
const appliedFilter = pick(this.filters, 'source', 'activityLevel', 'logType');
106+
// Pick specific properties ('source', 'employmentTypes', 'activityLevel', 'logType') from this.filters
107+
const appliedFilter = pick(this.filters, 'source', 'employmentTypes', 'activityLevel', 'logType');
108108

109109
// Create a request object of type IGetTimeLogReportInput
110110
const request: IGetTimeLogReportInput = {
@@ -187,6 +187,4 @@ export class TimeReportsComponent extends BaseSelectorFilterComponent implements
187187
this.loading = false;
188188
}
189189
}
190-
191-
ngOnDestroy(): void {}
192190
}

apps/gauzy/src/app/pages/reports/weekly-time-reports/weekly-time-reports/weekly-time-reports.component.html

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ <h4>
2020
<div class="col-auto ml-auto">
2121
<ngx-gauzy-filters
2222
[filters]="filters"
23+
[hasEmploymentTypes]="true"
2324
[saveFilters]="(datePickerConfig$ | async).isSaveDatePicker"
2425
(filtersChange)="filtersChange($event)"
2526
></ngx-gauzy-filters>

0 commit comments

Comments
 (0)