mirror of
https://github.com/bigcapitalhq/bigcapital.git
synced 2026-02-19 06:10:31 +00:00
wip
This commit is contained in:
@@ -26,7 +26,7 @@ export class TransactionsLockingService {
|
|||||||
constructor(
|
constructor(
|
||||||
private readonly transactionsLockingRepo: TransactionsLockingRepository,
|
private readonly transactionsLockingRepo: TransactionsLockingRepository,
|
||||||
private readonly eventPublisher: EventEmitter2,
|
private readonly eventPublisher: EventEmitter2,
|
||||||
) {}
|
) { }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Enable/disable all transacations locking.
|
* Enable/disable all transacations locking.
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ import {
|
|||||||
InputGroup,
|
InputGroup,
|
||||||
} from '@blueprintjs/core';
|
} from '@blueprintjs/core';
|
||||||
import classNames from 'classnames';
|
import classNames from 'classnames';
|
||||||
import { FormattedMessage as T, If, FFormGroup, FSelect } from '@/components';
|
import { FormattedMessage as T, If, FFormGroup, FSelect, FRadioGroup, FInputGroup } from '@/components';
|
||||||
import { handleStringChange } from '@/utils';
|
import { handleStringChange } from '@/utils';
|
||||||
import { FieldRequiredHint } from '@/components';
|
import { FieldRequiredHint } from '@/components';
|
||||||
import { CLASSES } from '@/constants/classes';
|
import { CLASSES } from '@/constants/classes';
|
||||||
@@ -31,7 +31,7 @@ export default function AllocateLandedCostFormFields() {
|
|||||||
const { costTransactionEntries, landedCostTransactions } =
|
const { costTransactionEntries, landedCostTransactions } =
|
||||||
useAllocateLandedConstDialogContext();
|
useAllocateLandedConstDialogContext();
|
||||||
|
|
||||||
const { values, setFieldValue } = useFormikContext();
|
const { values, setFieldValue, form } = useFormikContext();
|
||||||
|
|
||||||
// Handle transaction type select change.
|
// Handle transaction type select change.
|
||||||
const handleTransactionTypeChange = (type) => {
|
const handleTransactionTypeChange = (type) => {
|
||||||
@@ -137,62 +137,51 @@ export default function AllocateLandedCostFormFields() {
|
|||||||
</If>
|
</If>
|
||||||
|
|
||||||
{/*------------ Amount -----------*/}
|
{/*------------ Amount -----------*/}
|
||||||
<FastField name={'amount'}>
|
<FFormGroup
|
||||||
{({ form, field, meta: { error, touched } }) => (
|
name={'amount'}
|
||||||
<FormGroup
|
label={<T id={'amount'} />}
|
||||||
label={<T id={'amount'} />}
|
inline={true}
|
||||||
intent={inputIntent({ error, touched })}
|
fastField
|
||||||
helperText={<ErrorMessage name="amount" />}
|
>
|
||||||
className={'form-group--amount'}
|
<FInputGroup
|
||||||
inline={true}
|
name={'amount'}
|
||||||
>
|
onBlur={(e) => {
|
||||||
<InputGroup
|
const amount = e.target.value;
|
||||||
{...field}
|
const { allocation_method, items } = values;
|
||||||
onBlur={(e) => {
|
|
||||||
const amount = e.target.value;
|
|
||||||
const { allocation_method, items } = form.values;
|
|
||||||
|
|
||||||
form.setFieldValue(
|
setFieldValue(
|
||||||
'items',
|
'items',
|
||||||
allocateCostToEntries(amount, allocation_method, items),
|
allocateCostToEntries(amount, allocation_method, items),
|
||||||
);
|
);
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
</FormGroup>
|
</FFormGroup>
|
||||||
)}
|
|
||||||
</FastField>
|
|
||||||
|
|
||||||
{/*------------ Allocation method -----------*/}
|
{/*------------ Allocation method -----------*/}
|
||||||
<Field name={'allocation_method'}>
|
<FFormGroup
|
||||||
{({ form, field: { value }, meta: { touched, error } }) => (
|
name={'allocation_method'}
|
||||||
<FormGroup
|
label={<T id={'allocation_method'} />}
|
||||||
medium={true}
|
medium
|
||||||
label={<T id={'allocation_method'} />}
|
inline
|
||||||
labelInfo={<FieldRequiredHint />}
|
fastField
|
||||||
className={'form-group--allocation_method'}
|
>
|
||||||
intent={inputIntent({ error, touched })}
|
<FRadioGroup
|
||||||
helperText={<ErrorMessage name="allocation_method" />}
|
name={'allocation_method'}
|
||||||
inline={true}
|
onChange={handleStringChange((_value) => {
|
||||||
>
|
const { amount, items } = values;
|
||||||
<RadioGroup
|
|
||||||
onChange={handleStringChange((_value) => {
|
|
||||||
const { amount, items } = form.values;
|
|
||||||
|
|
||||||
form.setFieldValue('allocation_method', _value);
|
setFieldValue('allocation_method', _value);
|
||||||
form.setFieldValue(
|
setFieldValue(
|
||||||
'items',
|
'items',
|
||||||
allocateCostToEntries(amount, _value, items),
|
allocateCostToEntries(amount, _value, items),
|
||||||
);
|
);
|
||||||
})}
|
})}
|
||||||
selectedValue={value}
|
inline={true}
|
||||||
inline={true}
|
>
|
||||||
>
|
<Radio label={<T id={'quantity'} />} value="quantity" />
|
||||||
<Radio label={<T id={'quantity'} />} value="quantity" />
|
<Radio label={<T id={'valuation'} />} value="value" />
|
||||||
<Radio label={<T id={'valuation'} />} value="value" />
|
</FRadioGroup>
|
||||||
</RadioGroup>
|
</FFormGroup>
|
||||||
</FormGroup>
|
|
||||||
)}
|
|
||||||
</Field>
|
|
||||||
|
|
||||||
{/*------------ Allocate Landed cost Table -----------*/}
|
{/*------------ Allocate Landed cost Table -----------*/}
|
||||||
<AllocateLandedCostFormBody />
|
<AllocateLandedCostFormBody />
|
||||||
|
|||||||
@@ -21,7 +21,6 @@ import {
|
|||||||
FeatureCan,
|
FeatureCan,
|
||||||
BranchSelect,
|
BranchSelect,
|
||||||
WarehouseSelect,
|
WarehouseSelect,
|
||||||
BranchSelectButton,
|
|
||||||
FAccountsSuggestField,
|
FAccountsSuggestField,
|
||||||
} from '@/components';
|
} from '@/components';
|
||||||
import { momentFormatter, toSafeNumber } from '@/utils';
|
import { momentFormatter, toSafeNumber } from '@/utils';
|
||||||
@@ -78,12 +77,11 @@ export default function InventoryAdjustmentFormDialogFields() {
|
|||||||
<Col xs={5}>
|
<Col xs={5}>
|
||||||
<FormGroup
|
<FormGroup
|
||||||
label={<T id={'branch'} />}
|
label={<T id={'branch'} />}
|
||||||
className={classNames('form-group--select-list', Classes.FILL)}
|
fill
|
||||||
>
|
>
|
||||||
<BranchSelect
|
<BranchSelect
|
||||||
name={'branch_id'}
|
name={'branch_id'}
|
||||||
branches={branches}
|
branches={branches}
|
||||||
input={BranchSelectButton}
|
|
||||||
popoverProps={{ minimal: true }}
|
popoverProps={{ minimal: true }}
|
||||||
/>
|
/>
|
||||||
</FormGroup>
|
</FormGroup>
|
||||||
@@ -93,7 +91,7 @@ export default function InventoryAdjustmentFormDialogFields() {
|
|||||||
<Col xs={5}>
|
<Col xs={5}>
|
||||||
<FormGroup
|
<FormGroup
|
||||||
label={<T id={'warehouse'} />}
|
label={<T id={'warehouse'} />}
|
||||||
className={classNames('form-group--select-list', Classes.FILL)}
|
fill
|
||||||
>
|
>
|
||||||
<WarehouseSelect
|
<WarehouseSelect
|
||||||
name={'warehouse_id'}
|
name={'warehouse_id'}
|
||||||
|
|||||||
Reference in New Issue
Block a user