feat(Sales): add sales.

This commit is contained in:
elforjani13
2022-03-20 16:16:22 +02:00
parent 89b28903fa
commit 39a68f5c25
23 changed files with 559 additions and 130 deletions

View File

@@ -23,16 +23,15 @@ import { CLASSES } from 'common/classes';
import {
CustomerSelectField,
FieldRequiredHint,
If,
Icon,
InputPrependButton,
ExchangeRateInputGroup,
CustomerDrawerLink,
} from 'components';
import withDialogActions from 'containers/Dialog/withDialogActions';
import withSettings from 'containers/Settings/withSettings';
import EstimateFormCurrencyTag from './EstimateFormCurrencyTag';
import { useObserveEstimateNoSettings } from './utils';
import { EstimateExchangeRateInputField } from './components';
import { useEstimateFormContext } from './EstimateFormProvider';
/**
@@ -47,13 +46,7 @@ function EstimateFormHeader({
estimateNumberPrefix,
estimateNextNumber,
}) {
const {
customers,
isForeignCustomer,
baseCurrency,
selectCustomer,
setSelectCustomer,
} = useEstimateFormContext();
const { customers } = useEstimateFormContext();
const handleEstimateNumberBtnClick = () => {
openDialog('estimate-number-form', {});
@@ -100,27 +93,26 @@ function EstimateFormHeader({
onContactSelected={(customer) => {
form.setFieldValue('customer_id', customer.id);
form.setFieldValue('currency_code', customer?.currency_code);
setSelectCustomer(customer);
}}
popoverFill={true}
intent={inputIntent({ error, touched })}
allowCreate={true}
/>
</ControlCustomerGroup>
{value && (
<CustomerButtonLink customerId={value}>
View Customer Details
</CustomerButtonLink>
)}
</FormGroup>
)}
</FastField>
{/* ----------- Exchange rate ----------- */}
<If condition={isForeignCustomer}>
<ExchangeRateInputGroup
fromCurrency={baseCurrency}
toCurrency={selectCustomer?.currency_code}
name={'exchange_rate'}
formGroupProps={{ label: ' ', inline: true }}
/>
</If>
<EstimateExchangeRateInputField
name={'exchange_rate'}
formGroupProps={{ label: ' ', inline: true }}
/>
{/* ----------- Estimate date ----------- */}
<FastField name={'estimate_date'}>
@@ -246,3 +238,8 @@ const ControlCustomerGroup = styled(ControlGroup)`
align-items: center;
transform: none;
`;
const CustomerButtonLink = styled(CustomerDrawerLink)`
font-size: 11px;
margin-top: 6px;
`;