mirror of
https://github.com/bigcapitalhq/bigcapital.git
synced 2026-02-21 23:30:32 +00:00
feat(Sales & Purchases ): add setfieldvalue exchange rate.
This commit is contained in:
@@ -3,12 +3,8 @@ import intl from 'react-intl-universal';
|
||||
import { DATATYPES_LENGTH } from 'common/dataTypes';
|
||||
|
||||
const Schema = Yup.object().shape({
|
||||
vendor_id: Yup.string()
|
||||
.label(intl.get('vendor_name_'))
|
||||
.required(),
|
||||
payment_date: Yup.date()
|
||||
.required()
|
||||
.label(intl.get('payment_date_')),
|
||||
vendor_id: Yup.string().label(intl.get('vendor_name_')).required(),
|
||||
payment_date: Yup.date().required().label(intl.get('payment_date_')),
|
||||
payment_account_id: Yup.number()
|
||||
.required()
|
||||
.label(intl.get('payment_account_')),
|
||||
@@ -20,6 +16,7 @@ const Schema = Yup.object().shape({
|
||||
reference: Yup.string().min(1).max(DATATYPES_LENGTH.STRING).nullable(),
|
||||
description: Yup.string().max(DATATYPES_LENGTH.TEXT),
|
||||
branch_id: Yup.string(),
|
||||
exchange_rate: Yup.number(),
|
||||
entries: Yup.array().of(
|
||||
Yup.object().shape({
|
||||
id: Yup.number().nullable(),
|
||||
|
||||
@@ -60,6 +60,8 @@ function PaymentMadeFormHeaderFields({ organization: { base_currency } }) {
|
||||
isNewMode,
|
||||
setPaymentVendorId,
|
||||
isForeignVendor,
|
||||
baseCurrency,
|
||||
selectVendor,
|
||||
setSelectVendor,
|
||||
} = usePaymentMadeFormContext();
|
||||
|
||||
@@ -108,6 +110,7 @@ function PaymentMadeFormHeaderFields({ organization: { base_currency } }) {
|
||||
defaultSelectText={<T id={'select_vender_account'} />}
|
||||
onContactSelected={(contact) => {
|
||||
form.setFieldValue('vendor_id', contact.id);
|
||||
form.setFieldValue('exchange_rate', '');
|
||||
setPaymentVendorId(contact.id);
|
||||
setSelectVendor(contact);
|
||||
}}
|
||||
@@ -124,8 +127,8 @@ function PaymentMadeFormHeaderFields({ organization: { base_currency } }) {
|
||||
{/* ----------- Exchange rate ----------- */}
|
||||
<If condition={isForeignVendor}>
|
||||
<ExchangeRateInputGroup
|
||||
fromCurrency={'USD'}
|
||||
toCurrency={'LYD'}
|
||||
fromCurrency={baseCurrency}
|
||||
toCurrency={selectVendor?.currency_code}
|
||||
name={'exchange_rate'}
|
||||
formGroupProps={{ label: ' ', inline: true }}
|
||||
/>
|
||||
|
||||
@@ -35,6 +35,7 @@ export const defaultPaymentMade = {
|
||||
statement: '',
|
||||
currency_code: '',
|
||||
branch_id: '',
|
||||
exchange_rate: '',
|
||||
entries: [],
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user