diff --git a/apps/gauzy/src/app/pages/invoices/invoice-add/invoice-add.component.ts b/apps/gauzy/src/app/pages/invoices/invoice-add/invoice-add.component.ts index f335f514389..ab11c19d3fb 100644 --- a/apps/gauzy/src/app/pages/invoices/invoice-add/invoice-add.component.ts +++ b/apps/gauzy/src/app/pages/invoices/invoice-add/invoice-add.component.ts @@ -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'; @@ -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); @@ -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) { diff --git a/apps/gauzy/src/app/pages/invoices/invoice-edit/invoice-edit.component.ts b/apps/gauzy/src/app/pages/invoices/invoice-edit/invoice-edit.component.ts index 89b26be56de..e7ee22c543a 100644 --- a/apps/gauzy/src/app/pages/invoices/invoice-edit/invoice-edit.component.ts +++ b/apps/gauzy/src/app/pages/invoices/invoice-edit/invoice-edit.component.ts @@ -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'; @@ -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); @@ -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; diff --git a/apps/gauzy/src/app/pages/projects/components/project-list/list.component.html b/apps/gauzy/src/app/pages/projects/components/project-list/list.component.html index 5633abd310e..3dee49a2db7 100644 --- a/apps/gauzy/src/app/pages/projects/components/project-list/list.component.html +++ b/apps/gauzy/src/app/pages/projects/components/project-list/list.component.html @@ -21,27 +21,56 @@

- -
- + + + + +
+ +
+
+ + + +
+
+ + + + + + + + +

{{ 'SETTINGS_MENU.NO_LAYOUT' | translate }}

+
+
+
+ +
+
-
- - - -
- +
+ + - +
- +
+ + - + - - - diff --git a/apps/gauzy/src/app/pages/projects/components/project-list/list.component.ts b/apps/gauzy/src/app/pages/projects/components/project-list/list.component.ts index 1326e9fe61e..ceeeebc9e9b 100644 --- a/apps/gauzy/src/app/pages/projects/components/project-list/list.component.ts +++ b/apps/gauzy/src/app/pages/projects/components/project-list/list.component.ts @@ -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 { @@ -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; @@ -63,7 +64,9 @@ export class ProjectListComponent extends PaginationFilterBaseComponent implemen public project$: Subject = this.subject$; private _refresh$: Subject = new Subject(); - /** */ + /** + * Represents a component property for handling the project view. + */ private _grid: CardGridComponent; @ViewChild('grid') set grid(content: CardGridComponent) { if (content) { @@ -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); @@ -237,7 +238,7 @@ export class ProjectListComponent extends PaginationFilterBaseComponent implemen ...(this.selectedEmployeeId ? { members: { - id: this.selectedEmployeeId + employeeId: this.selectedEmployeeId } } : {}), @@ -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); } } diff --git a/apps/gauzy/src/app/pages/projects/projects-routing.module.ts b/apps/gauzy/src/app/pages/projects/projects-routing.module.ts index bdffea68add..cf23231cf4a 100644 --- a/apps/gauzy/src/app/pages/projects/projects-routing.module.ts +++ b/apps/gauzy/src/app/pages/projects/projects-routing.module.ts @@ -70,7 +70,7 @@ const routes: Routes = [ relations: [ 'organizationContact', 'organization', - 'members.user', + 'members.employee.user', 'tags', 'teams', 'customFields.repository' diff --git a/apps/gauzy/src/app/pages/users/users.component.html b/apps/gauzy/src/app/pages/users/users.component.html index 98dcd1c6499..2ef56289fc6 100644 --- a/apps/gauzy/src/app/pages/users/users.component.html +++ b/apps/gauzy/src/app/pages/users/users.component.html @@ -72,6 +72,7 @@

+
@@ -95,6 +96,16 @@

> {{ 'BUTTONS.EDIT' | translate }} +