Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 19 additions & 0 deletions src/components/SubStepForms/CountryFullStep.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,13 @@ import {View} from 'react-native';
import FormProvider from '@components/Form/FormProvider';
import InputWrapper from '@components/Form/InputWrapper';
import type {FormInputErrors, FormOnyxValues} from '@components/Form/types';
import FormHelpMessage from '@components/FormHelpMessage';
import InteractiveStepWrapper from '@components/InteractiveStepWrapper';
import MenuItemWithTopDescription from '@components/MenuItemWithTopDescription';
import PushRowWithModal from '@components/PushRowWithModal';
import Text from '@components/Text';
import TextLink from '@components/TextLink';
import useEnvironment from '@hooks/useEnvironment';
import useExpensifyCardUkEuSupported from '@hooks/useExpensifyCardUkEuSupported';
import useLocalize from '@hooks/useLocalize';
import useOnyx from '@hooks/useOnyx';
Expand Down Expand Up @@ -49,9 +51,11 @@ function CountryFullStep({onBackButtonPress, stepNames, onSubmit, policyID, isCo
const styles = useThemeStyles();
// eslint-disable-next-line rulesdir/prefer-shouldUseNarrowLayout-instead-of-isSmallScreenWidth
const {isSmallScreenWidth} = useResponsiveLayout();
const {environmentURL} = useEnvironment();
const [reimbursementAccount] = useOnyx(ONYXKEYS.REIMBURSEMENT_ACCOUNT);
const [reimbursementAccountDraft] = useOnyx(ONYXKEYS.FORMS.REIMBURSEMENT_ACCOUNT_FORM_DRAFT);
const [policy] = useOnyx(`${ONYXKEYS.COLLECTION.POLICY}${policyID}`);
const [showNoPolicyError, setShowNoPolicyError] = useState(false);

const currency =
reimbursementAccountDraft?.currency ??
Expand Down Expand Up @@ -80,6 +84,10 @@ function CountryFullStep({onBackButtonPress, stepNames, onSubmit, policyID, isCo
};

const handleSubmit = () => {
if (currency === CONST.CURRENCY.AUD && !policyID) {
setShowNoPolicyError(true);
return;
}
if (selectedCountry !== countryDefaultValue) {
setDraftValues(ONYXKEYS.FORMS.REIMBURSEMENT_ACCOUNT_FORM, {[COUNTRY]: selectedCountry});
}
Expand Down Expand Up @@ -117,6 +125,7 @@ function CountryFullStep({onBackButtonPress, stepNames, onSubmit, policyID, isCo
submitButtonStyles={[styles.mh5, styles.pb0]}
isSubmitDisabled={disableSubmit}
shouldHideFixErrorsAlert
submitFlexEnabled={!showNoPolicyError}
>
<Text style={[styles.textHeadlineLineHeightXXL, styles.ph5, styles.mb3]}>{translate('countryStep.confirmBusinessBank')}</Text>
<MenuItemWithTopDescription
Expand Down Expand Up @@ -150,6 +159,16 @@ function CountryFullStep({onBackButtonPress, stepNames, onSubmit, policyID, isCo
inputID={COUNTRY}
shouldSaveDraft={false}
/>
{showNoPolicyError && (
<View style={[styles.flex1, styles.justifyContentEnd, styles.ph5]}>
<FormHelpMessage
style={styles.mt3}
isError
shouldRenderMessageAsHTML
message={translate('countryStep.error.connectToWorkspace', `${environmentURL}/${ROUTES.WORKSPACES_LIST.getRoute()}`)}
/>
</View>
)}
</FormProvider>
</InteractiveStepWrapper>
);
Expand Down
4 changes: 4 additions & 0 deletions src/languages/de.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3814,6 +3814,10 @@ ${amount} für ${merchant} – ${date}`,
youCanChange: 'Sie können die Währung Ihres Arbeitsbereichs in Ihren',
findCountry: 'Land finden',
selectCountry: 'Land auswählen',
error: {
connectToWorkspace: (workspaceRoute: string) =>
`Bitte verbinden Sie dieses Bankkonto mit einem <a href="${workspaceRoute}">Arbeitsbereich</a>, damit Sie in einem späteren Schritt einen Direktor zur Unterzeichnung einladen können.`,
},
},
bankInfoStep: {
whatAreYour: 'Wie lauten die Bankdaten Ihres Geschäftskontos?',
Expand Down
4 changes: 4 additions & 0 deletions src/languages/en.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3873,6 +3873,10 @@ const translations = {
youCanChange: 'You can change your workspace currency in your',
findCountry: 'Find country',
selectCountry: 'Select country',
error: {
connectToWorkspace: (workspaceRoute: string) =>
`Please connect this bank account to a <a href="${workspaceRoute}">workspace</a> so you can invite a director to sign in a later step.`,
},
},
bankInfoStep: {
whatAreYour: 'What are your business bank account details?',
Expand Down
4 changes: 4 additions & 0 deletions src/languages/es.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3741,6 +3741,10 @@ ${amount} para ${merchant} - ${date}`,
youCanChange: 'Puede cambiar la moneda de su espacio de trabajo en su',
findCountry: 'Encontrar país',
selectCountry: 'Seleccione su país',
error: {
connectToWorkspace: (workspaceRoute: string) =>
`Por favor, conecta esta cuenta bancaria a un <a href="${workspaceRoute}">espacio de trabajo</a> para que puedas invitar a un director a firmar en un paso posterior.`,
},
},
bankInfoStep: {
whatAreYour: '¿Cuáles son los detalles de tu cuenta bancaria comercial?',
Expand Down
4 changes: 4 additions & 0 deletions src/languages/fr.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3825,6 +3825,10 @@ ${amount} pour ${merchant} - ${date}`,
youCanChange: 'Vous pouvez modifier la devise de votre espace de travail dans vos',
findCountry: 'Rechercher un pays',
selectCountry: 'Sélectionner un pays',
error: {
connectToWorkspace: (workspaceRoute: string) =>
`Veuillez connecter ce compte bancaire à un <a href="${workspaceRoute}">espace de travail</a> afin de pouvoir inviter un directeur à signer lors d'une étape ultérieure.`,
},
},
bankInfoStep: {
whatAreYour: 'Quelles sont les coordonnées de votre compte bancaire professionnel ?',
Expand Down
4 changes: 4 additions & 0 deletions src/languages/it.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3805,6 +3805,10 @@ ${amount} per ${merchant} - ${date}`,
youCanChange: 'Puoi cambiare la valuta dello spazio di lavoro nelle tue',
findCountry: 'Trova paese',
selectCountry: 'Seleziona paese',
error: {
connectToWorkspace: (workspaceRoute: string) =>
`Collega questo conto bancario a un <a href="${workspaceRoute}">spazio di lavoro</a> per poter invitare un direttore a firmare in un passaggio successivo.`,
},
},
bankInfoStep: {
whatAreYour: 'Quali sono i dati del tuo conto bancario aziendale?',
Expand Down
4 changes: 4 additions & 0 deletions src/languages/ja.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3776,6 +3776,10 @@ ${integrationName === CONST.ONBOARDING_ACCOUNTING_MAPPING.other ? 'あなたの'
youCanChange: 'ワークスペースの通貨は、次の場所で変更できます',
findCountry: '国を検索',
selectCountry: '国を選択',
error: {
connectToWorkspace: (workspaceRoute: string) =>
`後のステップでディレクターに署名を依頼できるよう、この銀行口座を<a href="${workspaceRoute}">ワークスペース</a>に接続してください。`,
},
},
bankInfoStep: {
whatAreYour: 'あなたのビジネス用銀行口座の詳細を教えてください。',
Expand Down
4 changes: 4 additions & 0 deletions src/languages/nl.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3802,6 +3802,10 @@ ${amount} voor ${merchant} - ${date}`,
youCanChange: 'Je kunt de valuta van je werkruimte wijzigen in je',
findCountry: 'Land zoeken',
selectCountry: 'Selecteer land',
error: {
connectToWorkspace: (workspaceRoute: string) =>
`Verbind deze bankrekening met een <a href="${workspaceRoute}">werkruimte</a> zodat je in een latere stap een directeur kunt uitnodigen om te ondertekenen.`,
},
},
bankInfoStep: {
whatAreYour: 'Wat zijn de gegevens van je zakelijke bankrekening?',
Expand Down
4 changes: 4 additions & 0 deletions src/languages/pl.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3795,6 +3795,10 @@ ${amount} dla ${merchant} - ${date}`,
youCanChange: 'Możesz zmienić walutę swojego workspace’u w swoim',
findCountry: 'Znajdź kraj',
selectCountry: 'Wybierz kraj',
error: {
connectToWorkspace: (workspaceRoute: string) =>
`Połącz to konto bankowe z <a href="${workspaceRoute}">przestrzenią roboczą</a>, aby móc zaprosić dyrektora do podpisania w kolejnym kroku.`,
},
},
bankInfoStep: {
whatAreYour: 'Jakie są dane Twojego firmowego konta bankowego?',
Expand Down
4 changes: 4 additions & 0 deletions src/languages/pt-BR.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3794,6 +3794,10 @@ ${amount} para ${merchant} - ${date}`,
youCanChange: 'Você pode mudar a moeda do seu workspace em seu',
findCountry: 'Encontrar país',
selectCountry: 'Selecione o país',
error: {
connectToWorkspace: (workspaceRoute: string) =>
`Por favor, conecte esta conta bancária a um <a href="${workspaceRoute}">espaço de trabalho</a> para que você possa convidar um diretor para assinar em uma etapa posterior.`,
},
},
bankInfoStep: {
whatAreYour: 'Quais são os dados da sua conta bancária empresarial?',
Expand Down
3 changes: 3 additions & 0 deletions src/languages/zh-hans.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3708,6 +3708,9 @@ ${amount},商户:${merchant} - 日期:${date}`,
youCanChange: '您可以在您的中更改工作区货币',
findCountry: '查找国家',
selectCountry: '选择国家',
error: {
connectToWorkspace: (workspaceRoute: string) => `请将此银行账户连接到<a href="${workspaceRoute}">工作区</a>,以便您在后续步骤中邀请董事签名。`,
},
},
bankInfoStep: {
whatAreYour: '您的企业银行账户信息是什么?',
Expand Down
8 changes: 4 additions & 4 deletions src/pages/ReimbursementAccount/NonUSD/SignerInfo/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ const {OWNS_MORE_THAN_25_PERCENT, COMPANY_NAME, SIGNER_FULL_NAME} = INPUT_IDS.AD
function SignerInfo({onBackButtonPress, onSubmit, stepNames, currentSubPage, backTo}: NonUSDPageProps) {
const {translate} = useLocalize();
const styles = useThemeStyles();
const {isProduction} = useEnvironment();
const {isProduction, environmentURL} = useEnvironment();

const [reimbursementAccount] = useOnyx(ONYXKEYS.REIMBURSEMENT_ACCOUNT);
const [reimbursementAccountDraft] = useOnyx(ONYXKEYS.FORMS.REIMBURSEMENT_ACCOUNT_FORM_DRAFT);
Expand Down Expand Up @@ -128,7 +128,7 @@ function SignerInfo({onBackButtonPress, onSubmit, stepNames, currentSubPage, bac

const handleIsDirectorSelected = useCallback(
(value: boolean) => {
if (!policyID && (!value || currency === CONST.CURRENCY.AUD)) {
if (!policyID && !value) {
setShowNoPolicyError(true);
return;
}
Expand All @@ -140,7 +140,7 @@ function SignerInfo({onBackButtonPress, onSubmit, stepNames, currentSubPage, bac
Navigation.navigate(ROUTES.BANK_ACCOUNT_NON_USD_SETUP.getRoute({policyID, page: PAGE_NAME.SIGNER_INFO, subPage: SUB_PAGE_NAMES.ENTER_EMAIL, backTo}));
}
},
[policyID, currency, isUserOwner, backTo],
[policyID, isUserOwner, backTo],
);

const handleBackButtonPress = useCallback(() => {
Expand Down Expand Up @@ -195,7 +195,7 @@ function SignerInfo({onBackButtonPress, onSubmit, stepNames, currentSubPage, bac
style={styles.mt3}
isError
shouldRenderMessageAsHTML
message={translate('signerInfoStep.error.connectToWorkspace', ROUTES.WORKSPACES_LIST.getRoute())}
message={translate('signerInfoStep.error.connectToWorkspace', `${environmentURL}/${ROUTES.WORKSPACES_LIST.getRoute()}`)}
/>
</View>
)}
Expand Down
Loading