feat: add filter field to suggest select field.

This commit is contained in:
a.bouhuolia
2021-08-03 08:26:13 +02:00
parent c09a99a773
commit 4a0bd842e9
12 changed files with 113 additions and 42 deletions

View File

@@ -27,7 +27,12 @@ function InventoryItemDetailsProvider({ filter, ...props }) {
data: { items },
isLoading: isItemsLoading,
isFetching: isItemsFetching,
} = useItems({ page_size: 10000 });
} = useItems({
stringified_filter_roles: JSON.stringify([
{ fieldKey: 'type', comparator: 'is', value: 'inventory', index: 1 },
]),
page_size: 10000,
});
const provider = {
inventoryItemDetails,

View File

@@ -25,7 +25,12 @@ function InventoryValuationProvider({ query, ...props }) {
data: { items },
isLoading: isItemsLoading,
isFetching: isItemsFetching,
} = useItems({ page_size: 10000 });
} = useItems({
stringified_filter_roles: JSON.stringify([
{ fieldKey: 'type', comparator: 'is', value: 'inventory', index: 1 },
]),
page_size: 10000,
});
// Provider data.
const provider = {
@@ -36,7 +41,7 @@ function InventoryValuationProvider({ query, ...props }) {
items,
isItemsFetching,
isItemsLoading
isItemsLoading,
};
return (

View File

@@ -3,7 +3,6 @@ import FinancialReportPage from '../FinancialReportPage';
import { usePurchasesByItems, useItems } from 'hooks/query';
import { transformFilterFormToQuery } from '../common';
const PurchasesByItemsContext = createContext();
function PurchasesByItemsProvider({ query, ...props }) {
@@ -27,7 +26,12 @@ function PurchasesByItemsProvider({ query, ...props }) {
data: { items },
isLoading: isItemsLoading,
isFetching: isItemsFetching,
} = useItems({ page_size: 10000 });
} = useItems({
page_size: 10000,
stringified_filter_roles: JSON.stringify([
{ fieldKey: 'type', comparator: 'is', value: 'inventory', index: 1 },
]),
});
const provider = {
purchaseByItems,

View File

@@ -25,7 +25,12 @@ function SalesByItemProvider({ query, ...props }) {
data: { items },
isLoading: isItemsLoading,
isFetching: isItemsFetching,
} = useItems({ page_size: 10000 });
} = useItems({
page_size: 10000,
stringified_filter_roles: JSON.stringify([
{ fieldKey: 'type', comparator: 'is', value: 'inventory', index: 1 },
]),
});
const provider = {
salesByItems,
@@ -35,7 +40,7 @@ function SalesByItemProvider({ query, ...props }) {
items,
isItemsLoading,
isItemsFetching,
refetchSheet: refetch,
};
return (

View File

@@ -13,7 +13,7 @@ import {
import intl from 'react-intl-universal';
import { FormattedMessage as T } from 'components';
import { Icon, If, Choose, Money } from 'components';
import { safeCallback, isBlank, calculateStatus } from 'utils';
import { formattedAmount, safeCallback, isBlank, calculateStatus } from 'utils';
import moment from 'moment';
/**
@@ -115,12 +115,7 @@ export function StatusAccessor(bill) {
<If condition={bill.is_partially_paid}>
<span className="partial-paid">
{intl.get('day_partially_paid', {
due: (
<Money
amount={bill.due_amount}
currency={bill.currency_code}
/>
),
due: formattedAmount(bill.due_amount, bill.currency_code),
})}
</span>
<ProgressBar

View File

@@ -16,7 +16,7 @@ import { FormattedMessage as T } from 'components';
import moment from 'moment';
import { Choose, If, Icon } from 'components';
import { Money, AppToaster } from 'components';
import { safeCallback, calculateStatus } from 'utils';
import { formattedAmount, safeCallback, calculateStatus } from 'utils';
export const statusAccessor = (row) => {
return (
@@ -48,9 +48,7 @@ export const statusAccessor = (row) => {
<If condition={row.is_partially_paid}>
<span class="partial-paid">
{intl.get('day_partially_paid', {
due: (
<Money amount={row.due_amount} currency={row.currency_code} />
),
due: formattedAmount(row.due_amount, row.currency_code),
})}
</span>
<ProgressBar