mirror of
https://github.com/bigcapitalhq/bigcapital.git
synced 2026-02-17 13:20:31 +00:00
Merge remote-tracking branch 'origin/feature/breadcrumb/fix_localize'
This commit is contained in:
@@ -57,21 +57,21 @@ const ItemForm = ({
|
||||
});
|
||||
|
||||
const ItemTypeDisplay = useMemo(() => [
|
||||
{ value: null, label: 'Select Item Type' },
|
||||
{ value: 'service', label: 'Service' },
|
||||
{ value: 'inventory', label: 'Inventory' },
|
||||
{ value: 'non-inventory', label: 'Non-Inventory' },
|
||||
{ value: null, label: formatMessage({id:'select_item_type'}) },
|
||||
{ value: 'service', label: formatMessage({id:'service'}) },
|
||||
{ value: 'inventory', label: formatMessage({id:'inventory'}) },
|
||||
{ value: 'non-inventory', label: formatMessage({id:'non_inventory'}) },
|
||||
], []);
|
||||
|
||||
const validationSchema = Yup.object().shape({
|
||||
active: Yup.boolean(),
|
||||
name: Yup.string().required(),
|
||||
type: Yup.string().trim().required(),
|
||||
name: Yup.string().required().label(formatMessage({id:'item_name_'})),
|
||||
type: Yup.string().trim().required().label(formatMessage({id:'item_type_'})),
|
||||
sku: Yup.string().trim(),
|
||||
cost_price: Yup.number(),
|
||||
sell_price: Yup.number(),
|
||||
cost_account_id: Yup.number().required(),
|
||||
sell_account_id: Yup.number().required(),
|
||||
cost_account_id: Yup.number().required().label(formatMessage({id:'cost_account_id'})),
|
||||
sell_account_id: Yup.number().required().label(formatMessage({id:'sell_account_id'})),
|
||||
inventory_account_id: Yup.number().when('type', {
|
||||
is: (value) => value === 'inventory',
|
||||
then: Yup.number().required(),
|
||||
@@ -308,7 +308,7 @@ const ItemForm = ({
|
||||
rightIcon='caret-down'
|
||||
text={getSelectedAccountLabel(
|
||||
'category_id',
|
||||
'Select category'
|
||||
formatMessage({id:'select_category'})
|
||||
)}
|
||||
/>
|
||||
</Select>
|
||||
@@ -399,7 +399,7 @@ const ItemForm = ({
|
||||
rightIcon='caret-down'
|
||||
text={getSelectedAccountLabel(
|
||||
'sell_account_id',
|
||||
'Select account'
|
||||
formatMessage({id:'select_account'})
|
||||
)}
|
||||
/>
|
||||
</Select>
|
||||
@@ -462,7 +462,8 @@ const ItemForm = ({
|
||||
rightIcon='caret-down'
|
||||
text={getSelectedAccountLabel(
|
||||
'cost_account_id',
|
||||
'Select account'
|
||||
formatMessage({id:'select_account'})
|
||||
|
||||
)}
|
||||
/>
|
||||
</Select>
|
||||
@@ -508,7 +509,8 @@ const ItemForm = ({
|
||||
rightIcon='caret-down'
|
||||
text={getSelectedAccountLabel(
|
||||
'inventory_account_id',
|
||||
'Select account'
|
||||
formatMessage({id:'select_account'})
|
||||
|
||||
)}
|
||||
/>
|
||||
</Select>
|
||||
|
||||
@@ -38,23 +38,26 @@ const ItemsActionsBar = ({
|
||||
const { path } = useRouteMatch();
|
||||
const history = useHistory();
|
||||
const [filterCount, setFilterCount] = useState(0);
|
||||
|
||||
const viewsMenuItems = itemsViews.map(view =>
|
||||
(<MenuItem href={`${path}/${view.id}/custom_view`} text={view.name} />));
|
||||
const { formatMessage } = useIntl();
|
||||
const viewsMenuItems = itemsViews.map((view) => (
|
||||
<MenuItem href={`${path}/${view.id}/custom_view`} text={view.name} />
|
||||
));
|
||||
|
||||
const onClickNewItem = () => {
|
||||
history.push('/dashboard/items/new');
|
||||
history.push('/items/new');
|
||||
};
|
||||
const hasSelectedRows = useMemo(() => selectedRows.length > 0, [selectedRows]);
|
||||
const hasSelectedRows = useMemo(() => selectedRows.length > 0, [
|
||||
selectedRows,
|
||||
]);
|
||||
|
||||
const filterDropdown = FilterDropdown({
|
||||
fields: resourceFields,
|
||||
onFilterChange: (filterConditions) => {
|
||||
setFilterCount(filterConditions.length);
|
||||
onFilterChanged && onFilterChanged(filterConditions);
|
||||
}
|
||||
},
|
||||
});
|
||||
|
||||
|
||||
const onClickNewCategory = useCallback(() => {
|
||||
openDialog('item-form', {});
|
||||
}, [openDialog]);
|
||||
@@ -71,7 +74,7 @@ const ItemsActionsBar = ({
|
||||
<Button
|
||||
className={classNames(Classes.MINIMAL, 'button--table-views')}
|
||||
icon={<Icon icon='table' />}
|
||||
text={<T id={'table_views'}/>}
|
||||
text={<T id={'table_views'} />}
|
||||
rightIcon={'caret-down'}
|
||||
/>
|
||||
</Popover>
|
||||
@@ -81,14 +84,14 @@ const ItemsActionsBar = ({
|
||||
<Button
|
||||
className={Classes.MINIMAL}
|
||||
icon={<Icon icon='plus' />}
|
||||
text={<T id={'new_item'}/>}
|
||||
text={<T id={'new_item'} />}
|
||||
onClick={onClickNewItem}
|
||||
/>
|
||||
|
||||
<Button
|
||||
className={Classes.MINIMAL}
|
||||
icon={<Icon icon='plus' />}
|
||||
text={<T id={'new_category'}/>}
|
||||
text={<T id={'new_category'} />}
|
||||
onClick={onClickNewCategory}
|
||||
/>
|
||||
|
||||
@@ -99,7 +102,13 @@ const ItemsActionsBar = ({
|
||||
>
|
||||
<Button
|
||||
className={classNames(Classes.MINIMAL, 'button--filter')}
|
||||
text={filterCount <= 0 ? <T id={'filter'}/> : `${filterCount} filters applied`}
|
||||
text={
|
||||
filterCount <= 0 ? (
|
||||
<T id={'filter'} />
|
||||
) : (
|
||||
`${filterCount} ${formatMessage({ id: 'filters_applied' })}`
|
||||
)
|
||||
}
|
||||
icon={<Icon icon='filter' />}
|
||||
/>
|
||||
</Popover>
|
||||
@@ -109,19 +118,19 @@ const ItemsActionsBar = ({
|
||||
className={Classes.MINIMAL}
|
||||
intent={Intent.DANGER}
|
||||
icon={<Icon icon='trash' />}
|
||||
text={<T id={'delete'}/>}
|
||||
text={<T id={'delete'} />}
|
||||
/>
|
||||
</If>
|
||||
|
||||
<Button
|
||||
className={Classes.MINIMAL}
|
||||
icon={<Icon icon='file-import' />}
|
||||
text={<T id={'import'}/>}
|
||||
text={<T id={'import'} />}
|
||||
/>
|
||||
<Button
|
||||
className={Classes.MINIMAL}
|
||||
icon={<Icon icon='file-export' />}
|
||||
text={<T id={'export'}/>}
|
||||
text={<T id={'export'} />}
|
||||
/>
|
||||
</NavbarGroup>
|
||||
</DashboardActionsBar>
|
||||
@@ -135,5 +144,5 @@ export default compose(
|
||||
})),
|
||||
withResourceDetail(({ resourceFields }) => ({
|
||||
resourceFields,
|
||||
})),
|
||||
}))
|
||||
)(ItemsActionsBar);
|
||||
|
||||
@@ -50,7 +50,7 @@ function ItemsList({
|
||||
const { formatMessage } = useIntl();
|
||||
|
||||
useEffect(() => {
|
||||
changePageTitle('Items List');
|
||||
changePageTitle(formatMessage({id:'items_list'}));
|
||||
}, [changePageTitle]);
|
||||
|
||||
const fetchHook = useQuery('items-resource', () => {
|
||||
@@ -135,8 +135,8 @@ function ItemsList({
|
||||
<Route
|
||||
exact={true}
|
||||
path={[
|
||||
'/dashboard/items/:custom_view_id/custom_view',
|
||||
'/dashboard/items'
|
||||
'/items/:custom_view_id/custom_view',
|
||||
'/items'
|
||||
]}>
|
||||
<ItemsViewsTabs
|
||||
onViewChanged={handleCustomViewChanged} />
|
||||
|
||||
@@ -20,6 +20,7 @@ import withDashboard from 'containers/Dashboard/withDashboard';
|
||||
import withViewDetail from 'containers/Views/withViewDetails';
|
||||
import withItems from 'containers/Items/withItems';
|
||||
|
||||
import { FormattedMessage as T, useIntl } from 'react-intl';
|
||||
|
||||
function ItemsViewsTabs({
|
||||
// #withViewDetail
|
||||
@@ -45,7 +46,7 @@ function ItemsViewsTabs({
|
||||
|
||||
const handleClickNewView = () => {
|
||||
setTopbarEditView(null);
|
||||
history.push('/dashboard/custom_views/items/new');
|
||||
history.push('/custom_views/items/new');
|
||||
};
|
||||
|
||||
const handleViewLinkClick = () => {
|
||||
@@ -73,7 +74,7 @@ function ItemsViewsTabs({
|
||||
}, [customViewId]);
|
||||
|
||||
const tabs = itemsViews.map(view => {
|
||||
const baseUrl = '/dashboard/items';
|
||||
const baseUrl = '/items';
|
||||
const link = (
|
||||
<Link to={`${baseUrl}/${view.id}/custom_view`} onClick={handleViewLinkClick}>
|
||||
{view.name}
|
||||
@@ -93,7 +94,7 @@ function ItemsViewsTabs({
|
||||
>
|
||||
<Tab
|
||||
id='all'
|
||||
title={<Link to={`/dashboard/items`}>All</Link>}
|
||||
title={<Link to={`/items`}><T id={'all'}/></Link>}
|
||||
onClick={handleViewLinkClick} />
|
||||
|
||||
{tabs}
|
||||
|
||||
Reference in New Issue
Block a user