Skip to content

Commit

Permalink
Merge pull request #8475 from ever-co/feature/#5507-enable-add-manual…
Browse files Browse the repository at this point in the history
…-time

[Feature] enable/disable manual time settings for employees
  • Loading branch information
rahul-rocket authored Oct 25, 2024
2 parents c6c0984 + 367e008 commit 96c1715
Show file tree
Hide file tree
Showing 10 changed files with 408 additions and 28 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
@@ -1,6 +1,6 @@
import { Component, OnInit, OnDestroy, ChangeDetectorRef, ViewChild } from '@angular/core';
import { UntypedFormBuilder, UntypedFormGroup, NgForm } from '@angular/forms';
import { filter, tap } from 'rxjs/operators';
import { FormBuilder, FormGroup, NgForm } from '@angular/forms';
import { filter, tap } from 'rxjs';
import { NbAccordionComponent, NbAccordionItemComponent } from '@nebular/theme';
import { UntilDestroy, untilDestroyed } from '@ngneat/until-destroy';
import * as moment from 'moment';
Expand Down Expand Up @@ -32,23 +32,28 @@ export class EditEmployeeOtherSettingsComponent implements OnInit, OnDestroy {
*/
@ViewChild('general') general: NbAccordionItemComponent;
@ViewChild('integrations') integrations: NbAccordionItemComponent;
@ViewChild('timer') timer: NbAccordionItemComponent;

/**
* Employee other settings settings
*/
public form: UntypedFormGroup = EditEmployeeOtherSettingsComponent.buildForm(this.fb);
static buildForm(fb: UntypedFormBuilder): UntypedFormGroup {
public form: FormGroup = EditEmployeeOtherSettingsComponent.buildForm(this.fb);
static buildForm(fb: FormBuilder): FormGroup {
return fb.group({
timeZone: [],
timeFormat: [],
upworkId: [],
linkedInId: []
linkedInId: [],
allowManualTime: [false],
allowModifyTime: [false],
allowDeleteTime: [false],
allowScreenshotCapture: [true]
});
}

constructor(
private readonly cdr: ChangeDetectorRef,
private readonly fb: UntypedFormBuilder,
private readonly fb: FormBuilder,
private readonly employeeStore: EmployeeStore
) {}

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
7 changes: 7 additions & 0 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 Down Expand Up @@ -176,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
Loading

0 comments on commit 96c1715

Please sign in to comment.