diff --git a/src/containers/Sales/Invoices/InvoiceForm/InvoiceFormHeaderFields.js b/src/containers/Sales/Invoices/InvoiceForm/InvoiceFormHeaderFields.js
index 135b78af0..3c918a8c6 100644
--- a/src/containers/Sales/Invoices/InvoiceForm/InvoiceFormHeaderFields.js
+++ b/src/containers/Sales/Invoices/InvoiceForm/InvoiceFormHeaderFields.js
@@ -7,7 +7,7 @@ import {
} from '@blueprintjs/core';
import { DateInput } from '@blueprintjs/datetime';
import { FastField, Field, ErrorMessage } from 'formik';
-import { FormattedMessage as T, Col, Row } from 'components';
+import { FormattedMessage as T, Col, Row, If } from 'components';
import { momentFormatter, compose, tansformDateValue } from 'utils';
import { upperCase } from 'lodash';
@@ -59,7 +59,7 @@ function InvoiceFormHeaderFields({
invoiceNextNumber,
}) {
// Invoice form context.
- const { customers } = useInvoiceFormContext();
+ const { customers, isForeignCustomer } = useInvoiceFormContext();
// Handle invoice number changing.
const handleInvoiceNumberChange = () => {
@@ -86,25 +86,25 @@ function InvoiceFormHeaderFields({
return (
{/* ----------- Customer name ----------- */}
-
-
- {({ form, field: { value }, meta: { error, touched } }) => (
- }
- inline={true}
- className={classNames(
- 'form-group--customer-name',
- 'form-group--select-list',
- CLASSES.FILL,
- )}
- labelInfo={}
- intent={inputIntent({ error, touched })}
- helperText={}
- >
+
+ {({ form, field: { value }, meta: { error, touched } }) => (
+ }
+ inline={true}
+ className={classNames(
+ 'form-group--customer-name',
+ 'form-group--select-list',
+ CLASSES.FILL,
+ )}
+ labelInfo={}
+ intent={inputIntent({ error, touched })}
+ helperText={}
+ >
+
-
- )}
-
-
-
-
-
- 1 USD =
-
+
+
+
+ )}
+
- {/* ----------- Exchange reate ----------- */}
+ {/* ----------- Exchange reate ----------- */}
+
{({
form: { values, setFieldValue },
@@ -138,22 +135,28 @@ function InvoiceFormHeaderFields({
className={'form-group--exchange_rate'}
helperText={}
>
- {
- setFieldValue('exchange_rate', value);
- }}
- intent={inputIntent({ error, touched })}
- />
+
+
+ 1 USD =
+
+ {
+ setFieldValue('exchange_rate', value);
+ }}
+ intent={inputIntent({ error, touched })}
+ />
+
+ LYD
+
+
)}
-
- LYD
-
-
+
+
{/* ----------- Invoice date ----------- */}
@@ -240,6 +243,7 @@ function InvoiceFormHeaderFields({
+
{/* ----------- Invoice number ----------- */}
{({ form, field, meta: { error, touched } }) => (
@@ -303,27 +307,21 @@ export default compose(
})),
)(InvoiceFormHeaderFields);
-const CustomerName = styled.div`
- display: flex;
- align-items: baseline;
-`;
-
-const ExchangeWrapp = styled.div`
+const ExchangeRateField = styled.div`
display: flex;
justify-content: flex-end;
align-items: center;
- max-width: 370px;
- .bp3-form-group.bp3-inline {
+ max-width: 366px;
+ .bp3-input-group .bp3-input {
width: 88px;
+ margin: 0 5px;
}
`;
-const ExchangeLable = styled.div`
+const ExchangeRateTag = styled.div`
display: flex;
align-items: center;
cursor: pointer;
- margin-right: 5px;
font-size: 10px;
line-height: 1.6;
- padding-bottom: calc(1rem + 1px);
`;
diff --git a/src/containers/Sales/Invoices/InvoiceForm/InvoiceFormProvider.js b/src/containers/Sales/Invoices/InvoiceForm/InvoiceFormProvider.js
index 8b339c900..c93eb6260 100644
--- a/src/containers/Sales/Invoices/InvoiceForm/InvoiceFormProvider.js
+++ b/src/containers/Sales/Invoices/InvoiceForm/InvoiceFormProvider.js
@@ -74,6 +74,12 @@ function InvoiceFormProvider({ invoiceId, ...props }) {
// Detarmines whether the form in new mode.
const isNewMode = !invoiceId;
+ // Determines whether the warehouse and branches are loading.
+ const isFeatureLoading = isWarehouesLoading || isBranchesLoading;
+
+ // Determines whether the foreign customer.
+ const isForeignCustomer = true;
+
// Provider payload.
const provider = {
invoice,
@@ -90,6 +96,10 @@ function InvoiceFormProvider({ invoiceId, ...props }) {
isItemsLoading,
isCustomersLoading,
isSettingsLoading,
+ isWarehouesLoading,
+ isBranchesLoading,
+ isFeatureLoading,
+ isForeignCustomer,
createInvoiceMutate,
editInvoiceMutate,
@@ -104,8 +114,6 @@ function InvoiceFormProvider({ invoiceId, ...props }) {
isItemsLoading ||
isCustomersLoading ||
isEstimateLoading ||
- isWarehouesLoading ||
- isBranchesLoading ||
isSettingsLoading
}
name={'invoice-form'}