diff --git a/src/components/designSystem/Filters/filtersElements/FiltersItemAmount.tsx b/src/components/designSystem/Filters/filtersElements/FiltersItemAmount.tsx index a9cbab030..63895f2f2 100644 --- a/src/components/designSystem/Filters/filtersElements/FiltersItemAmount.tsx +++ b/src/components/designSystem/Filters/filtersElements/FiltersItemAmount.tsx @@ -71,6 +71,7 @@ export const FiltersItemAmount = ({ value = '', setFilterValue }: FiltersItemAmo }))} placeholder={translate('text_66ab42d4ece7e6b7078993b1')} formikProps={formikProps} + disableClearable={true} /> {showFrom && ( diff --git a/src/components/designSystem/Filters/types.ts b/src/components/designSystem/Filters/types.ts index 68feeef7e..242c44f64 100644 --- a/src/components/designSystem/Filters/types.ts +++ b/src/components/designSystem/Filters/types.ts @@ -49,6 +49,7 @@ export const InvoiceAvailableFilters = [ AvailableFiltersEnum.paymentOverdue, AvailableFiltersEnum.paymentStatus, AvailableFiltersEnum.status, + AvailableFiltersEnum.amount, ] const translationMap: Record = { diff --git a/src/components/designSystem/Filters/utils.ts b/src/components/designSystem/Filters/utils.ts index 238b5b871..31cc38f96 100644 --- a/src/components/designSystem/Filters/utils.ts +++ b/src/components/designSystem/Filters/utils.ts @@ -12,8 +12,8 @@ import { export const parseAmountValue = (value: string) => { const [interval, from, to] = value.split(',') - const fromAmount = from ? parseInt(from) : null - const toAmount = to ? parseInt(to) : null + const fromAmount = from ? Number(from) : null + const toAmount = to ? Number(to) : null switch (interval) { case AmountFilterInterval.isEqualTo: diff --git a/src/components/invoices/InvoicesList.tsx b/src/components/invoices/InvoicesList.tsx index 04297b2e8..7fd3ac6c3 100644 --- a/src/components/invoices/InvoicesList.tsx +++ b/src/components/invoices/InvoicesList.tsx @@ -118,6 +118,7 @@ const InvoicesList = ({ ; + amountTo?: InputMaybe; currency?: InputMaybe; customerExternalId?: InputMaybe; invoiceType?: InputMaybe>; @@ -4899,6 +4901,8 @@ export type QueryInvoicedUsagesArgs = { export type QueryInvoicesArgs = { + amountFrom?: InputMaybe; + amountTo?: InputMaybe; currency?: InputMaybe; customerExternalId?: InputMaybe; customerId?: InputMaybe; @@ -8695,6 +8699,8 @@ export type GetInvoicesListQueryVariables = Exact<{ paymentStatus?: InputMaybe | InvoicePaymentStatusTypeEnum>; searchTerm?: InputMaybe; status?: InputMaybe | InvoiceStatusTypeEnum>; + amountFrom?: InputMaybe; + amountTo?: InputMaybe; }>; @@ -22961,7 +22967,7 @@ export type GetInvoiceCreditNotesLazyQueryHookResult = ReturnType; export type GetInvoiceCreditNotesQueryResult = Apollo.QueryResult; export const GetInvoicesListDocument = gql` - query getInvoicesList($currency: CurrencyEnum, $customerExternalId: String, $invoiceType: [InvoiceTypeEnum!], $issuingDateFrom: ISO8601Date, $issuingDateTo: ISO8601Date, $limit: Int, $page: Int, $paymentDisputeLost: Boolean, $paymentOverdue: Boolean, $paymentStatus: [InvoicePaymentStatusTypeEnum!], $searchTerm: String, $status: [InvoiceStatusTypeEnum!]) { + query getInvoicesList($currency: CurrencyEnum, $customerExternalId: String, $invoiceType: [InvoiceTypeEnum!], $issuingDateFrom: ISO8601Date, $issuingDateTo: ISO8601Date, $limit: Int, $page: Int, $paymentDisputeLost: Boolean, $paymentOverdue: Boolean, $paymentStatus: [InvoicePaymentStatusTypeEnum!], $searchTerm: String, $status: [InvoiceStatusTypeEnum!], $amountFrom: Int, $amountTo: Int) { invoices( currency: $currency customerExternalId: $customerExternalId @@ -22975,6 +22981,8 @@ export const GetInvoicesListDocument = gql` paymentStatus: $paymentStatus searchTerm: $searchTerm status: $status + amountFrom: $amountFrom + amountTo: $amountTo ) { metadata { currentPage @@ -23013,6 +23021,8 @@ export const GetInvoicesListDocument = gql` * paymentStatus: // value for 'paymentStatus' * searchTerm: // value for 'searchTerm' * status: // value for 'status' + * amountFrom: // value for 'amountFrom' + * amountTo: // value for 'amountTo' * }, * }); */ diff --git a/src/pages/InvoicesPage.tsx b/src/pages/InvoicesPage.tsx index 05784011e..566def5d7 100644 --- a/src/pages/InvoicesPage.tsx +++ b/src/pages/InvoicesPage.tsx @@ -59,6 +59,8 @@ gql` $paymentStatus: [InvoicePaymentStatusTypeEnum!] $searchTerm: String $status: [InvoiceStatusTypeEnum!] + $amountFrom: Int + $amountTo: Int ) { invoices( currency: $currency @@ -73,6 +75,8 @@ gql` paymentStatus: $paymentStatus searchTerm: $searchTerm status: $status + amountFrom: $amountFrom + amountTo: $amountTo ) { metadata { currentPage @@ -212,7 +216,7 @@ const InvoicesPage = () => { nextFetchPolicy: 'network-only', variables: { limit: 20, - ...filtersForInvoiceQuery, + ...formatAmountCurrency(filtersForInvoiceQuery, amountCurrency), }, }) @@ -254,7 +258,7 @@ const InvoicesPage = () => { const onInvoicesExport = async (values: ExportValues) => { const filters = { - ...formatFiltersForInvoiceQuery(searchParams), + ...formatAmountCurrency(formatFiltersForInvoiceQuery(searchParams), amountCurrency), searchTerm: variableInvoices?.searchTerm, }