feat(Sales & Purchases ): add exchange rate input.

This commit is contained in:
elforjani13
2022-02-21 15:25:32 +02:00
parent 914e1de79f
commit 7c9ad8438c
22 changed files with 306 additions and 47 deletions

View File

@@ -13,7 +13,9 @@ import {
VendorSelectField,
FieldRequiredHint,
InputPrependButton,
ExchangeRateInputGroup,
Icon,
If,
FormattedMessage as T,
} from 'components';
import {
@@ -47,7 +49,8 @@ function VendorCreditNoteFormHeaderFields({
vendorcreditNextNumber,
}) {
// Vendor Credit form context.
const { vendors } = useVendorCreditNoteFormContext();
const { vendors, isForeignVendor, setSelectVendor } =
useVendorCreditNoteFormContext();
// Handle vendor credit number changing.
const handleVendorCreditNumberChange = () => {
@@ -96,6 +99,7 @@ function VendorCreditNoteFormHeaderFields({
defaultSelectText={<T id={'select_vender_account'} />}
onContactSelected={(contact) => {
form.setFieldValue('vendor_id', contact.id);
setSelectVendor(contact);
}}
popoverFill={true}
allowCreate={true}
@@ -104,6 +108,16 @@ function VendorCreditNoteFormHeaderFields({
)}
</FastField>
{/* ----------- Exchange rate ----------- */}
<If condition={isForeignVendor}>
<ExchangeRateInputGroup
fromCurrency={'USD'}
toCurrency={'LYD'}
name={'exchange_rate'}
formGroupProps={{ label: ' ', inline: true }}
/>
</If>
{/* ------- Vendor Credit date ------- */}
<FastField name={'vendor_credit_date'}>
{({ form, field: { value }, meta: { error, touched } }) => (