Skip to content

Commit

Permalink
Merge branch 'develop' into fix/project-module-entity-and-dto
Browse files Browse the repository at this point in the history
  • Loading branch information
rahul-rocket committed Sep 26, 2024
2 parents 6ac3f03 + 57015c2 commit bfe6689
Show file tree
Hide file tree
Showing 137 changed files with 4,514 additions and 1,245 deletions.
12 changes: 7 additions & 5 deletions apps/desktop-timer/src/app/app.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ import {
LanguageInterceptor,
LanguageModule,
LoggerService,
NgxDesktopThemeModule,
NgxLoginModule,
NoAuthGuard,
OrganizationInterceptor,
Expand All @@ -34,14 +35,14 @@ import {
SetupModule,
SplashScreenModule,
Store,
TaskTableModule,
TenantInterceptor,
TimeTrackerModule,
TimeoutInterceptor,
TokenInterceptor,
UnauthorizedInterceptor,
UpdaterModule,
serverConnectionFactory,
NgxDesktopThemeModule
serverConnectionFactory
} from '@gauzy/desktop-ui-lib';
import { environment as gauzyEnvironment } from '@gauzy/ui-config';
import {
Expand Down Expand Up @@ -117,7 +118,8 @@ if (environment.SENTRY_DSN) {
NbDatepickerModule.forRoot(),
AboutModule,
ActivityWatchModule,
RecapModule
RecapModule,
TaskTableModule
],
providers: [
AppService,
Expand Down Expand Up @@ -198,7 +200,7 @@ if (environment.SENTRY_DSN) {
},
{
provide: APP_INITIALIZER,
useFactory: () => () => { },
useFactory: () => () => {},
deps: [Sentry.TraceService],
multi: true
},
Expand All @@ -214,4 +216,4 @@ if (environment.SENTRY_DSN) {
bootstrap: [AppComponent],
exports: []
})
export class AppModule { }
export class AppModule {}
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ import {
ExpenseStatusesEnum
} from '@gauzy/contracts';
import { filter, tap } from 'rxjs/operators';
import { compareDate, distinctUntilChange, isEmpty, isNotEmpty } from '@gauzy/ui-core/common';
import { compareDate, distinctUntilChange, extractNumber, isEmpty, isNotEmpty } from '@gauzy/ui-core/common';
import { LocalDataSource } from 'angular2-smart-table';
import { Observable, firstValueFrom } from 'rxjs';
import { Router } from '@angular/router';
Expand Down Expand Up @@ -1033,14 +1033,14 @@ export class InvoiceAddComponent extends PaginationFilterBaseComponent implement
async onCreateConfirm(event) {
if (
!isNaN(event.newData.quantity) &&
!isNaN(event.newData.price) &&
!isNaN(extractNumber(event.newData.price)) &&
event.newData.quantity &&
event.newData.price &&
event.newData.description &&
(event.newData.selectedItem || this.selectedInvoiceType === InvoiceTypeEnum.DETAILED_ITEMS)
) {
const newData = event.newData;
const itemTotal = +event.newData.quantity * +event.newData.price;
const newData = { ...event.newData, price: extractNumber(event.newData.price) };
const itemTotal = +event.newData.quantity * +extractNumber(event.newData.price);
newData.totalValue = itemTotal;
this.subtotal += itemTotal;
await event.confirm.resolve(newData);
Expand All @@ -1057,16 +1057,17 @@ export class InvoiceAddComponent extends PaginationFilterBaseComponent implement
async onEditConfirm(event) {
if (
!isNaN(event.newData.quantity) &&
!isNaN(event.newData.price) &&
!isNaN(extractNumber(event.newData.price)) &&
event.newData.quantity &&
event.newData.price &&
event.newData.description &&
(event.newData.selectedItem || this.selectedInvoiceType === InvoiceTypeEnum.DETAILED_ITEMS)
) {
const newData = event.newData;
const newData = { ...event.newData, price: extractNumber(event.newData.price) };
const oldValue = +event.data.quantity * +event.data.price;
const newValue = +newData.quantity * +event.newData.price;
const newValue = +newData.quantity * +extractNumber(event.newData.price);
newData.totalValue = newValue;

if (newValue > oldValue) {
this.subtotal += newValue - oldValue;
} else if (oldValue > newValue) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ import {
IProduct,
IExpense
} from '@gauzy/contracts';
import { compareDate, distinctUntilChange } from '@gauzy/ui-core/common';
import { compareDate, distinctUntilChange, extractNumber } from '@gauzy/ui-core/common';
import { Store, ToastrService } from '@gauzy/ui-core/core';
import * as moment from 'moment';
import { InvoiceEmailMutationComponent } from '../invoice-email/invoice-email-mutation.component';
Expand Down Expand Up @@ -848,14 +848,14 @@ export class InvoiceEditComponent extends PaginationFilterBaseComponent implemen
async onCreateConfirm(event) {
if (
!isNaN(event.newData.quantity) &&
!isNaN(event.newData.price) &&
!isNaN(extractNumber(event.newData.price)) &&
event.newData.quantity &&
event.newData.price &&
event.newData.description &&
(event.newData.selectedItem || this.invoice.invoiceType === InvoiceTypeEnum.DETAILED_ITEMS)
) {
const newData = event.newData;
const itemTotal = +event.newData.quantity * +event.newData.price;
const newData = { ...event.newData, price: extractNumber(event.newData.price) };
const itemTotal = +event.newData.quantity * +extractNumber(event.newData.price);
newData.totalValue = itemTotal;
this.subtotal += itemTotal;
await event.confirm.resolve(newData);
Expand All @@ -873,15 +873,15 @@ export class InvoiceEditComponent extends PaginationFilterBaseComponent implemen
async onEditConfirm(event) {
if (
!isNaN(event.newData.quantity) &&
!isNaN(event.newData.price) &&
!isNaN(extractNumber(event.newData.price)) &&
event.newData.quantity &&
event.newData.price &&
event.newData.description &&
(event.newData.selectedItem || this.invoice.invoiceType === InvoiceTypeEnum.DETAILED_ITEMS)
) {
const newData = event.newData;
const newData = { ...event.newData, price: extractNumber(event.newData.price) };
const oldValue = +event.data.quantity * +event.data.price;
const newValue = +newData.quantity * +event.newData.price;
const newValue = +newData.quantity * +extractNumber(event.newData.price);
newData.totalValue = newValue;
if (newValue > oldValue) {
this.subtotal += newValue - oldValue;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,42 +21,71 @@ <h4>
</div>
</nb-card-header>
<nb-card-body>
<ng-container *ngIf="dataLayoutStyle === componentLayoutStyleEnum.TABLE; else gridLayout">
<div class="table-scroll-container">
<angular2-smart-table
style="cursor: pointer"
(userRowSelect)="selectProject($event)"
[settings]="settingsSmartTable"
[source]="smartTableSource"
></angular2-smart-table>
<ng-template [ngxPermissionsOnly]="[PermissionsEnum.ORG_PROJECT_VIEW]">
<ng-container [ngSwitch]="dataLayoutStyle">
<!-- Table View -->
<ng-template [ngSwitchCase]="componentLayoutStyleEnum.TABLE">
<div class="table-scroll-container">
<angular2-smart-table
style="cursor: pointer"
(userRowSelect)="selectProject($event)"
[settings]="settingsSmartTable"
[source]="smartTableSource"
></angular2-smart-table>
</div>
<div class="pagination-container">
<ng-container *ngIf="smartTableSource">
<ngx-pagination
[source]="smartTableSource"
></ngx-pagination>
</ng-container>
</div>
</ng-template>

<!-- Card Grid View -->
<ng-template [ngSwitchCase]="componentLayoutStyleEnum.CARDS_GRID">
<ga-card-grid
[totalItems]="pagination?.totalItems"
(onSelectedItem)="selectProject($event)"
(scroll)="onScroll()"
[settings]="settingsSmartTable"
[source]="projects"
#grid
></ga-card-grid>
</ng-template>

<!-- Optional: Default case if no specific layout matches -->
<ng-template *ngSwitchDefault>
<p>{{ 'SETTINGS_MENU.NO_LAYOUT' | translate }}</p>
</ng-template>
</ng-container>
</ng-template>
<ng-template [ngxPermissionsExcept]="[PermissionsEnum.ORG_PROJECT_VIEW]">
<div>
<!-- Content to display if the user does not have 'canEditComponent' permission -->
</div>
<div class="pagination-container">
<ng-container *ngIf="smartTableSource">
<ngx-pagination
[source]="smartTableSource"
></ngx-pagination>
</ng-container>
</div>
</ng-container>
</ng-template>
</nb-card-body>
</nb-card>

<!-- Actions Button -->
<ng-template #actionButtons>
<ng-template [ngxPermissionsOnly]="['ALL_ORG_EDIT', 'ORG_PROJECT_EDIT', 'ORG_PROJECT_DELETE']">
<ng-template [ngxPermissionsOnly]="[PermissionsEnum.ALL_ORG_EDIT, PermissionsEnum.ORG_PROJECT_EDIT, PermissionsEnum.ORG_PROJECT_DELETE]">
<div class="actions">
<ng-template [ngxPermissionsOnly]="['ALL_ORG_EDIT', 'ORG_PROJECT_EDIT']">
<button
nbButton
status="basic"
class="action primary"
size="small"
(click)="navigateToEditProject(selectedProject)"
(click)="navigateToProject(selectedProject)"
[disabled]="disableButton"
>
<nb-icon class="mr-1" icon="edit-outline"></nb-icon>
{{ 'BUTTONS.EDIT' | translate }}
</button>
</ng-template>
<ng-template [ngxPermissionsOnly]="['ALL_ORG_EDIT', 'ORG_PROJECT_DELETE']">
<ng-template [ngxPermissionsOnly]="[PermissionsEnum.ALL_ORG_EDIT, PermissionsEnum.ORG_PROJECT_DELETE]">
<button
[nbTooltip]="'BUTTONS.DELETE' | translate"
nbButton
Expand All @@ -72,27 +101,19 @@ <h4>
</div>
</ng-template>
</ng-template>

<!-- Visible Button -->
<ng-template #visibleButton>
<ng-template [ngxPermissionsOnly]="['ALL_ORG_EDIT', 'ORG_PROJECT_ADD']">
<ng-template [ngxPermissionsOnly]="[PermissionsEnum.ALL_ORG_EDIT, PermissionsEnum.ORG_PROJECT_ADD]">
<button
type="button"
(click)="navigateToCreateProject()"
nbButton
status="success"
size="small"
(click)="navigateToProject()"
>
<nb-icon icon="plus-outline"></nb-icon>
{{ 'BUTTONS.ADD' | translate }}
</button>
</ng-template>
</ng-template>
<ng-template #gridLayout>
<ga-card-grid
[totalItems]="pagination?.totalItems"
(onSelectedItem)="selectProject($event)"
(scroll)="onScroll()"
[settings]="settingsSmartTable"
[source]="projects"
#grid
></ga-card-grid>
</ng-template>
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ import { Router } from '@angular/router';
import { HttpClient } from '@angular/common/http';
import { NbDialogService } from '@nebular/theme';
import { TranslateService } from '@ngx-translate/core';
import { filter, tap } from 'rxjs/operators';
import { combineLatest, debounceTime, firstValueFrom, Subject } from 'rxjs';
import { filter, tap } from 'rxjs/operators';
import { Cell } from 'angular2-smart-table';
import { UntilDestroy, untilDestroyed } from '@ngneat/until-destroy';
import {
Expand Down Expand Up @@ -53,6 +53,7 @@ export class ProjectListComponent extends PaginationFilterBaseComponent implemen
public disableButton: boolean = true;
public settingsSmartTable: any;
public viewComponentName: ComponentEnum;
public PermissionsEnum = PermissionsEnum;
public dataLayoutStyle = ComponentLayoutStyleEnum.TABLE;
public componentLayoutStyleEnum = ComponentLayoutStyleEnum;
public selectedEmployeeId: ID | null;
Expand All @@ -63,7 +64,9 @@ export class ProjectListComponent extends PaginationFilterBaseComponent implemen
public project$: Subject<boolean> = this.subject$;
private _refresh$: Subject<boolean> = new Subject();

/** */
/**
* Represents a component property for handling the project view.
*/
private _grid: CardGridComponent;
@ViewChild('grid') set grid(content: CardGridComponent) {
if (content) {
Expand Down Expand Up @@ -187,9 +190,7 @@ export class ProjectListComponent extends PaginationFilterBaseComponent implemen
action: CrudActionEnum.DELETED
};

this._toastrService.success('NOTES.ORGANIZATIONS.EDIT_ORGANIZATIONS_PROJECTS.REMOVE_PROJECT', {
name
});
this._toastrService.success('NOTES.ORGANIZATIONS.EDIT_ORGANIZATIONS_PROJECTS.REMOVE_PROJECT', { name });

this.cancel();
this._refresh$.next(true);
Expand Down Expand Up @@ -237,7 +238,7 @@ export class ProjectListComponent extends PaginationFilterBaseComponent implemen
...(this.selectedEmployeeId
? {
members: {
id: this.selectedEmployeeId
employeeId: this.selectedEmployeeId
}
}
: {}),
Expand Down Expand Up @@ -558,17 +559,17 @@ export class ProjectListComponent extends PaginationFilterBaseComponent implemen
}

/**
* Navigate to the create project page.
*/
navigateToCreateProject(): void {
this._router.navigate(['/pages/organization/projects', 'create']);
}

/**
* Navigate to the edit project page for the specified project.
* @param project The project to edit.
* Navigates to the create or edit project page based on the provided project.
* If no project is provided, it navigates to the create page.
*
* @param project - (Optional) The project to edit. If not provided, navigates to the create page.
*/
navigateToEditProject(project: IOrganizationProject): void {
this._router.navigate([`/pages/organization/projects`, project.id, 'edit']);
navigateToProject(project?: IOrganizationProject): void {
// Define the base path for the project page
const basePath = '/pages/organization/projects';
// Construct the path based on the provided project
const path = project ? [basePath, project.id, 'edit'] : [basePath, 'create'];
// Navigate to the specified path
this._router.navigate(path);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ const routes: Routes = [
relations: [
'organizationContact',
'organization',
'members.user',
'members.employee.user',
'tags',
'teams',
'customFields.repository'
Expand Down
11 changes: 11 additions & 0 deletions apps/gauzy/src/app/pages/users/users.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ <h4>
</ng-template>
</nb-card-body>
</nb-card>

<ng-template #actionButtons let-selectedItem="selectedItem">
<ng-template ngxPermissionsOnly="ORG_USERS_EDIT">
<div class="actions">
Expand All @@ -95,6 +96,16 @@ <h4>
>
<nb-icon class="mr-1" icon="edit-outline"></nb-icon>{{ 'BUTTONS.EDIT' | translate }}
</button>
<button
nbButton
[disabled]="(!selectedItem && disableButton) || isEmployee()"
(click)="convertUserToEmployee()"
status="basic"
class="action primary"
size="small"
>
<nb-icon class="mr-1" icon="person"></nb-icon> {{ 'BUTTONS.CONVERT_TO_EMPLOYEE' | translate }}
</button>
<button
nbButton
[disabled]="!selectedItem && disableButton"
Expand Down
Loading

0 comments on commit bfe6689

Please sign in to comment.