diff --git a/src/containers/FinancialStatements/BalanceSheet/BalanceSheet.js b/src/containers/FinancialStatements/BalanceSheet/BalanceSheet.js index 8c6cb9d4d..9d3b47c6f 100644 --- a/src/containers/FinancialStatements/BalanceSheet/BalanceSheet.js +++ b/src/containers/FinancialStatements/BalanceSheet/BalanceSheet.js @@ -31,7 +31,7 @@ function BalanceSheet({ toDate: moment().endOf('year').format('YYYY-MM-DD'), basis: 'cash', displayColumnsType: 'total', - accountsFilter: 'without-zero-balance', + filterByOption: 'without-zero-balance', }); // Handle re-fetch balance sheet after filter change. diff --git a/src/containers/FinancialStatements/BalanceSheet/utils.js b/src/containers/FinancialStatements/BalanceSheet/utils.js index 74656f4e0..0a5301b23 100644 --- a/src/containers/FinancialStatements/BalanceSheet/utils.js +++ b/src/containers/FinancialStatements/BalanceSheet/utils.js @@ -5,7 +5,7 @@ import moment from 'moment'; export const getBalanceSheetHeaderDefaultValues = () => { return { basic: 'cash', - accountsFilter: 'without-zero-balance', + filterByOption: 'without-zero-balance', displayColumnsType: 'total', fromDate: moment().toDate(), toDate: moment().toDate(), @@ -20,6 +20,6 @@ export const getBalanceSheetHeaderValidationSchema = () => .min(Yup.ref('fromDate')) .required() .label(intl.get('toDate')), - accountsFilter: Yup.string(), + filterByOption: Yup.string(), displayColumnsType: Yup.string(), }); diff --git a/src/containers/FinancialStatements/CashFlowStatement/CashFlowStatement.js b/src/containers/FinancialStatements/CashFlowStatement/CashFlowStatement.js index 2b1071276..4956101c1 100644 --- a/src/containers/FinancialStatements/CashFlowStatement/CashFlowStatement.js +++ b/src/containers/FinancialStatements/CashFlowStatement/CashFlowStatement.js @@ -34,6 +34,7 @@ function CashFlowStatement({ toDate: moment().endOf('year').format('YYYY-MM-DD'), basis: 'cash', displayColumnsType: 'total', + filterByOption: 'with-transactions', }); // Handle refetch cash flow after filter change. diff --git a/src/containers/FinancialStatements/CashFlowStatement/CashFlowStatementGeneralPanel.js b/src/containers/FinancialStatements/CashFlowStatement/CashFlowStatementGeneralPanel.js index ed2e96e65..742a6454a 100644 --- a/src/containers/FinancialStatements/CashFlowStatement/CashFlowStatementGeneralPanel.js +++ b/src/containers/FinancialStatements/CashFlowStatement/CashFlowStatementGeneralPanel.js @@ -13,7 +13,7 @@ export default function CashFlowStatementHeaderGeneralPanel() {
- +
); diff --git a/src/containers/FinancialStatements/CustomersBalanceSummary/CustomersBalanceSummary.js b/src/containers/FinancialStatements/CustomersBalanceSummary/CustomersBalanceSummary.js index a5681ce9e..253ec5ac7 100644 --- a/src/containers/FinancialStatements/CustomersBalanceSummary/CustomersBalanceSummary.js +++ b/src/containers/FinancialStatements/CustomersBalanceSummary/CustomersBalanceSummary.js @@ -29,6 +29,7 @@ function CustomersBalanceSummary({ }) { const [filter, setFilter] = useState({ asDate: moment().endOf('day').format('YYYY-MM-DD'), + filterByOption: 'with-transactions', }); // Handle re-fetch customers balance summary after filter change. diff --git a/src/containers/FinancialStatements/CustomersBalanceSummary/CustomersBalanceSummaryGeneralPanelContent.js b/src/containers/FinancialStatements/CustomersBalanceSummary/CustomersBalanceSummaryGeneralPanelContent.js index ae77259c2..1e8c692a9 100644 --- a/src/containers/FinancialStatements/CustomersBalanceSummary/CustomersBalanceSummaryGeneralPanelContent.js +++ b/src/containers/FinancialStatements/CustomersBalanceSummary/CustomersBalanceSummaryGeneralPanelContent.js @@ -5,7 +5,7 @@ import { Classes, FormGroup, Position, Checkbox } from '@blueprintjs/core'; import { ContactsMultiSelect, FormattedMessage as T } from 'components'; import classNames from 'classnames'; import { Row, Col, FieldHint } from 'components'; -import { filterCustomersOptions } from '../common'; +import { filterCustomersOptions } from '../constants'; import { momentFormatter, @@ -71,7 +71,7 @@ export default function CustomersBalanceSummaryGeneralPanelContent() { } - initialSelectedItem={'all-customers'} + initialSelectedItem={'with-transactions'} /> diff --git a/src/containers/FinancialStatements/CustomersTransactions/CustomersTransactions.js b/src/containers/FinancialStatements/CustomersTransactions/CustomersTransactions.js index bfe6de920..4d928e7dc 100644 --- a/src/containers/FinancialStatements/CustomersTransactions/CustomersTransactions.js +++ b/src/containers/FinancialStatements/CustomersTransactions/CustomersTransactions.js @@ -30,6 +30,7 @@ function CustomersTransactions({ const [filter, setFilter] = useState({ fromDate: moment().startOf('year').format('YYYY-MM-DD'), toDate: moment().endOf('year').format('YYYY-MM-DD'), + filterByOption: 'with-transactions', }); const handleFilterSubmit = (filter) => { diff --git a/src/containers/FinancialStatements/CustomersTransactions/CustomersTransactionsHeaderGeneralPanel.js b/src/containers/FinancialStatements/CustomersTransactions/CustomersTransactionsHeaderGeneralPanel.js index 5536d29cc..d0b218fc4 100644 --- a/src/containers/FinancialStatements/CustomersTransactions/CustomersTransactionsHeaderGeneralPanel.js +++ b/src/containers/FinancialStatements/CustomersTransactions/CustomersTransactionsHeaderGeneralPanel.js @@ -10,7 +10,7 @@ import { ContactsMultiSelect, FormattedMessage as T, } from '../../../components'; -import { filterCustomersOptions } from '../common'; +import { filterCustomersOptions } from '../constants'; import { CustomersTransactionsGeneralPanelProvider, @@ -40,7 +40,7 @@ function CustomersTransactionsHeaderGeneralPanelContent() { } - initialSelectedItem={'all-customers'} + initialSelectedItem={'with-transactions'} /> diff --git a/src/containers/FinancialStatements/FinancialStatementDateRange.js b/src/containers/FinancialStatements/FinancialStatementDateRange.js index 7b5479464..2923ca28c 100644 --- a/src/containers/FinancialStatements/FinancialStatementDateRange.js +++ b/src/containers/FinancialStatements/FinancialStatementDateRange.js @@ -6,7 +6,8 @@ import { Row, Col, Hint } from 'components'; import { momentFormatter, parseDateRangeQuery } from 'utils'; import { DateInput } from '@blueprintjs/datetime'; import intl from 'react-intl-universal'; -import { dateRangeOptions } from 'containers/FinancialStatements/common'; +import { dateRangeOptions } from './constants'; + /** * Financial statement - Date range select. diff --git a/src/containers/FinancialStatements/FinancialStatementsFilter.js b/src/containers/FinancialStatements/FinancialStatementsFilter.js index d6dc4a127..d746e1161 100644 --- a/src/containers/FinancialStatements/FinancialStatementsFilter.js +++ b/src/containers/FinancialStatements/FinancialStatementsFilter.js @@ -12,7 +12,7 @@ import { FastField } from 'formik'; import { CLASSES } from 'common/classes'; import { Col, Row, ListSelect, MODIFIER } from 'components'; -import { filterAccountsOptions } from './common'; +import { filterAccountsOptions } from './constants'; export default function FinancialStatementsFilter({ @@ -45,7 +45,7 @@ export default function FinancialStatementsFilter({ return ( - + {({ form: { setFieldValue }, field: { value } }) => ( { - setFieldValue('accountsFilter', item.key); + setFieldValue('filterByOption', item.key); }} className={classNames(CLASSES.SELECT_LIST_FILL_POPOVER)} {...restProps} diff --git a/src/containers/FinancialStatements/GeneralLedger/GeneralLedger.js b/src/containers/FinancialStatements/GeneralLedger/GeneralLedger.js index 3cdee521d..ae32d63fa 100644 --- a/src/containers/FinancialStatements/GeneralLedger/GeneralLedger.js +++ b/src/containers/FinancialStatements/GeneralLedger/GeneralLedger.js @@ -34,7 +34,7 @@ function GeneralLedger({ fromDate: moment().startOf('year').format('YYYY-MM-DD'), toDate: moment().endOf('year').format('YYYY-MM-DD'), basis: 'accural', - accountsFilter: 'with-transactions', + filterByOption: 'with-transactions', }); // Handle financial statement filter change. diff --git a/src/containers/FinancialStatements/GeneralLedger/GeneralLedgerHeaderGeneralPane.js b/src/containers/FinancialStatements/GeneralLedger/GeneralLedgerHeaderGeneralPane.js index 5f78cfa43..356480e06 100644 --- a/src/containers/FinancialStatements/GeneralLedger/GeneralLedgerHeaderGeneralPane.js +++ b/src/containers/FinancialStatements/GeneralLedger/GeneralLedgerHeaderGeneralPane.js @@ -35,7 +35,7 @@ function GLHeaderGeneralPaneContent() { diff --git a/src/containers/FinancialStatements/InventoryValuation/InventoryValuation.js b/src/containers/FinancialStatements/InventoryValuation/InventoryValuation.js index 6317b9fff..c769ec361 100644 --- a/src/containers/FinancialStatements/InventoryValuation/InventoryValuation.js +++ b/src/containers/FinancialStatements/InventoryValuation/InventoryValuation.js @@ -27,6 +27,7 @@ function InventoryValuation({ }) { const [filter, setFilter] = useState({ asDate: moment().endOf('day').format('YYYY-MM-DD'), + filterByOption: 'with-transactions', }); // Handle filter form submit. @@ -54,7 +55,6 @@ function InventoryValuation({ [toggleInventoryValuationFilterDrawer], ); - return ( - + {({ form, field: { value }, meta: { error } }) => ( - + {({ form: { setFieldValue } }) => ( - + ); diff --git a/src/containers/FinancialStatements/PurchasesByItems/PurchasesByItems.js b/src/containers/FinancialStatements/PurchasesByItems/PurchasesByItems.js index 4f2db579b..f411f2040 100644 --- a/src/containers/FinancialStatements/PurchasesByItems/PurchasesByItems.js +++ b/src/containers/FinancialStatements/PurchasesByItems/PurchasesByItems.js @@ -27,6 +27,7 @@ function PurchasesByItems({ const [filter, setFilter] = useState({ fromDate: moment().startOf('year').format('YYYY-MM-DD'), toDate: moment().endOf('year').format('YYYY-MM-DD'), + filterByOption: 'with-transactions', }); // Handle filter form submit. diff --git a/src/containers/FinancialStatements/PurchasesByItems/PurchasesByItemsGeneralPanel.js b/src/containers/FinancialStatements/PurchasesByItems/PurchasesByItemsGeneralPanel.js index e8c90d2b4..0098541fb 100644 --- a/src/containers/FinancialStatements/PurchasesByItems/PurchasesByItemsGeneralPanel.js +++ b/src/containers/FinancialStatements/PurchasesByItems/PurchasesByItemsGeneralPanel.js @@ -10,7 +10,7 @@ import { import classNames from 'classnames'; import FinancialStatementDateRange from 'containers/FinancialStatements/FinancialStatementDateRange'; import FinancialStatementsFilter from '../FinancialStatementsFilter'; -import { filterItemsOptions } from '../common'; +import { filterItemsOptions } from '../constants'; import { PurchasesByItemsGeneralPanelProvider, @@ -40,7 +40,7 @@ function PurchasesByItemsGeneralPanelContent() { } - initialSelectedItem={'all-items'} + initialSelectedItem={'with-transactions'} /> diff --git a/src/containers/FinancialStatements/SalesByItems/SalesByItems.js b/src/containers/FinancialStatements/SalesByItems/SalesByItems.js index 80458241b..81b0d8dc0 100644 --- a/src/containers/FinancialStatements/SalesByItems/SalesByItems.js +++ b/src/containers/FinancialStatements/SalesByItems/SalesByItems.js @@ -1,7 +1,6 @@ import React, { useEffect, useState, useCallback } from 'react'; import moment from 'moment'; - import 'style/pages/FinancialStatements/SalesAndPurchasesSheet.scss'; import { SalesByItemProvider } from './SalesByItemProvider'; @@ -30,6 +29,7 @@ function SalesByItems({ const [filter, setFilter] = useState({ fromDate: moment().startOf('year').format('YYYY-MM-DD'), toDate: moment().endOf('year').format('YYYY-MM-DD'), + filterByOption: 'with-transactions', }); // Handle filter form submit. diff --git a/src/containers/FinancialStatements/SalesByItems/SalesByItemsHeaderGeneralPanel.js b/src/containers/FinancialStatements/SalesByItems/SalesByItemsHeaderGeneralPanel.js index 974d48dcd..717f70082 100644 --- a/src/containers/FinancialStatements/SalesByItems/SalesByItemsHeaderGeneralPanel.js +++ b/src/containers/FinancialStatements/SalesByItems/SalesByItemsHeaderGeneralPanel.js @@ -2,7 +2,7 @@ import React from 'react'; import { FormGroup, Classes } from '@blueprintjs/core'; import { Field } from 'formik'; import classNames from 'classnames'; -import { filterItemsOptions } from '../common'; +import { filterItemsOptions } from '../constants'; import { Row, Col, ItemsMultiSelect, FormattedMessage as T } from 'components'; import FinancialStatementDateRange from 'containers/FinancialStatements/FinancialStatementDateRange'; @@ -36,7 +36,7 @@ function SalesByItemsHeaderGeneralPanelContent() { } - initialSelectedItem={'all-items'} + initialSelectedItem={'with-transactions'} /> diff --git a/src/containers/FinancialStatements/SelectDisplayColumnsBy.js b/src/containers/FinancialStatements/SelectDisplayColumnsBy.js index 8adf628b7..daf2bb35e 100644 --- a/src/containers/FinancialStatements/SelectDisplayColumnsBy.js +++ b/src/containers/FinancialStatements/SelectDisplayColumnsBy.js @@ -3,7 +3,7 @@ import { FormGroup } from '@blueprintjs/core'; import { FastField } from 'formik'; import { FormattedMessage as T } from 'components'; import { Row, Col, ListSelect } from 'components'; -import { displayColumnsByOptions } from 'containers/FinancialStatements/common'; +import { displayColumnsByOptions } from './constants'; /** * Financial statement - Display columns by and type select. diff --git a/src/containers/FinancialStatements/TrialBalanceSheet/TrialBalanceSheet.js b/src/containers/FinancialStatements/TrialBalanceSheet/TrialBalanceSheet.js index 0025b933a..5f5f07697 100644 --- a/src/containers/FinancialStatements/TrialBalanceSheet/TrialBalanceSheet.js +++ b/src/containers/FinancialStatements/TrialBalanceSheet/TrialBalanceSheet.js @@ -33,7 +33,7 @@ function TrialBalanceSheet({ fromDate: moment().startOf('year').format('YYYY-MM-DD'), toDate: moment().endOf('year').format('YYYY-MM-DD'), basis: 'accural', - accountsFilter: 'all-accounts', + filterByOption: 'with-transactions', }); // Handle filter form submit. diff --git a/src/containers/FinancialStatements/TrialBalanceSheet/TrialBalanceSheetHeaderGeneralPanel.js b/src/containers/FinancialStatements/TrialBalanceSheet/TrialBalanceSheetHeaderGeneralPanel.js index eccd65a0b..97b3b952d 100644 --- a/src/containers/FinancialStatements/TrialBalanceSheet/TrialBalanceSheetHeaderGeneralPanel.js +++ b/src/containers/FinancialStatements/TrialBalanceSheet/TrialBalanceSheetHeaderGeneralPanel.js @@ -12,7 +12,7 @@ export default function TrialBalanceSheetHeaderGeneralPanel({ return (
- +
); diff --git a/src/containers/FinancialStatements/VendorsBalanceSummary/VendorsBalanceSummary.js b/src/containers/FinancialStatements/VendorsBalanceSummary/VendorsBalanceSummary.js index 72a443e65..894279804 100644 --- a/src/containers/FinancialStatements/VendorsBalanceSummary/VendorsBalanceSummary.js +++ b/src/containers/FinancialStatements/VendorsBalanceSummary/VendorsBalanceSummary.js @@ -30,6 +30,7 @@ function VendorsBalanceSummary({ }) { const [filter, setFilter] = useState({ asDate: moment().endOf('day').format('YYYY-MM-DD'), + filterByOption: 'with-transactions', }); // Handle refetch vendors balance summary. diff --git a/src/containers/FinancialStatements/VendorsBalanceSummary/VendorsBalanceSummaryHeaderGeneralContent.js b/src/containers/FinancialStatements/VendorsBalanceSummary/VendorsBalanceSummaryHeaderGeneralContent.js index c5d81eadb..f1f824797 100644 --- a/src/containers/FinancialStatements/VendorsBalanceSummary/VendorsBalanceSummaryHeaderGeneralContent.js +++ b/src/containers/FinancialStatements/VendorsBalanceSummary/VendorsBalanceSummaryHeaderGeneralContent.js @@ -11,7 +11,7 @@ import { FieldHint, FormattedMessage as T, } from '../../../components'; -import { filterVendorsOptions } from '../common'; +import { filterVendorsOptions } from '../constants'; import { momentFormatter, @@ -77,7 +77,7 @@ export default function VendorsBalanceSummaryHeaderGeneralContent() { } - initialSelectedItem={'all-vendors'} + initialSelectedItem={'with-transactions'} /> diff --git a/src/containers/FinancialStatements/VendorsTransactions/VendorsTransactions.js b/src/containers/FinancialStatements/VendorsTransactions/VendorsTransactions.js index e6cb8ee64..f28fb6313 100644 --- a/src/containers/FinancialStatements/VendorsTransactions/VendorsTransactions.js +++ b/src/containers/FinancialStatements/VendorsTransactions/VendorsTransactions.js @@ -31,6 +31,7 @@ function VendorsTransactions({ const [filter, setFilter] = useState({ fromDate: moment().startOf('year').format('YYYY-MM-DD'), toDate: moment().endOf('year').format('YYYY-MM-DD'), + filterByOption: 'with-transactions', }); const handleFilterSubmit = (filter) => { diff --git a/src/containers/FinancialStatements/VendorsTransactions/VendorsTransactionsHeaderGeneralPanel.js b/src/containers/FinancialStatements/VendorsTransactions/VendorsTransactionsHeaderGeneralPanel.js index b7bfacfa2..94c8b578d 100644 --- a/src/containers/FinancialStatements/VendorsTransactions/VendorsTransactionsHeaderGeneralPanel.js +++ b/src/containers/FinancialStatements/VendorsTransactions/VendorsTransactionsHeaderGeneralPanel.js @@ -12,7 +12,7 @@ import { ContactsMultiSelect, FormattedMessage as T, } from '../../../components'; -import { filterVendorsOptions } from '../common'; +import { filterVendorsOptions } from '../constants'; import { VendorsTransactionsGeneralPanelProvider, diff --git a/src/containers/FinancialStatements/common.js b/src/containers/FinancialStatements/common.js index 64dc89365..54e7a4729 100644 --- a/src/containers/FinancialStatements/common.js +++ b/src/containers/FinancialStatements/common.js @@ -1,145 +1,7 @@ import * as R from 'ramda'; -import intl from 'react-intl-universal'; +import { displayColumnsByOptions } from './constants'; import { transfromToSnakeCase, flatten } from 'utils'; -export const displayColumnsByOptions = [ - { key: 'total', name: intl.get('total'), type: 'total', by: '' }, - { - key: 'year', - name: intl.get('date_year'), - type: 'date_periods', - by: 'year', - }, - { - key: 'month', - name: intl.get('date_month'), - type: 'date_periods', - by: 'month', - }, - { - key: 'week', - name: intl.get('date_week'), - type: 'date_periods', - by: 'month', - }, - { - key: 'day', - name: intl.get('date_day'), - type: 'date_periods', - by: 'day', - }, - { - key: 'quarter', - name: intl.get('date_quarter'), - type: 'date_periods', - by: 'quarter', - }, -]; - -export const dateRangeOptions = [ - { value: 'today', label: intl.get('today') }, - { value: 'this_week', label: intl.get('this_week') }, - { value: 'this_month', label: intl.get('this_month') }, - { value: 'this_quarter', label: intl.get('this_quarter') }, - { value: 'this_year', label: intl.get('this_year') }, - { value: 'custom', label: intl.get('custom_range') }, -]; - -export const filterAccountsOptions = [ - { - key: 'all-accounts', - name: intl.get('all_accounts'), - hint: intl.get('all_accounts_including_with_zero_balance'), - }, - { - key: 'without-zero-balance', - name: intl.get('accounts_without_zero_balance'), - hint: intl.get('include_accounts_and_exclude_zero_balance'), - }, - { - key: 'with-transactions', - name: intl.get('accounts_with_transactions'), - hint: intl.get( - 'include_accounts_once_has_transactions_on_given_date_period', - ), - }, -]; - -export const filterItemsOptions = [ - { - key: 'all-items', - name: intl.get('all_items'), - hint: intl.get('items.option_all_items.hint'), - }, - { - key: 'with-transactions', - name: intl.get('items.option_with_transactions'), - hint: intl.get('items.option_with_transactions.hint'), - }, - { - key: 'with-only-active', - name: intl.get('items.option.only_active'), - }, -]; - -export const filterCustomersOptions = [ - { - key: 'all-customers', - name: intl.get('all_customers'), - hint: intl.get('customers.option_all_customers.hint'), - }, - { - key: 'without-zero-balance', - name: intl.get('customers.option_without_zero_balance'), - hint: intl.get('customers.option_without_zero_balance.hint'), - }, - { - key: 'with-transactions', - name: intl.get('customers.option_with_transactions'), - hint: intl.get('customers.option_with_transactions.hint'), - }, -]; - -export const filterVendorsOptions = [ - { - key: 'all-vendors', - name: intl.get('all_vendors'), - hint: intl.get('vendors.option_all_vendors.hint'), - }, - { - key: 'without-zero-balance', - name: intl.get('vendors.option_without_zero_balance'), - hint: intl.get('vendors.option_without_zero_balance.hint'), - }, - { - key: 'with-transactions', - name: intl.get('vendors.option_with_transactions'), - hint: intl.get('vendors.option_with_transactions.hint'), - }, -]; - -export const filterInventoryValuationOptions = [ - { - key: 'all-items', - name: intl.get('all_items'), - hint: intl.get('items.option_all_items.hint'), - }, - { - key: 'with-transactions', - name: intl.get('items.option_with_transactions'), - hint: intl.get('items.option_with_transactions.hint'), - }, - { - key: 'without-zero-balance', - name: intl.get('items.option_without_zero_balance'), - hint: intl.get('items.option_without_zero_balance.hint'), - }, - { - key: 'with-only-active', - name: intl.get('items.option.only_active'), - }, -] - /** * Associate display columns by and type properties to query object. */ @@ -160,14 +22,14 @@ export const transformDisplayColumnsType = (form) => { const setNoneZeroTransactions = (form) => { return { ...form, - noneZero: form.accountsFilter === 'without-zero-balance', - noneTransactions: form.accountsFilter === 'with-transactions', - onlyActive: form.accountsFilter === 'with-only-active', + noneZero: form.filterByOption === 'without-zero-balance', + noneTransactions: form.filterByOption === 'with-transactions', + onlyActive: form.filterByOption === 'with-only-active', }; }; - +// filterByOption export const transformAccountsFilter = (form) => { - return R.compose(R.omit(['accountsFilter']), setNoneZeroTransactions)(form); + return R.compose(R.omit(['filterByOption']), setNoneZeroTransactions)(form); }; /** diff --git a/src/containers/FinancialStatements/constants.js b/src/containers/FinancialStatements/constants.js new file mode 100644 index 000000000..315a00041 --- /dev/null +++ b/src/containers/FinancialStatements/constants.js @@ -0,0 +1,141 @@ + +import intl from 'react-intl-universal'; + + +export const displayColumnsByOptions = [ + { key: 'total', name: intl.get('total'), type: 'total', by: '' }, + { + key: 'year', + name: intl.get('date_year'), + type: 'date_periods', + by: 'year', + }, + { + key: 'month', + name: intl.get('date_month'), + type: 'date_periods', + by: 'month', + }, + { + key: 'week', + name: intl.get('date_week'), + type: 'date_periods', + by: 'month', + }, + { + key: 'day', + name: intl.get('date_day'), + type: 'date_periods', + by: 'day', + }, + { + key: 'quarter', + name: intl.get('date_quarter'), + type: 'date_periods', + by: 'quarter', + }, +]; + +export const dateRangeOptions = [ + { value: 'today', label: intl.get('today') }, + { value: 'this_week', label: intl.get('this_week') }, + { value: 'this_month', label: intl.get('this_month') }, + { value: 'this_quarter', label: intl.get('this_quarter') }, + { value: 'this_year', label: intl.get('this_year') }, + { value: 'custom', label: intl.get('custom_range') }, +]; + +export const filterAccountsOptions = [ + { + key: 'all-accounts', + name: intl.get('all_accounts'), + hint: intl.get('all_accounts_including_with_zero_balance'), + }, + { + key: 'without-zero-balance', + name: intl.get('accounts_without_zero_balance'), + hint: intl.get('include_accounts_and_exclude_zero_balance'), + }, + { + key: 'with-transactions', + name: intl.get('accounts_with_transactions'), + hint: intl.get( + 'include_accounts_once_has_transactions_on_given_date_period', + ), + }, +]; + +export const filterItemsOptions = [ + { + key: 'all-items', + name: intl.get('all_items'), + hint: intl.get('items.option_all_items.hint'), + }, + { + key: 'with-transactions', + name: intl.get('items.option_with_transactions'), + hint: intl.get('items.option_with_transactions.hint'), + }, + { + key: 'with-only-active', + name: intl.get('items.option.only_active'), + }, +]; + +export const filterCustomersOptions = [ + { + key: 'all-customers', + name: intl.get('all_customers'), + hint: intl.get('customers.option_all_customers.hint'), + }, + { + key: 'without-zero-balance', + name: intl.get('customers.option_without_zero_balance'), + hint: intl.get('customers.option_without_zero_balance.hint'), + }, + { + key: 'with-transactions', + name: intl.get('customers.option_with_transactions'), + hint: intl.get('customers.option_with_transactions.hint'), + }, +]; + +export const filterVendorsOptions = [ + { + key: 'all-vendors', + name: intl.get('all_vendors'), + hint: intl.get('vendors.option_all_vendors.hint'), + }, + { + key: 'without-zero-balance', + name: intl.get('vendors.option_without_zero_balance'), + hint: intl.get('vendors.option_without_zero_balance.hint'), + }, + { + key: 'with-transactions', + name: intl.get('vendors.option_with_transactions'), + hint: intl.get('vendors.option_with_transactions.hint'), + }, +]; + +export const filterInventoryValuationOptions = [ + { + key: 'all-items', + name: intl.get('all_items'), + hint: intl.get('items.option_all_items.hint'), + }, + { + key: 'with-transactions', + name: intl.get('items.option_with_transactions'), + hint: intl.get('items.option_with_transactions.hint'), + }, + { + key: 'without-zero-balance', + name: intl.get('items.option_without_zero_balance'), + hint: intl.get('items.option_without_zero_balance.hint'), + }, + { + key: 'with-only-active', + name: intl.get('items.option.only_active'), + }, +] \ No newline at end of file