Skip to content

Commit

Permalink
Merge pull request #7997 from ever-co/revert-7995-revert-7994-stage
Browse files Browse the repository at this point in the history
Revert "Revert "Release""
  • Loading branch information
EverTechDevOps authored Jul 22, 2024
2 parents 5ac7c02 + 31166de commit 1070957
Show file tree
Hide file tree
Showing 193 changed files with 4,336 additions and 2,976 deletions.
7 changes: 4 additions & 3 deletions angular.json
Original file line number Diff line number Diff line change
Expand Up @@ -218,14 +218,14 @@
"ui-config": {
"projectType": "library",
"root": "packages/ui-config",
"sourceRoot": "packages/ui-config",
"sourceRoot": "packages/ui-config/src",
"prefix": "lib",
"architect": {
"build": {
"builder": "@angular-devkit/build-angular:ng-packagr",
"options": {
"project": "packages/ui-config/ng-package.json",
"tsConfig": "packages/ui-config/tsconfig.lib.json"
"tsConfig": "packages/ui-config/tsconfig.lib.json",
"project": "packages/ui-config/ng-package.json"
},
"configurations": {
"production": {
Expand All @@ -240,6 +240,7 @@
"test": {
"builder": "@angular-devkit/build-angular:karma",
"options": {
"main": "packages/ui-config/src/test-setup.ts",
"tsConfig": "packages/ui-config/tsconfig.spec.json",
"polyfills": ["zone.js", "zone.js/testing"]
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -231,6 +231,10 @@ export class AccountingComponent extends TranslationBaseComponent implements Aft
* @param employee - The selected employee information.
*/
async selectEmployee(employee: ISelectedEmployee) {
if (!employee.id) {
return;
}

// Fetch detailed information about the selected employee from the employeesService
const people = await firstValueFrom(this.employeesService.getEmployeeById(employee.id, ['user']));

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -418,16 +418,19 @@ export class TimeTrackingComponent
async getTasks(): Promise<void> {
if (this._isWindowHidden(Windows.TASKS)) return;

try {
this.tasksLoading = true;
// Set loading state to true
this.tasksLoading = true;

try {
const request: IGetTasksStatistics = this.payloads$.getValue();
const take = 5;

this.tasks = await this._timesheetStatisticsService.getTasks({ ...request, take });
// Fetch tasks statistics
this.tasks = await this._timesheetStatisticsService.getTasksStatistics({ ...request, take });
} catch (error) {
this._toastrService.error(error.message || 'An error occurred while fetching tasks.');
} finally {
// Set loading state to false
this.tasksLoading = false;
}
}
Expand Down Expand Up @@ -614,7 +617,10 @@ export class TimeTrackingComponent
return;
}
try {
const people = await firstValueFrom(this._employeesService.getEmployeeById(employee.id, ['user']));
const people: IEmployee = await firstValueFrom(
this._employeesService.getEmployeeById(employee.id, ['user'])
);

this._store.selectedEmployee = employee.id
? ({
id: people.id,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -222,6 +222,9 @@ export class EditEmployeeProfileComponent extends TranslationBaseComponent imple
private async _getEmployeeProfile() {
try {
const { id } = this.routeParams;
if (!id) {
return;
}

// Fetch employee data from the service
const employee = await firstValueFrom(
Expand All @@ -240,12 +243,11 @@ export class EditEmployeeProfileComponent extends TranslationBaseComponent imple
this.employeeStore.selectedEmployee = this.selectedEmployee = employee;

// Set the employee name for display
this.employeeName = employee?.user?.name || employee?.user?.username || 'Employee';
this.employeeName = employee?.user?.name || employee?.user?.username || 'Unknown Employee';
} catch (error) {
// Handle errors gracefully
console.error('Error fetching employee profile:', error);
// Optionally, navigate to a fallback route or show an error message
// this.router.navigate(['/error']);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,10 @@ export class EditEmployeeResolver implements Resolve<Observable<IEmployee>> {
const employeeId = route.params.id; // Extract employee ID from route parameters
const relations = ['user', 'user.image', 'organizationPosition']; // Define relations to include in the query

if (!employeeId) {
of(null);
}

// Call the employeeService to fetch employee data by ID with specified relations
return this.employeeService.getEmployeeById(employeeId, relations).pipe(
catchError((error) => {
Expand Down
34 changes: 24 additions & 10 deletions apps/gauzy/src/app/pages/employees/employees.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -44,18 +44,28 @@ <h4>
</div>
</nb-card-header>
<nb-card-body>
<ng-template
[ngTemplateOutlet]="dataLayoutStyle === componentLayoutStyleEnum.TABLE ? tableLayout : gridLayout"
></ng-template>
<ng-template [ngxPermissionsOnly]="['ORG_EMPLOYEES_VIEW']">
<ng-template
[ngTemplateOutlet]="dataLayoutStyle === componentLayoutStyleEnum.TABLE ? tableLayout : gridLayout"
></ng-template>
</ng-template>
<ng-template [ngxPermissionsExcept]="['ORG_EMPLOYEES_VIEW']">
<div>
<!-- Content to display if the user does not have 'canEditComponent' permission -->
</div>
</ng-template>
</nb-card-body>
</nb-card>

<ng-template #actionButtons let-selectedItem>
<div class="btn-group actions">
<ng-template ngxPermissionsOnly="ORG_EMPLOYEES_EDIT">
<button status="basic" class="action secondary" size="small" nbButton underConstruction>
<nb-icon icon="eye-outline" pack="eva"></nb-icon>
<span> {{ 'BUTTONS.VIEW' | translate }} </span>
</button>
<ng-template [ngxPermissionsOnly]="['ORG_EMPLOYEES_EDIT', 'ORG_EMPLOYEES_VIEW']">
<ng-template ngxPermissionsOnly="ORG_EMPLOYEES_VIEW">
<button status="basic" class="action secondary" size="small" nbButton underConstruction>
<nb-icon icon="eye-outline" pack="eva"></nb-icon>
<span> {{ 'BUTTONS.VIEW' | translate }} </span>
</button>
</ng-template>
<ng-container *ngIf="selectedItem && selectedItem?.isDeleted">
<button
nbButton
Expand Down Expand Up @@ -110,7 +120,6 @@ <h4>
}}
</button>
</ng-container>

<button
nbButton
[disabled]="disableButton"
Expand All @@ -119,7 +128,8 @@ <h4>
status="basic"
class="action primary"
>
<nb-icon class="mr-1" icon="edit-outline"></nb-icon>{{ 'BUTTONS.EDIT' | translate }}
<nb-icon class="mr-1" icon="edit-outline"></nb-icon>
{{ 'BUTTONS.EDIT' | translate }}
</button>
<ng-container *ngIf="selectedItem && !selectedItem?.isDeleted">
<button
Expand All @@ -136,6 +146,7 @@ <h4>
</ng-template>
</div>
</ng-template>

<ng-template #visibleButtons>
<ng-template ngxPermissionsOnly="ORG_EMPLOYEES_EDIT">
<ng-template ngxPermissionsOnly="ORG_INVITE_EDIT">
Expand All @@ -151,6 +162,7 @@ <h4>
</button>
</ng-template>
</ng-template>

<ng-template #tableLayout>
<div class="table-scroll-container">
<angular2-smart-table
Expand All @@ -166,6 +178,7 @@ <h4>
</ng-container>
</div>
</ng-template>

<ng-template #gridLayout>
<div class="grid">
<ga-card-grid
Expand All @@ -178,6 +191,7 @@ <h4>
></ga-card-grid>
</div>
</ng-template>

<ng-template #startWork>
<button (click)="startEmployeeWork()" class="action text-info" nbButton size="small" status="basic">
<nb-icon icon="person-done-outline"></nb-icon>
Expand Down
Loading

0 comments on commit 1070957

Please sign in to comment.