diff --git a/packages/webapp/src/components/Forms/FMoneyInputGroup.tsx b/packages/webapp/src/components/Forms/FMoneyInputGroup.tsx
index c0297e52d..3a381115a 100644
--- a/packages/webapp/src/components/Forms/FMoneyInputGroup.tsx
+++ b/packages/webapp/src/components/Forms/FMoneyInputGroup.tsx
@@ -1,7 +1,7 @@
// @ts-nocheck
import React from 'react';
import { Intent } from '@blueprintjs/core';
-import { Field, getIn } from 'formik';
+import { Field, FastField, getIn } from 'formik';
import { CurrencyInput } from './MoneyInputGroup';
const fieldToMoneyInputGroup = ({
@@ -32,6 +32,7 @@ function FieldToMoneyInputGroup({ ...props }) {
return ;
}
-export function FMoneyInputGroup({ ...props }) {
- return ;
+export function FMoneyInputGroup({ fastField, ...props }) {
+ const FieldComponent = fastField ? FastField : Field;
+ return ;
}
diff --git a/packages/webapp/src/containers/Dialogs/InventoryAdjustmentFormDialog/IncrementAdjustmentFields.tsx b/packages/webapp/src/containers/Dialogs/InventoryAdjustmentFormDialog/IncrementAdjustmentFields.tsx
index 1373f2f7b..d78adc62b 100644
--- a/packages/webapp/src/containers/Dialogs/InventoryAdjustmentFormDialog/IncrementAdjustmentFields.tsx
+++ b/packages/webapp/src/containers/Dialogs/InventoryAdjustmentFormDialog/IncrementAdjustmentFields.tsx
@@ -1,35 +1,38 @@
// @ts-nocheck
import React from 'react';
-import { Field, FastField, ErrorMessage } from 'formik';
-import { FormGroup, InputGroup } from '@blueprintjs/core';
+import { useFormikContext } from 'formik';
import { useAutofocus } from '@/hooks';
-import { Row, Col, MoneyInputGroup, FormattedMessage as T } from '@/components';
-import { inputIntent, toSafeNumber } from '@/utils';
+import {
+ Row,
+ Col,
+ FMoneyInputGroup,
+ FormattedMessage as T,
+ FFormGroup,
+ FInputGroup,
+} from '@/components';
+import { toSafeNumber } from '@/utils';
import { decrementQuantity, incrementQuantity } from './utils';
export default function IncrementAdjustmentFields() {
const incrementFieldRef = useAutofocus();
+ const { values, setFieldValue } = useFormikContext();
return (
{/*------------ Quantity on hand -----------*/}
-
- {({ field, meta: { error, touched } }) => (
- }
- intent={inputIntent({ error, touched })}
- helperText={}
- >
-
-
- )}
-
+ }
+ fastField
+ >
+
+
{/*------------ Sign -----------*/}
@@ -39,65 +42,36 @@ export default function IncrementAdjustmentFields() {
{/*------------ Increment -----------*/}
-
- {({
- form: { values, setFieldValue },
- field,
- meta: { error, touched },
- }) => (
- }
- intent={inputIntent({ error, touched })}
- helperText={}
- fill={true}
- >
- (incrementFieldRef.current = ref)}
- onChange={(value) => {
- setFieldValue('quantity', value);
- }}
- onBlurValue={(value) => {
- setFieldValue(
- 'new_quantity',
- incrementQuantity(
- toSafeNumber(value),
- toSafeNumber(values.quantity_on_hand),
- ),
- );
- }}
- intent={inputIntent({ error, touched })}
- />
-
- )}
-
+ }
+ fill
+ fastField
+ >
+ (incrementFieldRef.current = ref)}
+ onBlurValue={(value) => {
+ setFieldValue(
+ 'new_quantity',
+ incrementQuantity(
+ toSafeNumber(value),
+ toSafeNumber(values.quantity_on_hand),
+ ),
+ );
+ }}
+ fastField
+ />
+
{/*------------ Cost -----------*/}
-
- {({
- form: { setFieldValue },
- field: { value },
- meta: { error, touched },
- }) => (
- }
- intent={inputIntent({ error, touched })}
- helperText={}
- >
- {
- setFieldValue('cost', value);
- }}
- intent={inputIntent({ error, touched })}
- />
-
- )}
-
+ } fastField>
+
+
{/*------------ Sign -----------*/}
@@ -107,38 +81,27 @@ export default function IncrementAdjustmentFields() {
{/*------------ New quantity -----------*/}
-
- {({
- form: { values, setFieldValue },
- field,
- meta: { error, touched },
- }) => (
- }
- intent={inputIntent({ error, touched })}
- helperText={}
- >
- {
- setFieldValue('new_quantity', value);
- }}
- onBlurValue={(value) => {
- setFieldValue(
- 'quantity',
- decrementQuantity(
- toSafeNumber(value),
- toSafeNumber(values.quantity_on_hand),
- ),
- );
- }}
- intent={inputIntent({ error, touched })}
- />
-
- )}
-
+ }
+ fastField
+ >
+ {
+ setFieldValue(
+ 'quantity',
+ decrementQuantity(
+ toSafeNumber(value),
+ toSafeNumber(values.quantity_on_hand),
+ ),
+ );
+ }}
+ fastField
+ />
+
);
diff --git a/packages/webapp/src/containers/Dialogs/ItemCategoryDialog/ItemCategoryFormFields.tsx b/packages/webapp/src/containers/Dialogs/ItemCategoryDialog/ItemCategoryFormFields.tsx
index 87825a8c2..5db382cdf 100644
--- a/packages/webapp/src/containers/Dialogs/ItemCategoryDialog/ItemCategoryFormFields.tsx
+++ b/packages/webapp/src/containers/Dialogs/ItemCategoryDialog/ItemCategoryFormFields.tsx
@@ -1,11 +1,15 @@
// @ts-nocheck
import React from 'react';
-import { Classes, FormGroup, InputGroup, TextArea } from '@blueprintjs/core';
-import { FormattedMessage as T, FieldRequiredHint } from '@/components';
-import { ErrorMessage, FastField } from 'formik';
+import { Classes } from '@blueprintjs/core';
+import {
+ FormattedMessage as T,
+ FieldRequiredHint,
+ FFormGroup,
+ FInputGroup,
+ FTextArea,
+} from '@/components';
import { useAutofocus } from '@/hooks';
-import { inputIntent } from '@/utils';
/**
* Item category form fields.
@@ -16,45 +20,35 @@ export default function ItemCategoryFormFields() {
return (
{/* ----------- Category name ----------- */}
-
- {({ field, field: { value }, meta: { error, touched } }) => (
- }
- labelInfo={}
- className={'form-group--category-name'}
- intent={inputIntent({ error, touched })}
- helperText={}
- inline={true}
- >
- (categoryNameFieldRef.current = ref)}
- intent={inputIntent({ error, touched })}
- {...field}
- />
-
- )}
-
+ }
+ labelInfo={}
+ inline
+ fastField
+ >
+ (categoryNameFieldRef.current = ref)}
+ fastField
+ />
+
{/* ----------- Description ----------- */}
-
- {({ field, field: { value }, meta: { error, touched } }) => (
- }
- className={'form-group--description'}
- intent={inputIntent({ error, touched })}
- helperText={}
- inline={true}
- >
-
-
- )}
-
+ }
+ inline
+ fastField
+ >
+
+
);
}
diff --git a/packages/webapp/src/containers/Dialogs/LockingTransactionsDialog/LockingTransactionsFormFields.tsx b/packages/webapp/src/containers/Dialogs/LockingTransactionsDialog/LockingTransactionsFormFields.tsx
index a69b3a958..20e0ed5ad 100644
--- a/packages/webapp/src/containers/Dialogs/LockingTransactionsDialog/LockingTransactionsFormFields.tsx
+++ b/packages/webapp/src/containers/Dialogs/LockingTransactionsDialog/LockingTransactionsFormFields.tsx
@@ -1,8 +1,6 @@
// @ts-nocheck
import React from 'react';
-import { FastField, ErrorMessage } from 'formik';
-import { Classes, FormGroup, Position } from '@blueprintjs/core';
-import { DateInput } from '@blueprintjs/datetime';
+import { Classes, Position } from '@blueprintjs/core';
import classNames from 'classnames';
import { CLASSES } from '@/constants/classes';
import {
@@ -10,14 +8,10 @@ import {
FormattedMessage as T,
FFormGroup,
FTextArea,
+ FDateInput,
} from '@/components';
import { useAutofocus } from '@/hooks';
-import {
- inputIntent,
- momentFormatter,
- tansformDateValue,
- handleDateChange,
-} from '@/utils';
+import { momentFormatter } from '@/utils';
/**
* locking Transactions form fields.
@@ -28,31 +22,24 @@ export default function LockingTransactionsFormFields() {
return (
{/*------------ Locking Date -----------*/}
-
- {({ form, field: { value }, meta: { error, touched } }) => (
- }
- labelInfo={}
- intent={inputIntent({ error, touched })}
- helperText={}
- minimal={true}
- className={classNames(CLASSES.FILL, 'form-group--date')}
- >
- {
- form.setFieldValue('lock_to_date', formattedDate);
- })}
- value={tansformDateValue(value)}
- popoverProps={{
- position: Position.BOTTOM,
- minimal: true,
- }}
- intent={inputIntent({ error, touched })}
- />
-
- )}
-
+ }
+ labelInfo={}
+ minimal={true}
+ className={classNames(CLASSES.FILL, 'form-group--date')}
+ fastField
+ >
+
+
{/*------------ Locking Reason -----------*/}
(reasonFieldRef.current = ref)}
+ fill
fastField
/>
diff --git a/packages/webapp/src/containers/Dialogs/RefundVendorCreditDialog/RefundVendorCreditFormFields.tsx b/packages/webapp/src/containers/Dialogs/RefundVendorCreditDialog/RefundVendorCreditFormFields.tsx
index 156dad690..59a032d2d 100644
--- a/packages/webapp/src/containers/Dialogs/RefundVendorCreditDialog/RefundVendorCreditFormFields.tsx
+++ b/packages/webapp/src/containers/Dialogs/RefundVendorCreditDialog/RefundVendorCreditFormFields.tsx
@@ -2,18 +2,10 @@
import React from 'react';
import intl from 'react-intl-universal';
import styled from 'styled-components';
-import { FastField, ErrorMessage, useFormikContext } from 'formik';
-import {
- Classes,
- FormGroup,
- InputGroup,
- TextArea,
- Position,
- ControlGroup,
-} from '@blueprintjs/core';
+import { useFormikContext } from 'formik';
+import { Classes, Position, ControlGroup } from '@blueprintjs/core';
import classNames from 'classnames';
import { CLASSES } from '@/constants/classes';
-import { DateInput } from '@blueprintjs/datetime';
import { isEqual } from 'lodash';
import {
Icon,
@@ -23,20 +15,18 @@ import {
FieldRequiredHint,
FAccountsSuggestField,
InputPrependText,
- MoneyInputGroup,
+ FMoneyInputGroup,
FormattedMessage as T,
ExchangeRateMutedField,
BranchSelect,
BranchSelectButton,
FeatureCan,
+ FFormGroup,
+ FDateInput,
+ FInputGroup,
+ FTextArea,
} from '@/components';
-import {
- inputIntent,
- momentFormatter,
- tansformDateValue,
- handleDateChange,
- compose,
-} from '@/utils';
+import { momentFormatter, compose } from '@/utils';
import { useAutofocus } from '@/hooks';
import { Features, ACCOUNT_TYPE } from '@/constants';
import { useSetPrimaryBranchToForm } from './utils';
@@ -63,46 +53,39 @@ function RefundVendorCreditFormFields({
- }
- className={classNames('form-group--select-list', Classes.FILL)}
- >
+ } fill>
-
+
+
{/* ------------- Refund date ------------- */}
-
- {({ form, field: { value }, meta: { error, touched } }) => (
- }
- labelInfo={}
- fill
- >
- {
- form.setFieldValue('refund_date', formattedDate);
- })}
- popoverProps={{ position: Position.BOTTOM, minimal: true }}
- inputProps={{
- leftIcon: ,
- }}
- />
-
- )}
-
+ }
+ labelInfo={}
+ fill
+ fastField
+ >
+ ,
+ }}
+ fastField
+ />
+
@@ -130,34 +113,23 @@ function RefundVendorCreditFormFields({
{/* ------------- Amount ------------- */}
-
- {({
- form: { values, setFieldValue },
- field: { value },
- meta: { error, touched },
- }) => (
- }
- labelInfo={}
- className={classNames('form-group--amount', CLASSES.FILL)}
- intent={inputIntent({ error, touched })}
- helperText={}
- >
-
-
- {
- setFieldValue('amount', amount);
- }}
- intent={inputIntent({ error, touched })}
- inputRef={(ref) => (amountFieldRef.current = ref)}
- />
-
-
- )}
-
+ }
+ labelInfo={}
+ fill
+ fastField
+ >
+
+
+ (amountFieldRef.current = ref)}
+ fastField
+ />
+
+
{/*------------ exchange rate -----------*/}
@@ -172,34 +144,19 @@ function RefundVendorCreditFormFields({
{/* ------------ Reference No. ------------ */}
-
- {({ form, field, meta: { error, touched } }) => (
- }
- className={classNames('form-group--reference', CLASSES.FILL)}
- intent={inputIntent({ error, touched })}
- helperText={}
- >
-
-
- )}
-
+ }
+ fill
+ fastField
+ >
+
+
{/* --------- Statement --------- */}
-
- {({ form, field, meta: { error, touched } }) => (
- }
- className={'form-group--description'}
- >
-
-
- )}
-
+
+
+
);
}
diff --git a/packages/webapp/src/containers/Dialogs/UnlockingPartialTransactionsDialog/UnlockingPartialTransactionsFormFields.tsx b/packages/webapp/src/containers/Dialogs/UnlockingPartialTransactionsDialog/UnlockingPartialTransactionsFormFields.tsx
index 621de9777..258f2eaf8 100644
--- a/packages/webapp/src/containers/Dialogs/UnlockingPartialTransactionsDialog/UnlockingPartialTransactionsFormFields.tsx
+++ b/packages/webapp/src/containers/Dialogs/UnlockingPartialTransactionsDialog/UnlockingPartialTransactionsFormFields.tsx
@@ -1,8 +1,6 @@
// @ts-nocheck
import React from 'react';
-import { FastField, ErrorMessage } from 'formik';
-import { Classes, FormGroup, TextArea, Position } from '@blueprintjs/core';
-import { DateInput } from '@blueprintjs/datetime';
+import { Classes, Position } from '@blueprintjs/core';
import classNames from 'classnames';
import { CLASSES } from '@/constants/classes';
import {
@@ -10,13 +8,11 @@ import {
Col,
Row,
FormattedMessage as T,
+ FFormGroup,
+ FDateInput,
+ FTextArea,
} from '@/components';
-import {
- inputIntent,
- momentFormatter,
- tansformDateValue,
- handleDateChange,
-} from '@/utils';
+import { momentFormatter } from '@/utils';
import { useAutofocus } from '@/hooks';
/**
@@ -30,87 +26,65 @@ export default function UnlockingPartialTransactionsFormFields() {
{/*------------ Unlocking from date -----------*/}
-
- {({ form, field: { value }, meta: { error, touched } }) => (
-
- }
- labelInfo={}
- intent={inputIntent({ error, touched })}
- helperText={}
- minimal={true}
- className={classNames(CLASSES.FILL, 'form-group--date')}
- >
- {
- form.setFieldValue('unlock_from_date', formattedDate);
- })}
- value={tansformDateValue(value)}
- popoverProps={{
- position: Position.BOTTOM,
- minimal: true,
- }}
- intent={inputIntent({ error, touched })}
- />
-
- )}
-
+ }
+ labelInfo={}
+ fill
+ minimal
+ fastField
+ >
+
+
- {/*------------ Unlocking from date -----------*/}
-
- {({ form, field: { value }, meta: { error, touched } }) => (
-
- }
- labelInfo={}
- intent={inputIntent({ error, touched })}
- helperText={}
- minimal={true}
- className={classNames(CLASSES.FILL, 'form-group--date')}
- >
- {
- form.setFieldValue('unlock_to_date', formattedDate);
- })}
- value={tansformDateValue(value)}
- popoverProps={{
- position: Position.BOTTOM,
- minimal: true,
- }}
- intent={inputIntent({ error, touched })}
- />
-
- )}
-
+ {/*------------ Unlocking to date -----------*/}
+ }
+ labelInfo={}
+ minimal={true}
+ fill
+ fastField
+ >
+
+
{/*------------ unLocking reason -----------*/}
-
- {({ field, meta: { error, touched } }) => (
- }
- labelInfo={}
- className={'form-group--reason'}
- intent={inputIntent({ error, touched })}
- helperText={}
- >
-
+ }
+ labelInfo={}
+ fastField
+ >
+ (reasonFieldRef.current = ref)}
+ fill
+ fastField
+ />
+
);
}
diff --git a/packages/webapp/src/containers/FinancialStatements/CustomersBalanceSummary/CustomersBalanceSummaryGeneralPanelContent.tsx b/packages/webapp/src/containers/FinancialStatements/CustomersBalanceSummary/CustomersBalanceSummaryGeneralPanelContent.tsx
index dc0d2ae5e..745c4a565 100644
--- a/packages/webapp/src/containers/FinancialStatements/CustomersBalanceSummary/CustomersBalanceSummaryGeneralPanelContent.tsx
+++ b/packages/webapp/src/containers/FinancialStatements/CustomersBalanceSummary/CustomersBalanceSummaryGeneralPanelContent.tsx
@@ -1,7 +1,5 @@
// @ts-nocheck
-import { FastField } from 'formik';
-import { DateInput } from '@blueprintjs/datetime';
-import { FormGroup, Position, Checkbox } from '@blueprintjs/core';
+import { Position } from '@blueprintjs/core';
import {
FormattedMessage as T,
Row,
@@ -9,13 +7,10 @@ import {
FieldHint,
CustomersMultiSelect,
FFormGroup,
+ FDateInput,
+ FCheckbox,
} from '@/components';
-import {
- momentFormatter,
- tansformDateValue,
- inputIntent,
- handleDateChange,
-} from '@/utils';
+import { momentFormatter } from '@/utils';
import { filterCustomersOptions } from '../constants';
import { useCustomersBalanceSummaryGeneralContext } from './CustomersBalanceSummaryGeneralProvider';
import FinancialStatementsFilter from '../FinancialStatementsFilter';
@@ -30,45 +25,40 @@ export default function CustomersBalanceSummaryGeneralPanelContent() {
-
- {({ form, field: { value }, meta: { error } }) => (
- }
- labelInfo={}
- fill={true}
- intent={inputIntent({ error })}
- >
- {
- form.setFieldValue('asDate', selectedDate);
- })}
- popoverProps={{ position: Position.BOTTOM, minimal: true }}
- minimal={true}
- fill={true}
- />
-
- )}
-
+ }
+ labelInfo={}
+ fill
+ fastField
+ >
+
+
-
- {({ field }) => (
- }>
- }
- {...field}
- />
-
- )}
-
+ }
+ fastField
+ >
+ }
+ fastField
+ />
+
diff --git a/packages/webapp/src/containers/Items/ItemFormBody.tsx b/packages/webapp/src/containers/Items/ItemFormBody.tsx
index aa12c7c80..adbc19663 100644
--- a/packages/webapp/src/containers/Items/ItemFormBody.tsx
+++ b/packages/webapp/src/containers/Items/ItemFormBody.tsx
@@ -5,6 +5,7 @@ import { FormGroup, Classes, Checkbox, ControlGroup } from '@blueprintjs/core';
import {
AccountsSelect,
MoneyInputGroup,
+ FMoneyInputGroup,
Col,
Row,
Hint,
@@ -59,33 +60,24 @@ function ItemFormBody({ organization: { base_currency } }) {
{/*------------- Selling price ------------- */}
-
}
+ inline
+ fastField
>
- {({ form, field: { value }, meta: { error, touched } }) => (
-
}
- className={'form-group--sell_price'}
- intent={inputIntent({ error, touched })}
- helperText={
}
- inline={true}
- >
-
-
- {
- form.setFieldValue('sell_price', unformattedValue);
- }}
- />
-
-
- )}
-
+
+
+
+
+
{/*------------- Selling account ------------- */}
@@ -162,33 +155,25 @@ function ItemFormBody({ organization: { base_currency } }) {
{/*------------- Cost price ------------- */}
-
}
+ inline
+ fastField
>
- {({ field, form, field: { value }, meta: { error, touched } }) => (
-
}
- className={'form-group--item-cost-price'}
- intent={inputIntent({ error, touched })}
- helperText={
}
- inline={true}
- >
-
-
- {
- form.setFieldValue('cost_price', unformattedValue);
- }}
- />
-
-
- )}
-
+
+
+
+
+
+
{/*------------- Cost account ------------- */}
diff --git a/packages/webapp/src/containers/JournalNumber/ReferenceNumberFormContent.tsx b/packages/webapp/src/containers/JournalNumber/ReferenceNumberFormContent.tsx
index a1c14b034..fa6288ce9 100644
--- a/packages/webapp/src/containers/JournalNumber/ReferenceNumberFormContent.tsx
+++ b/packages/webapp/src/containers/JournalNumber/ReferenceNumberFormContent.tsx
@@ -1,10 +1,16 @@
// @ts-nocheck
import React from 'react';
-import { FastField, useFormikContext } from 'formik';
-import { FormGroup, InputGroup, Radio } from '@blueprintjs/core';
+import { useFormikContext } from 'formik';
+import { Radio } from '@blueprintjs/core';
-import { FormattedMessage as T, Row, Col, ErrorMessage } from '@/components';
-import { inputIntent } from '@/utils';
+import {
+ FormattedMessage as T,
+ Row,
+ Col,
+ FFormGroup,
+ FInputGroup,
+ FRadioGroup,
+} from '@/components';
/**
* Reference number form content.
@@ -13,33 +19,21 @@ export default function ReferenceNumberFormContent() {
return (
<>
{/* ------------- Auto increment mode ------------- */}
-
- {({ form, field, meta: { error, touched } }) => (
- }
- value="auto-increment"
- onChange={() => {
- form.setFieldValue('incrementMode', 'auto');
- }}
- checked={field.value === 'auto'}
- />
- )}
-
+
+ }
+ value="auto"
+ />
+
{/* ------------- Manual increment mode ------------- */}
-
- {({ form, field, meta: { error, touched } }) => (
- }
- value="manual"
- onChange={() => {
- form.setFieldValue('incrementMode', 'manual');
- }}
- checked={field.value === 'manual'}
- />
- )}
-
+
+ }
+ value="manual"
+ />
+
{/* ------------- Transaction manual increment mode ------------- */}
@@ -49,40 +43,32 @@ export default function ReferenceNumberFormContent() {
function ReferenceNumberAutoIncrement() {
const { values } = useFormikContext();
- if (!values.incrementMode === 'auto') return null;
+ if (values.incrementMode !== 'auto') return null;
return (
{/* ------------- Prefix ------------- */}
-
- {({ form, field, meta: { error, touched } }) => (
- }
- className={'form-group--'}
- intent={inputIntent({ error, touched })}
- helperText={}
- >
-
-
- )}
-
+ }
+ className={'form-group--'}
+ fastField
+ >
+
+
{/* ------------- Next number ------------- */}
-
- {({ form, field, meta: { error, touched } }) => (
- }
- className={'form-group--next-number'}
- intent={inputIntent({ error, touched })}
- helperText={}
- >
-
-
- )}
-
+ }
+ className={'form-group--next-number'}
+ fastField
+ >
+
+
);
@@ -95,17 +81,13 @@ function ReferenceNumberManualOnce() {
if (!values.onceManualNumber) return null;
return (
-
- {({ form, field, meta: { error, touched } }) => (
+
+
}
- value="manual"
- onChange={() => {
- form.setFieldValue('incrementMode', 'manual-transaction');
- }}
- checked={field.value === 'manual-transaction'}
+ value="manual-transaction"
/>
- )}
-
+
+
);
}
diff --git a/packages/webapp/src/containers/Preferences/Users/Roles/RolesForm/RoleFormHeader.tsx b/packages/webapp/src/containers/Preferences/Users/Roles/RolesForm/RoleFormHeader.tsx
index 8fe40637d..e02db5660 100644
--- a/packages/webapp/src/containers/Preferences/Users/Roles/RolesForm/RoleFormHeader.tsx
+++ b/packages/webapp/src/containers/Preferences/Users/Roles/RolesForm/RoleFormHeader.tsx
@@ -1,10 +1,6 @@
// @ts-nocheck
import React from 'react';
-import { ErrorMessage, FastField } from 'formik';
-import { FormGroup, InputGroup, TextArea } from '@blueprintjs/core';
-
-import { inputIntent } from '@/utils';
-import { FormattedMessage as T, FieldRequiredHint, Card } from '@/components';
+import { FormattedMessage as T, FieldRequiredHint, Card, FFormGroup, FInputGroup, FTextArea } from '@/components';
import { useAutofocus } from '@/hooks';
/**
@@ -17,48 +13,42 @@ export function RoleFormHeader() {
return (
{/* ---------- Name ---------- */}
-
- {({ field, meta: { error, touched } }) => (
-
-
-
- }
- labelInfo={}
- className={'form-group--name'}
- intent={inputIntent({ error, touched })}
- helperText={}
- inline={true}
- >
- (roleNameFieldRef.current = ref)}
- {...field}
- />
-
- )}
-
+
+
+
+ }
+ labelInfo={}
+ inline
+ fastField
+ >
+ (roleNameFieldRef.current = ref)}
+ fill
+ fastField
+ />
+
{/* ---------- Description ---------- */}
-
- {({ field, meta: { error, touched } }) => (
- }
- className={'form-group--description'}
- intent={inputIntent({ error, touched })}
- helperText={}
- inline={true}
- >
-
-
- )}
-
+ }
+ inline
+ fastField
+ >
+
+
);
}
diff --git a/packages/webapp/src/containers/Purchases/Bills/BillForm/BillFormHeaderFields.tsx b/packages/webapp/src/containers/Purchases/Bills/BillForm/BillFormHeaderFields.tsx
index 04f0c95a5..0b90e6146 100644
--- a/packages/webapp/src/containers/Purchases/Bills/BillForm/BillFormHeaderFields.tsx
+++ b/packages/webapp/src/containers/Purchases/Bills/BillForm/BillFormHeaderFields.tsx
@@ -2,9 +2,8 @@
import React from 'react';
import styled from 'styled-components';
import classNames from 'classnames';
-import { FastField, ErrorMessage, useFormikContext } from 'formik';
-import { FormGroup, InputGroup, Classes, Position } from '@blueprintjs/core';
-import { DateInput } from '@blueprintjs/datetime';
+import { useFormikContext } from 'formik';
+import { Classes, Position } from '@blueprintjs/core';
import { css } from '@emotion/css';
import { FeatureCan, Stack, FormattedMessage as T } from '@/components';
@@ -15,6 +14,8 @@ import {
Icon,
VendorDrawerLink,
VendorsSelect,
+ FDateInput,
+ FInputGroup,
} from '@/components';
import { useBillFormContext } from './BillFormProvider';
@@ -28,9 +29,6 @@ import withDialogActions from '@/containers/Dialog/withDialogActions';
import {
momentFormatter,
compose,
- tansformDateValue,
- handleDateChange,
- inputIntent,
} from '@/utils';
import { Features } from '@/constants';
import { useTheme } from '@emotion/react';
@@ -74,57 +72,43 @@ function BillFormHeader() {
/>
{/* ------- Bill date ------- */}
-
- {({ form, field: { value }, meta: { error, touched } }) => (
- }
- inline={true}
- labelInfo={}
- className={classNames(CLASSES.FILL)}
- intent={inputIntent({ error, touched })}
- helperText={}
- >
- {
- form.setFieldValue('bill_date', formattedDate);
- })}
- popoverProps={{ position: Position.BOTTOM, minimal: true }}
- inputProps={{ leftIcon: }}
- />
-
- )}
-
+
}
+ inline
+ labelInfo={
}
+ className={classNames(CLASSES.FILL)}
+ fastField
+ >
+
}}
+ fill
+ fastField
+ />
+
{/* ------- Due date ------- */}
-
- {({ form, field: { value }, meta: { error, touched } }) => (
- }
- inline={true}
- className={classNames(
- 'form-group--due-date',
- 'form-group--select-list',
- CLASSES.FILL,
- )}
- intent={inputIntent({ error, touched })}
- helperText={}
- >
- {
- form.setFieldValue('due_date', formattedDate);
- })}
- popoverProps={{ position: Position.BOTTOM, minimal: true }}
- inputProps={{
- leftIcon: ,
- }}
- />
-
- )}
-
+
}
+ inline
+ fill
+ fastField
+ >
+
,
+ }}
+ fill
+ fastField
+ />
+
{/* ------- Bill number ------- */}
{
@@ -44,10 +40,13 @@ function WarehouseTransferFormHeaderFields({
};
// Handle transfer no. field blur.
- const handleTransferNoBlur = (form, field) => (event) => {
+ const handleTransferNoBlur = (event) => {
const newValue = event.target.value;
- if (field.value !== newValue && warehouseTransferAutoIncrement) {
+ if (
+ values.transaction_number !== newValue &&
+ warehouseTransferAutoIncrement
+ ) {
openDialog('warehouse-transfer-no-form', {
initialFormValues: {
manualTransactionNo: newValue,
@@ -66,70 +65,58 @@ function WarehouseTransferFormHeaderFields({
return (
{/* ----------- Date ----------- */}
-
- {({ form, field: { value }, meta: { error, touched } }) => (
- }
- inline={true}
- labelInfo={}
- className={classNames('form-group--date', CLASSES.FILL)}
- intent={inputIntent({ error, touched })}
- helperText={}
- >
- {
- form.setFieldValue('date', formattedDate);
- })}
- popoverProps={{ position: Position.BOTTOM_LEFT, minimal: true }}
- inputProps={{
- leftIcon: ,
- }}
- />
-
- )}
-
+ }
+ inline
+ labelInfo={}
+ fill
+ fastField
+ >
+ ,
+ }}
+ fastField
+ />
+
{/* ----------- Transfer number ----------- */}
-
- {({ form, field, meta: { error, touched } }) => (
- }
- // labelInfo={}
- inline={true}
- className={classNames('form-group--transfer-no', CLASSES.FILL)}
- intent={inputIntent({ error, touched })}
- helperText={}
- >
-
-
- ,
- }}
- tooltip={true}
- tooltipProps={{
- content: (
-
- ),
- position: Position.BOTTOM_LEFT,
- }}
- />
-
-
- )}
-
+ }
+ inline
+ fill
+ >
+
+
+ ,
+ }}
+ tooltip={true}
+ tooltipProps={{
+ content: (
+
+ ),
+ position: Position.BOTTOM_LEFT,
+ }}
+ />
+
+
{/* ----------- Form Warehouse ----------- */}