mirror of
https://github.com/bigcapitalhq/bigcapital.git
synced 2026-02-21 07:10:33 +00:00
Merge pull request #34 from bigcapitalhq/BIG-351-invalid-date-in-the-inventory-adjustment-detail
Big 351 invalid date in the inventory adjustment detail
This commit is contained in:
73
src/components/Accounts/AccountMultiSelect.js
Normal file
73
src/components/Accounts/AccountMultiSelect.js
Normal file
@@ -0,0 +1,73 @@
|
|||||||
|
import React from 'react';
|
||||||
|
import styled from 'styled-components';
|
||||||
|
import { MenuItem } from '@blueprintjs/core';
|
||||||
|
import { FMultiSelect } from '../Forms';
|
||||||
|
import classNames from 'classnames';
|
||||||
|
import { Classes } from '@blueprintjs/popover2';
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @param {*} query
|
||||||
|
* @param {*} account
|
||||||
|
* @param {*} _index
|
||||||
|
* @param {*} exactMatch
|
||||||
|
* @returns
|
||||||
|
*/
|
||||||
|
const accountItemPredicate = (query, account, _index, exactMatch) => {
|
||||||
|
const normalizedTitle = account.name.toLowerCase();
|
||||||
|
const normalizedQuery = query.toLowerCase();
|
||||||
|
|
||||||
|
if (exactMatch) {
|
||||||
|
return normalizedTitle === normalizedQuery;
|
||||||
|
} else {
|
||||||
|
return `${account.code}. ${normalizedTitle}`.indexOf(normalizedQuery) >= 0;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @param {*} account
|
||||||
|
* @param {*} param1
|
||||||
|
* @returns
|
||||||
|
*/
|
||||||
|
const accountItemRenderer = (
|
||||||
|
account,
|
||||||
|
{ handleClick, modifiers, query },
|
||||||
|
{ isSelected },
|
||||||
|
) => {
|
||||||
|
return (
|
||||||
|
<MenuItem
|
||||||
|
icon={isSelected ? 'tick' : 'blank'}
|
||||||
|
text={account.name}
|
||||||
|
label={account.code}
|
||||||
|
key={account.id}
|
||||||
|
onClick={handleClick}
|
||||||
|
/>
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
|
const accountSelectProps = {
|
||||||
|
itemPredicate: accountItemPredicate,
|
||||||
|
itemRenderer: accountItemRenderer,
|
||||||
|
valueAccessor: (item) => item.id,
|
||||||
|
labelAccessor: (item) => item.code,
|
||||||
|
tagRenderer: (item) => item.name,
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* branches mulit select.
|
||||||
|
* @param {*} param0
|
||||||
|
* @returns {JSX.Element}
|
||||||
|
*/
|
||||||
|
export function AccountMultiSelect({ accounts, ...rest }) {
|
||||||
|
return (
|
||||||
|
<FMultiSelect
|
||||||
|
items={accounts}
|
||||||
|
popoverProps={{
|
||||||
|
minimal: true,
|
||||||
|
}}
|
||||||
|
{...accountSelectProps}
|
||||||
|
{...rest}
|
||||||
|
/>
|
||||||
|
);
|
||||||
|
}
|
||||||
1
src/components/Accounts/index.js
Normal file
1
src/components/Accounts/index.js
Normal file
@@ -0,0 +1 @@
|
|||||||
|
export * from './AccountMultiSelect';
|
||||||
@@ -104,6 +104,7 @@ export * from './Warehouses';
|
|||||||
export * from './Currencies';
|
export * from './Currencies';
|
||||||
export * from './FormTopbar'
|
export * from './FormTopbar'
|
||||||
export * from './Paper';
|
export * from './Paper';
|
||||||
|
export * from './Accounts'
|
||||||
|
|
||||||
const Hint = FieldHint;
|
const Hint = FieldHint;
|
||||||
|
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ import intl from 'react-intl-universal';
|
|||||||
import { defaultTo } from 'lodash';
|
import { defaultTo } from 'lodash';
|
||||||
import clsx from 'classnames';
|
import clsx from 'classnames';
|
||||||
|
|
||||||
import { DetailsMenu, DetailItem } from 'components';
|
import { DetailsMenu, DetailItem, FormatDate } from 'components';
|
||||||
import { useInventoryAdjustmentDrawerContext } from './InventoryAdjustmentDrawerProvider';
|
import { useInventoryAdjustmentDrawerContext } from './InventoryAdjustmentDrawerProvider';
|
||||||
|
|
||||||
import InventoryAdjustmentDrawerCls from 'style/components/Drawers/InventoryAdjustmentDrawer.module.scss';
|
import InventoryAdjustmentDrawerCls from 'style/components/Drawers/InventoryAdjustmentDrawer.module.scss';
|
||||||
@@ -20,7 +20,7 @@ export default function InventoryAdjustmentDetailHeader() {
|
|||||||
<div className={clsx(InventoryAdjustmentDrawerCls.detail_panel_header)}>
|
<div className={clsx(InventoryAdjustmentDrawerCls.detail_panel_header)}>
|
||||||
<DetailsMenu direction={'horizantal'} minLabelSize={'180px'}>
|
<DetailsMenu direction={'horizantal'} minLabelSize={'180px'}>
|
||||||
<DetailItem label={intl.get('date')}>
|
<DetailItem label={intl.get('date')}>
|
||||||
{moment(inventoryAdjustment.date).format('YYYY MMM DD')}
|
<FormatDate value={inventoryAdjustment.date} />
|
||||||
</DetailItem>
|
</DetailItem>
|
||||||
|
|
||||||
<DetailItem label={intl.get('type')}>
|
<DetailItem label={intl.get('type')}>
|
||||||
@@ -36,7 +36,7 @@ export default function InventoryAdjustmentDetailHeader() {
|
|||||||
</DetailItem>
|
</DetailItem>
|
||||||
|
|
||||||
<DetailItem label={intl.get('published_at')}>
|
<DetailItem label={intl.get('published_at')}>
|
||||||
{moment(inventoryAdjustment.published_at).format('YYYY MMM DD')}
|
<FormatDate value={inventoryAdjustment.published_at} />
|
||||||
</DetailItem>
|
</DetailItem>
|
||||||
|
|
||||||
<DetailItem label={intl.get('reason')}>
|
<DetailItem label={intl.get('reason')}>
|
||||||
@@ -44,7 +44,7 @@ export default function InventoryAdjustmentDetailHeader() {
|
|||||||
</DetailItem>
|
</DetailItem>
|
||||||
|
|
||||||
<DetailItem label={intl.get('created_at')}>
|
<DetailItem label={intl.get('created_at')}>
|
||||||
{moment(inventoryAdjustment.created_at).format('YYYY MMM DD')}
|
<FormatDate value={inventoryAdjustment.created_at} />
|
||||||
</DetailItem>
|
</DetailItem>
|
||||||
</DetailsMenu>
|
</DetailsMenu>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -3,7 +3,8 @@ import { FormGroup, Classes } from '@blueprintjs/core';
|
|||||||
import { FormattedMessage as T } from 'components';
|
import { FormattedMessage as T } from 'components';
|
||||||
import classNames from 'classnames';
|
import classNames from 'classnames';
|
||||||
|
|
||||||
import { AccountsMultiSelect, Row, Col } from 'components';
|
import { AccountMultiSelect, Row, Col } from 'components';
|
||||||
|
import { FFormGroup } from '../../../components/Forms';
|
||||||
|
|
||||||
import FinancialStatementDateRange from 'containers/FinancialStatements/FinancialStatementDateRange';
|
import FinancialStatementDateRange from 'containers/FinancialStatements/FinancialStatementDateRange';
|
||||||
import RadiosAccountingBasis from '../RadiosAccountingBasis';
|
import RadiosAccountingBasis from '../RadiosAccountingBasis';
|
||||||
@@ -44,12 +45,13 @@ function GLHeaderGeneralPaneContent() {
|
|||||||
</Row>
|
</Row>
|
||||||
<Row>
|
<Row>
|
||||||
<Col xs={4}>
|
<Col xs={4}>
|
||||||
<FormGroup
|
<FFormGroup
|
||||||
label={<T id={'specific_accounts'} />}
|
label={<T id={'specific_accounts'} />}
|
||||||
className={classNames('form-group--select-list', Classes.FILL)}
|
name={'accounts'}
|
||||||
|
className={Classes.FILL}
|
||||||
>
|
>
|
||||||
<AccountsMultiSelect items={accounts} />
|
<AccountMultiSelect name="accounts" accounts={accounts} />
|
||||||
</FormGroup>
|
</FFormGroup>
|
||||||
</Col>
|
</Col>
|
||||||
</Row>
|
</Row>
|
||||||
|
|
||||||
|
|||||||
@@ -32,6 +32,7 @@ export const getDefaultGeneralLedgerQuery = () => {
|
|||||||
basis: 'accural',
|
basis: 'accural',
|
||||||
filterByOption: 'with-transactions',
|
filterByOption: 'with-transactions',
|
||||||
branchesIds: [],
|
branchesIds: [],
|
||||||
|
accounts: [],
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user