mirror of
https://github.com/bigcapitalhq/bigcapital.git
synced 2026-02-18 13:50:31 +00:00
feat(Sales & Purchases ): add currency code in edit mode.
This commit is contained in:
@@ -22,7 +22,7 @@ export function ExchangeRateInputGroup({
|
||||
<ExchangeFlagIcon countryCode={fromCountryCode} /> 1 {fromCurrency} =
|
||||
</ExchangeRatePrepend>
|
||||
<ExchangeRateField
|
||||
allowDecimals={false}
|
||||
allowDecimals={true}
|
||||
allowNegativeValue={true}
|
||||
{...inputGroupProps}
|
||||
name={name}
|
||||
|
||||
@@ -46,7 +46,6 @@ function BillForm({
|
||||
...(!isEmpty(bill)
|
||||
? {
|
||||
...transformToEditForm(bill),
|
||||
currency_code: base_currency,
|
||||
}
|
||||
: {
|
||||
...defaultBill,
|
||||
|
||||
@@ -69,7 +69,6 @@ function BillFormHeader() {
|
||||
defaultSelectText={<T id={'select_vender_account'} />}
|
||||
onContactSelected={(contact) => {
|
||||
form.setFieldValue('vendor_id', contact.id);
|
||||
form.setFieldValue('exchange_rate', '');
|
||||
form.setFieldValue('currency_code', contact?.currency_code);
|
||||
setSelectVendor(contact);
|
||||
}}
|
||||
|
||||
@@ -44,7 +44,8 @@ export const defaultBill = {
|
||||
open: '',
|
||||
branch_id: '',
|
||||
warehouse_id: '',
|
||||
exchange_rate: '',
|
||||
exchange_rate: 1,
|
||||
currency_code: '',
|
||||
entries: [...repeatValue(defaultBillEntry, MIN_LINES_NUMBER)],
|
||||
};
|
||||
|
||||
@@ -107,6 +108,7 @@ export const transformFormValuesToRequest = (values) => {
|
||||
...values,
|
||||
entries: transformEntriesToSubmit(entries),
|
||||
open: false,
|
||||
exchange_rate: 1,
|
||||
};
|
||||
};
|
||||
|
||||
|
||||
@@ -75,6 +75,7 @@ function VendorCreditNoteForm({
|
||||
vendor_credit_number: vendorCreditNumber,
|
||||
}),
|
||||
...newVendorCredit,
|
||||
currency_code: base_currency,
|
||||
}),
|
||||
}),
|
||||
[vendorCredit, base_currency],
|
||||
|
||||
@@ -107,7 +107,6 @@ function VendorCreditNoteFormHeaderFields({
|
||||
defaultSelectText={<T id={'select_vender_account'} />}
|
||||
onContactSelected={(contact) => {
|
||||
form.setFieldValue('vendor_id', contact.id);
|
||||
form.setFieldValue('exchange_rate', '');
|
||||
form.setFieldValue('currency_code', contact?.currency_code);
|
||||
setSelectVendor(contact);
|
||||
}}
|
||||
|
||||
@@ -41,7 +41,8 @@ export const defaultVendorsCreditNote = {
|
||||
note: '',
|
||||
branch_id: '',
|
||||
warehouse_id: '',
|
||||
exchange_rate: '',
|
||||
exchange_rate: 1,
|
||||
currency_code: '',
|
||||
entries: [...repeatValue(defaultCreditNoteEntry, MIN_LINES_NUMBER)],
|
||||
};
|
||||
|
||||
|
||||
@@ -110,7 +110,6 @@ function PaymentMadeFormHeaderFields({ organization: { base_currency } }) {
|
||||
defaultSelectText={<T id={'select_vender_account'} />}
|
||||
onContactSelected={(contact) => {
|
||||
form.setFieldValue('vendor_id', contact.id);
|
||||
form.setFieldValue('exchange_rate', '');
|
||||
form.setFieldValue('currency_code', contact?.currency_code);
|
||||
setPaymentVendorId(contact.id);
|
||||
setSelectVendor(contact);
|
||||
|
||||
@@ -35,7 +35,7 @@ export const defaultPaymentMade = {
|
||||
statement: '',
|
||||
currency_code: '',
|
||||
branch_id: '',
|
||||
exchange_rate: '',
|
||||
exchange_rate: 1,
|
||||
entries: [],
|
||||
};
|
||||
|
||||
|
||||
@@ -69,7 +69,7 @@ function CreditNoteForm({
|
||||
const initialValues = React.useMemo(
|
||||
() => ({
|
||||
...(!isEmpty(creditNote)
|
||||
? { ...transformToEditForm(creditNote), currency_code: base_currency }
|
||||
? { ...transformToEditForm(creditNote) }
|
||||
: {
|
||||
...defaultCreditNote,
|
||||
...(creditAutoIncrement && {
|
||||
|
||||
@@ -107,7 +107,6 @@ function CreditNoteFormHeaderFields({
|
||||
defaultSelectText={<T id={'select_customer_account'} />}
|
||||
onContactSelected={(customer) => {
|
||||
form.setFieldValue('customer_id', customer.id);
|
||||
form.setFieldValue('exchange_rate', '');
|
||||
form.setFieldValue('currency_code', customer?.currency_code);
|
||||
setSelectCustomer(customer);
|
||||
}}
|
||||
|
||||
@@ -43,7 +43,8 @@ export const defaultCreditNote = {
|
||||
terms_conditions: '',
|
||||
branch_id: '',
|
||||
warehouse_id: '',
|
||||
exchange_rate: '',
|
||||
exchange_rate: 1,
|
||||
currency_code: '',
|
||||
entries: [...repeatValue(defaultCreditNoteEntry, MIN_LINES_NUMBER)],
|
||||
};
|
||||
|
||||
|
||||
@@ -62,7 +62,7 @@ function EstimateForm({
|
||||
const initialValues = useMemo(
|
||||
() => ({
|
||||
...(!isEmpty(estimate)
|
||||
? { ...transformToEditForm(estimate), currency_code: base_currency }
|
||||
? { ...transformToEditForm(estimate) }
|
||||
: {
|
||||
...defaultEstimate,
|
||||
...(estimateIncrementMode && {
|
||||
|
||||
@@ -99,7 +99,6 @@ function EstimateFormHeader({
|
||||
defaultSelectText={<T id={'select_customer_account'} />}
|
||||
onContactSelected={(customer) => {
|
||||
form.setFieldValue('customer_id', customer.id);
|
||||
form.setFieldValue('exchange_rate', '');
|
||||
form.setFieldValue('currency_code', customer?.currency_code);
|
||||
setSelectCustomer(customer);
|
||||
}}
|
||||
|
||||
@@ -39,7 +39,8 @@ export const defaultEstimate = {
|
||||
terms_conditions: '',
|
||||
branch_id: '',
|
||||
warehouse_id: '',
|
||||
exchange_rate: '',
|
||||
exchange_rate: 1,
|
||||
currency_code: '',
|
||||
entries: [...repeatValue(defaultEstimateEntry, MIN_LINES_NUMBER)],
|
||||
};
|
||||
|
||||
|
||||
@@ -67,7 +67,7 @@ function InvoiceForm({
|
||||
const initialValues = useMemo(
|
||||
() => ({
|
||||
...(!isEmpty(invoice)
|
||||
? { ...transformToEditForm(invoice), currency_code: base_currency }
|
||||
? { ...transformToEditForm(invoice) }
|
||||
: {
|
||||
...defaultInvoice,
|
||||
...(invoiceIncrementMode && {
|
||||
|
||||
@@ -115,7 +115,6 @@ function InvoiceFormHeaderFields({
|
||||
defaultSelectText={<T id={'select_customer_account'} />}
|
||||
onContactSelected={(customer) => {
|
||||
form.setFieldValue('customer_id', customer.id);
|
||||
form.setFieldValue('exchange_rate', '');
|
||||
form.setFieldValue('currency_code', customer?.currency_code);
|
||||
setSelectCustomer(customer);
|
||||
}}
|
||||
|
||||
@@ -44,7 +44,8 @@ export const defaultInvoice = {
|
||||
reference_no: '',
|
||||
invoice_message: '',
|
||||
terms_conditions: '',
|
||||
exchange_rate: '',
|
||||
exchange_rate: 1,
|
||||
currency_code: '',
|
||||
branch_id: '',
|
||||
warehouse_id: '',
|
||||
entries: [...repeatValue(defaultInvoiceEntry, MIN_LINES_NUMBER)],
|
||||
|
||||
@@ -153,7 +153,6 @@ function PaymentReceiveHeaderFields({
|
||||
onContactSelected={(customer) => {
|
||||
form.setFieldValue('customer_id', customer.id);
|
||||
form.setFieldValue('full_amount', '');
|
||||
form.setFieldValue('exchange_rate', '');
|
||||
form.setFieldValue('currency_code', customer?.currency_code);
|
||||
setSelectCustomer(customer);
|
||||
}}
|
||||
|
||||
@@ -34,7 +34,7 @@ export const defaultPaymentReceive = {
|
||||
full_amount: '',
|
||||
currency_code: '',
|
||||
branch_id: '',
|
||||
exchange_rate:'',
|
||||
exchange_rate: 1,
|
||||
entries: [],
|
||||
};
|
||||
|
||||
|
||||
@@ -67,7 +67,7 @@ function ReceiptForm({
|
||||
const initialValues = useMemo(
|
||||
() => ({
|
||||
...(!isEmpty(receipt)
|
||||
? { ...transformToEditForm(receipt), currency_code: base_currency }
|
||||
? { ...transformToEditForm(receipt) }
|
||||
: {
|
||||
...defaultReceipt,
|
||||
...(receiptAutoIncrement && {
|
||||
|
||||
@@ -107,7 +107,6 @@ function ReceiptFormHeader({
|
||||
defaultSelectText={<T id={'select_customer_account'} />}
|
||||
onContactSelected={(customer) => {
|
||||
form.setFieldValue('customer_id', customer.id);
|
||||
form.setFieldValue('exchange_rate', '');
|
||||
form.setFieldValue('currency_code', customer?.currency_code);
|
||||
setSelectCustomer(customer);
|
||||
}}
|
||||
|
||||
@@ -39,7 +39,8 @@ export const defaultReceipt = {
|
||||
closed: '',
|
||||
branch_id: '',
|
||||
warehouse_id: '',
|
||||
exchange_rate: '',
|
||||
exchange_rate: 1,
|
||||
currency_code: '',
|
||||
entries: [...repeatValue(defaultReceiptEntry, MIN_LINES_NUMBER)],
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user