From c94d342271ff4d5d5f38ff53694ad1fd0dbadbeb Mon Sep 17 00:00:00 2001 From: "Rahul R." Date: Fri, 25 Oct 2024 18:28:12 +0530 Subject: [PATCH] integration of codeRabitai suggestions --- .../edit-employee-other-settings.component.ts | 11 ++++++----- .../time-tracking-authorized-directive.ts | 18 +++++++++++------- 2 files changed, 17 insertions(+), 12 deletions(-) diff --git a/apps/gauzy/src/app/pages/employees/edit-employee/edit-employee-profile/edit-employee-settings/edit-employee-other-settings.component.ts b/apps/gauzy/src/app/pages/employees/edit-employee/edit-employee-profile/edit-employee-settings/edit-employee-other-settings.component.ts index 4ae8eff3d5c..fe79b27c4a6 100644 --- a/apps/gauzy/src/app/pages/employees/edit-employee/edit-employee-profile/edit-employee-settings/edit-employee-other-settings.component.ts +++ b/apps/gauzy/src/app/pages/employees/edit-employee/edit-employee-profile/edit-employee-settings/edit-employee-other-settings.component.ts @@ -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'; @@ -37,12 +37,13 @@ export class EditEmployeeOtherSettingsComponent implements OnInit, OnDestroy { /** * 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: [], allowManualTime: [false], allowModifyTime: [false], allowDeleteTime: [false], @@ -52,7 +53,7 @@ export class EditEmployeeOtherSettingsComponent implements OnInit, OnDestroy { constructor( private readonly cdr: ChangeDetectorRef, - private readonly fb: UntypedFormBuilder, + private readonly fb: FormBuilder, private readonly employeeStore: EmployeeStore ) {} diff --git a/packages/ui-core/shared/src/lib/directives/time-tracking-authorized-directive.ts b/packages/ui-core/shared/src/lib/directives/time-tracking-authorized-directive.ts index d3da5294ee2..10d527b4550 100644 --- a/packages/ui-core/shared/src/lib/directives/time-tracking-authorized-directive.ts +++ b/packages/ui-core/shared/src/lib/directives/time-tracking-authorized-directive.ts @@ -11,19 +11,23 @@ import { Store } from '@gauzy/ui-core/core'; selector: '[ngxTimeTrackingAuthorized]' }) export class TimeTrackingAuthorizedDirective implements OnInit { - /* - * Getter & Setter for dynamic permission + private _permission: string | string[] = []; // Default initialization + /** + * Setter for dynamic permission. + * @param permission - The permission(s) to be set. */ - _permission: string | string[]; - get permission(): string | string[] { - return this._permission; - } @Input() set permission(permission: string | string[]) { if (!permission) { - throw false; + throw new Error('Permission must be provided'); } this._permission = permission; } + /** + * Getter for dynamic permission. + */ + get permission(): string | string[] { + return this._permission; + } @Input() permissionElse: TemplateRef;