Skip to content

Commit

Permalink
Feature: enable/disable manual time settings for employees
Browse files Browse the repository at this point in the history
  • Loading branch information
samuelmbabhazi committed Oct 23, 2024
1 parent b73f18f commit 79c3970
Show file tree
Hide file tree
Showing 4 changed files with 163 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,11 @@ <h4 class="settings-section-header">
{{ 'EMPLOYEES_PAGE.EDIT_EMPLOYEE.GENERAL_SETTINGS' | translate }}
</li>
</span>
<span (click)="timer.toggle()">
<li [ngClass]="{ active: timer?.expanded }">
{{ 'ORGANIZATIONS_PAGE.EDIT.SETTINGS.TIMER_SETTINGS' | translate }}
</li>
</span>
<span (click)="integrations.toggle()">
<li [ngClass]="{ active: integrations?.expanded }">
{{ 'EMPLOYEES_PAGE.EDIT_EMPLOYEE.INTEGRATIONS' | translate }}
Expand Down Expand Up @@ -49,6 +54,112 @@ <h4 class="settings-section-header">
</div>
</nb-accordion-item-body>
</nb-accordion-item>
<nb-accordion-item #timer>
<nb-accordion-item-header>
{{ 'ORGANIZATIONS_PAGE.EDIT.SETTINGS.TIMER_SETTINGS' | translate }}
</nb-accordion-item-header>
<nb-accordion-item-body>
<div class="fields time-tracker">
<div class="row">
<div class="col-xl-6 col-12 pt-2">
<div class="form-group invite-toggle">
<nb-toggle
class="d-block"
formControlName="allowManualTime"
status="primary"
labelPosition="start"
>
{{ 'ORGANIZATIONS_PAGE.EDIT.SETTINGS.ALLOW_MANUAL_TIME' | translate }}
<button
[nbTooltip]="
'ORGANIZATIONS_PAGE.EDIT.SETTINGS.TOOLTIP.ALLOW_MANUAL_TIME_INFO'
| translate
"
ghost
nbButton
size="small"
status="info"
>
<nb-icon icon="info"></nb-icon>
</button>
</nb-toggle>
</div>
</div>
<div class="col-xl-6 col-12 pt-2">
<div class="form-group invite-toggle">
<nb-toggle
class="d-block"
formControlName="allowModifyTime"
status="primary"
labelPosition="start"
>
{{ 'ORGANIZATIONS_PAGE.EDIT.SETTINGS.ALLOW_MODIFY_TIME' | translate }}
<button
[nbTooltip]="
'ORGANIZATIONS_PAGE.EDIT.SETTINGS.TOOLTIP.ALLOW_MODIFY_TIME_INFO'
| translate
"
ghost
nbButton
size="small"
status="info"
>
<nb-icon icon="info"></nb-icon>
</button>
</nb-toggle>
</div>
</div>
<div class="col-xl-6 col-12 pt-2">
<div class="form-group invite-toggle">
<nb-toggle
class="d-block"
formControlName="allowDeleteTime"
labelPosition="start"
status="primary"
>
{{ 'ORGANIZATIONS_PAGE.EDIT.SETTINGS.ALLOW_DELETE_TIME' | translate }}
<button
[nbTooltip]="
'ORGANIZATIONS_PAGE.EDIT.SETTINGS.TOOLTIP.ALLOW_DELETE_TIME_INFO'
| translate
"
ghost
nbButton
size="small"
status="info"
>
<nb-icon icon="info"></nb-icon>
</button>
</nb-toggle>
</div>
</div>

<div class="col-xl-6 col-12 pt-2 form-group invite-toggle">
<nb-toggle
class="d-block"
formControlName="allowScreenshotCapture"
status="primary"
labelPosition="start"
>
{{ 'ORGANIZATIONS_PAGE.EDIT.SETTINGS.ALLOW_SCREEN_CAPTURE' | translate }}
<button
[nbTooltip]="
'ORGANIZATIONS_PAGE.EDIT.SETTINGS.ALLOW_SCREEN_CAPTURE_INFO' | translate
"
ghost
nbButton
size="small"
status="info"
class="p-0"
>
<nb-icon icon="info"></nb-icon>
</button>
</nb-toggle>
</div>
</div>
</div>
</nb-accordion-item-body>
</nb-accordion-item>
<nb-accordion-item #integrations>
<nb-accordion-item-header>
{{ 'EMPLOYEES_PAGE.EDIT_EMPLOYEE.INTEGRATIONS' | translate }}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -303,3 +303,22 @@ nb-accordion {
width: 100%;
}
}
:host ::ng-deep nb-toggle {
padding: 10px;
border: 1px solid nb-theme(gauzy-border-default-color);
border-radius: nb-theme(border-radius);
& > label {
margin-bottom: 0;
}
}
:host ::ng-deep .toggle {
border: 1px solid #7e7e8f !important;
background-color: #7e7e8f !important;
&.checked {
background-color: nb-theme(text-primary-color) !important;
border: 1px solid nb-theme(text-primary-color) !important;
& + span {
color: nb-theme(text-primary-color);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ export class EditEmployeeOtherSettingsComponent implements OnInit, OnDestroy {
*/
@ViewChild('general') general: NbAccordionItemComponent;
@ViewChild('integrations') integrations: NbAccordionItemComponent;
@ViewChild('timer') timer: NbAccordionItemComponent;

/**
* Employee other settings settings
Expand All @@ -42,7 +43,11 @@ export class EditEmployeeOtherSettingsComponent implements OnInit, OnDestroy {
timeZone: [],
timeFormat: [],
upworkId: [],
linkedInId: []
linkedInId: [],
allowManualTime: [],
allowModifyTime: [],
allowDeleteTime: [],
allowScreenshotCapture: []
});
}

Expand Down Expand Up @@ -82,7 +87,11 @@ export class EditEmployeeOtherSettingsComponent implements OnInit, OnDestroy {
timeZone: user.timeZone || moment.tz.guess(), // set current timezone, if employee don't have any timezone
timeFormat: user.timeFormat,
upworkId: employee.upworkId,
linkedInId: employee.linkedInId
linkedInId: employee.linkedInId,
allowManualTime: employee.allowManualTime,
allowDeleteTime: employee.allowDeleteTime,
allowModifyTime: employee.allowModifyTime,
allowScreenshotCapture: employee.allowScreenshotCapture
});
this.form.updateValueAndValidity();
}
Expand All @@ -97,7 +106,16 @@ export class EditEmployeeOtherSettingsComponent implements OnInit, OnDestroy {
return;
}
const { organizationId, tenantId } = this.selectedEmployee;
const { timeZone, timeFormat, upworkId, linkedInId } = this.form.value;
const {
timeZone,
timeFormat,
upworkId,
linkedInId,
allowScreenshotCapture,
allowManualTime,
allowModifyTime,
allowDeleteTime
} = this.form.value;

/** Update user fields */
this.employeeStore.userForm = {
Expand All @@ -110,7 +128,11 @@ export class EditEmployeeOtherSettingsComponent implements OnInit, OnDestroy {
upworkId,
linkedInId,
organizationId,
tenantId
tenantId,
allowManualTime,
allowModifyTime,
allowDeleteTime,
allowScreenshotCapture
};
}

Expand Down
10 changes: 7 additions & 3 deletions packages/contracts/src/employee.model.ts
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,10 @@ export interface IEmployee extends IBasePerTenantAndOrganizationEntityModel, ITa
isTrackingEnabled: boolean;
isDeleted?: boolean;
allowScreenshotCapture?: boolean;
allowManualTime?: boolean;
allowModifyTime?: boolean;
allowDeleteTime?: boolean;

/** Upwork ID For Gauzy AI*/
upworkId?: string;
/** LinkedIn ID For Gauzy AI*/
Expand All @@ -123,9 +127,6 @@ export interface IEmployee extends IBasePerTenantAndOrganizationEntityModel, ITa
isTrackingTime?: boolean;
// True mean active, false away
isAway?: boolean;
allowManualTime?: boolean;
allowModifyTime?: boolean;
allowDeleteTime?: boolean;
}

export type IEmployeeJobsStatisticsResponse = IEmployee & IEmployeeJobsStatistics;
Expand Down Expand Up @@ -179,6 +180,9 @@ export interface IEmployeeUpdateInput extends IBasePerTenantAndOrganizationEntit
upworkUrl?: string;
profile_link?: string;
allowScreenshotCapture?: boolean;
allowManualTime?: boolean;
allowModifyTime?: boolean;
allowDeleteTime?: boolean;
/** Upwork ID For Gauzy AI*/
upworkId?: string;
/** LinkedIn ID For Gauzy AI*/
Expand Down

0 comments on commit 79c3970

Please sign in to comment.