mirror of
https://github.com/bigcapitalhq/bigcapital.git
synced 2026-02-17 05:10:31 +00:00
WIP / Fix_ExchangeRate / localize
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
import React, { useEffect, useState, useCallback } from 'react';
|
||||
import { useParams } from 'react-router-dom';
|
||||
import useAsync from 'hooks/async';
|
||||
import { useQuery } from 'react-query';
|
||||
|
||||
import DashboardInsider from 'components/Dashboard/DashboardInsider';
|
||||
import ItemCategoriesDataTable from 'containers/Items/ItemCategoriesTable';
|
||||
@@ -8,40 +8,46 @@ import ItemsCategoryActionsBar from 'containers/Items/ItemsCategoryActionsBar';
|
||||
|
||||
import withDashboardActions from 'containers/Dashboard/withDashboard';
|
||||
import withItemCategoriesActions from 'containers/Items/withItemCategoriesActions';
|
||||
import withItemCategories from 'containers/Items/withItemCategories';
|
||||
import { compose } from 'utils';
|
||||
import { FormattedMessage as T, useIntl } from 'react-intl';
|
||||
|
||||
|
||||
const ItemCategoryList = ({
|
||||
// #withDashboardActions
|
||||
changePageTitle,
|
||||
|
||||
// #withItemCategoriesActions
|
||||
requestFetchItemCategories,
|
||||
}) => {
|
||||
const { id } = useParams();
|
||||
const [selectedRows, setSelectedRows] = useState([]);
|
||||
|
||||
const {formatMessage} =useIntl()
|
||||
useEffect(() => {
|
||||
id
|
||||
? changePageTitle('Edit Category Details')
|
||||
: changePageTitle('Category List');
|
||||
? changePageTitle(formatMessage({id:'edit_category_details'}))
|
||||
: changePageTitle(formatMessage({id:'category_list'}));
|
||||
}, []);
|
||||
|
||||
const fetchCategories = useAsync(() => {
|
||||
return Promise.all([
|
||||
requestFetchItemCategories(),
|
||||
]);
|
||||
});
|
||||
const fetchCategories = useQuery('items-categories-table',
|
||||
() => { requestFetchItemCategories(); });
|
||||
|
||||
const handleFilterChanged = useCallback(() => {
|
||||
|
||||
}, []);
|
||||
|
||||
// Handle selected rows change.
|
||||
const handleSelectedRowsChange = useCallback((itemCategories) => {
|
||||
setSelectedRows(itemCategories);
|
||||
}, [setSelectedRows]);
|
||||
|
||||
return (
|
||||
<DashboardInsider name={'item-category-list'}>
|
||||
<ItemsCategoryActionsBar
|
||||
onFilterChanged={handleFilterChanged}
|
||||
selectedRows={selectedRows} />
|
||||
|
||||
<ItemCategoriesDataTable />
|
||||
<ItemCategoriesDataTable
|
||||
onSelectedRowsChange={handleSelectedRowsChange} />
|
||||
</DashboardInsider>
|
||||
);
|
||||
};
|
||||
@@ -49,5 +55,4 @@ const ItemCategoryList = ({
|
||||
export default compose(
|
||||
withDashboardActions,
|
||||
withItemCategoriesActions,
|
||||
withItemCategories,
|
||||
)(ItemCategoryList);
|
||||
|
||||
@@ -10,6 +10,7 @@ import withAccountsActions from 'containers/Accounts/withAccountsActions';
|
||||
import withItemCategoriesActions from 'containers/Items/withItemCategoriesActions';
|
||||
|
||||
import { compose } from 'utils';
|
||||
import { FormattedMessage as T, useIntl } from 'react-intl';
|
||||
|
||||
|
||||
const ItemFormContainer = ({
|
||||
@@ -23,11 +24,11 @@ const ItemFormContainer = ({
|
||||
requestFetchItemCategories,
|
||||
}) => {
|
||||
const { id } = useParams();
|
||||
|
||||
const {formatMessage} =useIntl()
|
||||
useEffect(() => {
|
||||
id ?
|
||||
changePageTitle('Edit Item Details') :
|
||||
changePageTitle('New Item');
|
||||
changePageTitle(formatMessage({id:'edit_item_details'})) :
|
||||
changePageTitle(formatMessage({id:'new_item'}));
|
||||
}, [id, changePageTitle]);
|
||||
|
||||
const fetchAccounts = useQuery('accounts-list',
|
||||
|
||||
Reference in New Issue
Block a user