diff --git a/src/containers/Sales/Invoices/InvoiceForm/BaseCurrency.js b/src/components/BaseCurrency.js similarity index 52% rename from src/containers/Sales/Invoices/InvoiceForm/BaseCurrency.js rename to src/components/BaseCurrency.js index 3aa7bb156..1102178ab 100644 --- a/src/containers/Sales/Invoices/InvoiceForm/BaseCurrency.js +++ b/src/components/BaseCurrency.js @@ -1,38 +1,18 @@ import React from 'react'; import * as R from 'ramda'; import styled from 'styled-components'; - import { CurrencyTag } from 'components'; + import withCurrentOrganization from 'containers/Organization/withCurrentOrganization'; /** - * base currency sign. + * base currecncy. */ function BaseCurrency({ // #withCurrentOrganization organization: { base_currency }, - isForeignCustomer, }) { - - if (isForeignCustomer) { - return null; - } - - return ( - - {base_currency} - - ); + return {base_currency}; } export default R.compose(withCurrentOrganization())(BaseCurrency); - -const BaseCurrencySign = styled.div` - display: flex; - align-items: center; - font-size: 10px; - margin-left: 5px; - span { - background: #5c7080; - } -`; diff --git a/src/components/index.js b/src/components/index.js index 79f7b5acd..08c1b44ff 100644 --- a/src/components/index.js +++ b/src/components/index.js @@ -54,7 +54,8 @@ import AvaterCell from './AvaterCell'; import { ItemsMultiSelect } from './Items'; import MoreMenuItems from './MoreMenutItems'; -import CustomSelectList from './CustomSelectList' +import CustomSelectList from './CustomSelectList'; +import BaseCurrency from './BaseCurrency'; export * from './Dialog'; export * from './Menu'; @@ -89,8 +90,8 @@ export * from './TextStatus'; export * from './Tags'; export * from './CommercialDoc'; export * from './Card'; -export * from './Customers' -export * from './Vendors' +export * from './Customers'; +export * from './Vendors'; export * from './Table'; export * from './Skeleton'; export * from './FinancialStatement'; @@ -162,6 +163,8 @@ export { MoneyFieldCell, ItemsMultiSelect, AvaterCell, + BaseCurrency, MoreMenuItems, - CustomSelectList + CustomSelectList, + }; diff --git a/src/containers/Sales/Invoices/InvoiceForm/InvoiceFormCurrencyTag.js b/src/containers/Sales/Invoices/InvoiceForm/InvoiceFormCurrencyTag.js new file mode 100644 index 000000000..e40ce22d8 --- /dev/null +++ b/src/containers/Sales/Invoices/InvoiceForm/InvoiceFormCurrencyTag.js @@ -0,0 +1,32 @@ +import React from 'react'; +import styled from 'styled-components'; + +import { BaseCurrency } from 'components'; +import { useInvoiceFormContext } from './InvoiceFormProvider'; + +/** + * Invoice form currency tag. + */ +export default function InvoiceFormCurrencyTag() { + const { isForeignCustomer } = useInvoiceFormContext(); + + if (!isForeignCustomer) { + return null; + } + + return ( + + + + ); +} + +const BaseCurrencyTag = styled.div` + display: flex; + align-items: center; + font-size: 10px; + margin-left: 4px; + span { + background: #5c7080; + } +`; diff --git a/src/containers/Sales/Invoices/InvoiceForm/InvoiceFormHeaderFields.js b/src/containers/Sales/Invoices/InvoiceForm/InvoiceFormHeaderFields.js index 3c918a8c6..b9eb52470 100644 --- a/src/containers/Sales/Invoices/InvoiceForm/InvoiceFormHeaderFields.js +++ b/src/containers/Sales/Invoices/InvoiceForm/InvoiceFormHeaderFields.js @@ -33,7 +33,7 @@ import { useInvoiceFormContext } from './InvoiceFormProvider'; import withSettings from 'containers/Settings/withSettings'; import withDialogActions from 'containers/Dialog/withDialogActions'; import { inputIntent, handleDateChange } from 'utils'; -import BaseCurrency from './BaseCurrency'; +import InvoiceCurrencyTag from './InvoiceFormCurrencyTag'; const Data = [ { @@ -104,7 +104,7 @@ function InvoiceFormHeaderFields({ intent={inputIntent({ error, touched })} helperText={} > - + - - + + )} {/* ----------- Exchange reate ----------- */} - - - {({ - form: { values, setFieldValue }, - field, - meta: { error, touched }, - }) => ( - } - > - - - 1 USD = - - { - setFieldValue('exchange_rate', value); - }} - intent={inputIntent({ error, touched })} - /> - - LYD - - - - )} - - + + + + {({ + form: { values, setFieldValue }, + field, + meta: { error, touched }, + }) => ( + } + > + + + 1 USD = + + { + setFieldValue('exchange_rate', value); + }} + intent={inputIntent({ error, touched })} + /> + + LYD + + + + )} + + + @@ -325,3 +327,9 @@ const ExchangeRateTag = styled.div` font-size: 10px; line-height: 1.6; `; + +const ControlCustomerGroup = styled(ControlGroup)` + display: flex; + align-items: center; + transform: none; +`; diff --git a/src/containers/Sales/Invoices/InvoiceForm/InvoiceFormProvider.js b/src/containers/Sales/Invoices/InvoiceForm/InvoiceFormProvider.js index c93eb6260..488d3d21f 100644 --- a/src/containers/Sales/Invoices/InvoiceForm/InvoiceFormProvider.js +++ b/src/containers/Sales/Invoices/InvoiceForm/InvoiceFormProvider.js @@ -78,7 +78,7 @@ function InvoiceFormProvider({ invoiceId, ...props }) { const isFeatureLoading = isWarehouesLoading || isBranchesLoading; // Determines whether the foreign customer. - const isForeignCustomer = true; + const isForeignCustomer = false; // Provider payload. const provider = {