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 }}
+