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