diff --git a/src/javascript/app/common/helpers.js b/src/javascript/app/common/helpers.js index f3049dfc3d8..e2653d9c153 100644 --- a/src/javascript/app/common/helpers.js +++ b/src/javascript/app/common/helpers.js @@ -108,23 +108,24 @@ const setMinMaxTimeObj = (options) => { }; const paramsMap = { - 'date_start' : PARAM_NAMES.DATE_START, - 'time_start' : PARAM_NAMES.TIME_START, - 'expiry_type' : PARAM_NAMES.EXPIRY_TYPE, - 'duration_amount': PARAM_NAMES.DURATION_AMOUNT, - 'duration_units' : PARAM_NAMES.DURATION_UNITS, - 'expiry_date' : PARAM_NAMES.EXPIRY_DATE, - 'expiry_time' : PARAM_NAMES.EXPIRY_TIME, - 'barrier' : PARAM_NAMES.BARRIER, - 'barrier_high' : PARAM_NAMES.BARRIER_HIGH, - 'barrier_low' : PARAM_NAMES.BARRIER_LOW, - 'prediction' : PARAM_NAMES.PREDICTION, - 'selected_tick' : PARAM_NAMES.SELECTED_TICK, - 'amount_type' : PARAM_NAMES.AMOUNT_TYPE, - 'amount' : PARAM_NAMES.AMOUNT, - 'currency' : PARAM_NAMES.CURRENCY, - 'multiplier' : PARAM_NAMES.MULTIPLIER, - 'callputequal' : PARAM_NAMES.IS_EQUAL, + 'date_start' : PARAM_NAMES.DATE_START, + 'time_start' : PARAM_NAMES.TIME_START, + 'expiry_type' : PARAM_NAMES.EXPIRY_TYPE, + 'duration_amount' : PARAM_NAMES.DURATION_AMOUNT, + 'duration_units' : PARAM_NAMES.DURATION_UNITS, + 'expiry_date' : PARAM_NAMES.EXPIRY_DATE, + 'expiry_time' : PARAM_NAMES.EXPIRY_TIME, + 'barrier' : PARAM_NAMES.BARRIER, + 'barrier_high' : PARAM_NAMES.BARRIER_HIGH, + 'barrier_low' : PARAM_NAMES.BARRIER_LOW, + 'prediction' : PARAM_NAMES.PREDICTION, + 'selected_tick' : PARAM_NAMES.SELECTED_TICK, + 'amount_type' : PARAM_NAMES.AMOUNT_TYPE, + 'amount' : PARAM_NAMES.AMOUNT, + 'currency' : PARAM_NAMES.CURRENCY, + 'multiplier_currency': PARAM_NAMES.CURRENCY, + 'multiplier' : PARAM_NAMES.MULTIPLIER, + 'callputequal' : PARAM_NAMES.IS_EQUAL, }; const setDefaultParams = (elementId, value) => { diff --git a/src/javascript/app/pages/form/form-component.jsx b/src/javascript/app/pages/form/form-component.jsx index 842172e9c02..d5f980f7f9d 100644 --- a/src/javascript/app/pages/form/form-component.jsx +++ b/src/javascript/app/pages/form/form-component.jsx @@ -18,15 +18,20 @@ import { useSessionChange, useTradeChange, eventDispatcher, + useMarketChange, + useContractChange, } from '../../hooks/events.js'; import common_functions from '../../../_common/common_functions.js'; import { localize } from '../../../_common/localize.js'; import dataManager from '../../common/data_manager.js'; +import { setDefaultParams } from '../../common/helpers.js'; export const FormComponent = () => { const [tradeData, setTradeData] = useState({}); const hasTradeChange = useTradeChange(); + const hasMarketChange = useMarketChange(); + const hasContractChange = useContractChange(); const hasSessionChange = useSessionChange(); useEffect(() => { @@ -34,7 +39,7 @@ export const FormComponent = () => { ...oldData, ...dataManager.getAllTrades(), })); - }, [hasTradeChange, hasSessionChange]); + }, [hasMarketChange, hasContractChange, hasTradeChange, hasSessionChange]); const formName = Defaults.get(PARAM_NAMES.FORM_NAME); const expiryType = Defaults.get(PARAM_NAMES.EXPIRY_TYPE); @@ -122,6 +127,7 @@ export const FormComponent = () => { const handleAmountChange = (e, id) => { updateFormField(id, e.target.value, 'input'); + setDefaultParams(id, e.target.value); }; const findTextByValue = (arr, value) => arr.find(item => item.value === value)?.text || null; @@ -215,6 +221,7 @@ export const FormComponent = () => { e.target.value, 'input' ); + setDefaultParams('duration_amount', e.target.value); }} />