mirror of
https://github.com/bigcapitalhq/bigcapital.git
synced 2026-02-17 21:30:31 +00:00
feat(Sales & Purchases ): add currency tag.
This commit is contained in:
@@ -1,32 +1,20 @@
|
||||
import React from 'react';
|
||||
import styled from 'styled-components';
|
||||
|
||||
import { BaseCurrency } from 'components';
|
||||
import { BaseCurrency, BaseCurrencyRoot } from 'components';
|
||||
import { useInvoiceFormContext } from './InvoiceFormProvider';
|
||||
|
||||
/**
|
||||
* Invoice form currency tag.
|
||||
*/
|
||||
export default function InvoiceFormCurrencyTag() {
|
||||
const { isForeignCustomer } = useInvoiceFormContext();
|
||||
const { isForeignCustomer, selectCustomer } = useInvoiceFormContext();
|
||||
|
||||
if (!isForeignCustomer) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return (
|
||||
<BaseCurrencyTag>
|
||||
<BaseCurrency />
|
||||
</BaseCurrencyTag>
|
||||
<BaseCurrencyRoot>
|
||||
<BaseCurrency currency={selectCustomer?.currency_code} />
|
||||
</BaseCurrencyRoot>
|
||||
);
|
||||
}
|
||||
|
||||
const BaseCurrencyTag = styled.div`
|
||||
display: flex;
|
||||
align-items: center;
|
||||
font-size: 10px;
|
||||
margin-left: 4px;
|
||||
span {
|
||||
background: #5c7080;
|
||||
}
|
||||
`;
|
||||
|
||||
@@ -57,7 +57,7 @@ function InvoiceFormHeaderFields({
|
||||
invoiceNextNumber,
|
||||
}) {
|
||||
// Invoice form context.
|
||||
const { customers, isForeignCustomer, setSelectCustomer } =
|
||||
const { customers, isForeignCustomer,selectCustomer ,setSelectCustomer } =
|
||||
useInvoiceFormContext();
|
||||
|
||||
// Handle invoice number changing.
|
||||
@@ -115,7 +115,7 @@ function InvoiceFormHeaderFields({
|
||||
popoverFill={true}
|
||||
allowCreate={true}
|
||||
/>
|
||||
<InvoiceCurrencyTag isForeignCustomer={isForeignCustomer} />
|
||||
<InvoiceCurrencyTag />
|
||||
</ControlCustomerGroup>
|
||||
</FormGroup>
|
||||
)}
|
||||
|
||||
Reference in New Issue
Block a user