From 62c3bfcfbdecb5e5886f6b54fa9a5e08d033ba49 Mon Sep 17 00:00:00 2001 From: amina-deriv <84661147+amina-deriv@users.noreply.github.com> Date: Tue, 21 Jan 2025 15:33:35 +0400 Subject: [PATCH] Amina/fix: add addditional dropdown options for account opening reason (#17977) * fix: add addditional dropdown options for account opening reason * fix: saving old value --- .../Profile/PersonalDetails/constants.ts | 5 +++++ .../PersonalDetails/personal-details-form.tsx | 21 +++++++++++++------ 2 files changed, 20 insertions(+), 6 deletions(-) diff --git a/packages/account/src/Sections/Profile/PersonalDetails/constants.ts b/packages/account/src/Sections/Profile/PersonalDetails/constants.ts index 66c820634ae2..a7d7910e162e 100644 --- a/packages/account/src/Sections/Profile/PersonalDetails/constants.ts +++ b/packages/account/src/Sections/Profile/PersonalDetails/constants.ts @@ -5,3 +5,8 @@ export const account_opening_reason_list = [ { text: localize('Income Earning'), value: 'Income Earning' }, { text: localize('Hedging'), value: 'Hedging' }, ]; + +export const account_opening_reason_new_list = [ + { text: localize('Additional revenue'), value: 'Additional revenue' }, + { text: localize('Savings'), value: 'Savings' }, +]; diff --git a/packages/account/src/Sections/Profile/PersonalDetails/personal-details-form.tsx b/packages/account/src/Sections/Profile/PersonalDetails/personal-details-form.tsx index c281249449c9..f79bc8d60833 100644 --- a/packages/account/src/Sections/Profile/PersonalDetails/personal-details-form.tsx +++ b/packages/account/src/Sections/Profile/PersonalDetails/personal-details-form.tsx @@ -42,7 +42,7 @@ import { isFieldImmutable } from '../../../Helpers/utils'; import { useScrollElementToTop } from '../../../hooks'; import { PersonalDetailsValueTypes } from '../../../Types'; -import { account_opening_reason_list } from './constants'; +import { account_opening_reason_list, account_opening_reason_new_list } from './constants'; import InputGroup from './input-group'; import { getPersonalDetailsInitialValues, getPersonalDetailsValidationSchema, makeSettingsRequest } from './validation'; import { VerifyButton } from './verify-button'; @@ -379,6 +379,18 @@ const PersonalDetailsForm = observer(() => { isCountryCodeDropdownEnabled ); + const getAccountOpeningReason = () => { + const result = account_opening_reason_new_list.find( + item => item.value === initialValues?.account_opening_reason + ); + + if (result) return account_opening_reason_new_list; + + const item = account_opening_reason_list.find(item => item.value === initialValues?.account_opening_reason); + + return item ? [item, ...account_opening_reason_new_list] : account_opening_reason_new_list; + }; + return ( { )}