mirror of
https://github.com/bigcapitalhq/bigcapital.git
synced 2026-02-18 13:50:31 +00:00
fix Merge conflict.
This commit is contained in:
@@ -3,9 +3,9 @@ import {
|
||||
ColumnsDirective,
|
||||
ColumnDirective,
|
||||
Inject,
|
||||
Sort,
|
||||
Sort
|
||||
} from '@syncfusion/ej2-react-grids';
|
||||
import React, {useEffect} from 'react';
|
||||
import React, { useEffect } from 'react';
|
||||
import {
|
||||
Button,
|
||||
Popover,
|
||||
@@ -13,9 +13,9 @@ import {
|
||||
MenuItem,
|
||||
MenuDivider,
|
||||
Position,
|
||||
Checkbox,
|
||||
Checkbox
|
||||
} from '@blueprintjs/core';
|
||||
import {useParams} from 'react-router-dom';
|
||||
import { useParams } from 'react-router-dom';
|
||||
import useAsync from 'hooks/async';
|
||||
import Icon from 'components/Icon';
|
||||
import { handleBooleanChange, compose } from 'utils';
|
||||
@@ -71,96 +71,118 @@ function AccountsDataTable({
|
||||
}
|
||||
}, [customViewId]);
|
||||
|
||||
useEffect(() => () => {
|
||||
// Clear page subtitle when unmount the page.
|
||||
changePageSubtitle('');
|
||||
}, []);
|
||||
useEffect(
|
||||
() => () => {
|
||||
// Clear page subtitle when unmount the page.
|
||||
changePageSubtitle('');
|
||||
},
|
||||
[]
|
||||
);
|
||||
|
||||
const handleEditAccount = (account) => () => {
|
||||
openDialog('account-form', {action: 'edit', id: account.id});
|
||||
const handleEditAccount = account => () => {
|
||||
openDialog('account-form', { action: 'edit', id: account.id });
|
||||
};
|
||||
const actionMenuList = (account) =>
|
||||
(<Menu>
|
||||
<MenuItem text="View Details" />
|
||||
const actionMenuList = account => (
|
||||
<Menu>
|
||||
<MenuItem text='View Details' />
|
||||
<MenuDivider />
|
||||
<MenuItem text="Edit Account" onClick={handleEditAccount(account)} />
|
||||
<MenuItem text="New Account" />
|
||||
<MenuItem text='Edit Account' onClick={handleEditAccount(account)} />
|
||||
<MenuItem text='New Account' />
|
||||
<MenuDivider />
|
||||
<MenuItem text="Inactivate Account" onClick={() => onInactiveAccount(account)} />
|
||||
<MenuItem text="Delete Account" onClick={() => onDeleteAccount(account)} />
|
||||
</Menu>);
|
||||
|
||||
const handleClickCheckboxBulk = (account) => handleBooleanChange((value) => {
|
||||
if (value) {
|
||||
addBulkActionAccount(account.id);
|
||||
} else {
|
||||
removeBulkActionAccount(account.id);
|
||||
}
|
||||
});
|
||||
<MenuItem
|
||||
text='Inactivate Account'
|
||||
onClick={() => onInactiveAccount(account)}
|
||||
/>
|
||||
<MenuItem
|
||||
text='Delete Account'
|
||||
onClick={() => onDeleteAccount(account)}
|
||||
/>
|
||||
</Menu>
|
||||
);
|
||||
|
||||
const handleClickCheckboxBulk = account =>
|
||||
handleBooleanChange(value => {
|
||||
if (value) {
|
||||
addBulkActionAccount(account.id);
|
||||
} else {
|
||||
removeBulkActionAccount(account.id);
|
||||
}
|
||||
});
|
||||
|
||||
const columns = [
|
||||
{
|
||||
field: '',
|
||||
headerText: '',
|
||||
template: (account) => (<Checkbox onChange={handleClickCheckboxBulk(account)} />),
|
||||
customAttributes: {class: 'checkbox-row'}
|
||||
template: account => (
|
||||
<Checkbox onChange={handleClickCheckboxBulk(account)} />
|
||||
),
|
||||
customAttributes: { class: 'checkbox-row' }
|
||||
},
|
||||
{
|
||||
field: 'name',
|
||||
headerText: 'Account Name',
|
||||
customAttributes: {class: 'account-name'},
|
||||
customAttributes: { class: 'account-name' }
|
||||
},
|
||||
{
|
||||
field: 'code',
|
||||
headerText: 'Code',
|
||||
headerText: 'Code'
|
||||
},
|
||||
{
|
||||
field: 'type.name',
|
||||
headerText: 'Type',
|
||||
headerText: 'Type'
|
||||
},
|
||||
{
|
||||
headerText: 'Normal',
|
||||
template: (column) => {
|
||||
template: column => {
|
||||
const type = column.type ? column.type.normal : '';
|
||||
return type === 'credit' ? (<Icon icon={'arrow-down'} />) : ((<Icon icon={'arrow-up'} />));
|
||||
return type === 'credit' ? (
|
||||
<Icon icon={'arrow-down'} />
|
||||
) : (
|
||||
<Icon icon={'arrow-up'} />
|
||||
);
|
||||
},
|
||||
customAttributes: {class: 'account-normal'},
|
||||
customAttributes: { class: 'account-normal' }
|
||||
},
|
||||
{
|
||||
field: 'balance',
|
||||
headerText: 'Balance',
|
||||
template: (column, data) => { return <span>$10,000</span>; },
|
||||
template: (column, data) => {
|
||||
return <span>$10,000</span>;
|
||||
}
|
||||
},
|
||||
{
|
||||
headerText: '',
|
||||
template: (account) => (
|
||||
<Popover content={actionMenuList(account)} position={Position.RIGHT_BOTTOM}>
|
||||
<Button icon={<Icon icon="ellipsis-h" />} />
|
||||
template: account => (
|
||||
<Popover
|
||||
content={actionMenuList(account)}
|
||||
position={Position.RIGHT_BOTTOM}
|
||||
>
|
||||
<Button icon={<Icon icon='ellipsis-h' />} />
|
||||
</Popover>
|
||||
),
|
||||
)
|
||||
}
|
||||
];
|
||||
|
||||
const dataStateChange = (state) => {
|
||||
|
||||
}
|
||||
const dataStateChange = state => {};
|
||||
return (
|
||||
<LoadingIndicator loading={fetchHook.pending} spinnerSize={30}>
|
||||
<GridComponent
|
||||
allowSorting={true}
|
||||
allowGrouping={true}
|
||||
dataSource={{result: accounts, count: 12}}
|
||||
dataSource={{ result: accounts, count: 12 }}
|
||||
dataStateChange={dataStateChange}
|
||||
>
|
||||
>
|
||||
<ColumnsDirective>
|
||||
{columns.map((column) => {
|
||||
return (<ColumnDirective
|
||||
field={column.field}
|
||||
headerText={column.headerText}
|
||||
template={column.template}
|
||||
allowSorting={true}
|
||||
customAttributes={column.customAttributes}
|
||||
/>);
|
||||
{columns.map(column => {
|
||||
return (
|
||||
<ColumnDirective
|
||||
field={column.field}
|
||||
headerText={column.headerText}
|
||||
template={column.template}
|
||||
allowSorting={true}
|
||||
customAttributes={column.customAttributes}
|
||||
/>
|
||||
);
|
||||
})}
|
||||
</ColumnsDirective>
|
||||
<Inject services={[Sort]} />
|
||||
@@ -173,5 +195,5 @@ export default compose(
|
||||
AccountsConnect,
|
||||
DialogConnect,
|
||||
DashboardConnect,
|
||||
ViewConnect,
|
||||
)(AccountsDataTable);
|
||||
ViewConnect
|
||||
)(AccountsDataTable);
|
||||
|
||||
Reference in New Issue
Block a user