-
Notifications
You must be signed in to change notification settings - Fork 3k
/
getInitialSubstepForBusinessInfo.ts
45 lines (34 loc) · 1.23 KB
/
getInitialSubstepForBusinessInfo.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
import INPUT_IDS from '@src/types/form/ReimbursementAccountForm';
import type {CompanyStepProps} from '@src/types/form/ReimbursementAccountForm';
const businessInfoStepKeys = INPUT_IDS.BUSINESS_INFO_STEP;
/**
* Returns the initial substep for the Business Info step based on already existing data
*/
function getInitialSubstepForBusinessInfo(data: CompanyStepProps): number {
if (data[businessInfoStepKeys.COMPANY_NAME] === '') {
return 0;
}
if (data[businessInfoStepKeys.COMPANY_TAX_ID] === '') {
return 1;
}
if (data[businessInfoStepKeys.COMPANY_WEBSITE] === '') {
return 2;
}
if (data[businessInfoStepKeys.COMPANY_PHONE] === '') {
return 3;
}
if (data[businessInfoStepKeys.STREET] === '' || data[businessInfoStepKeys.CITY] === '' || data[businessInfoStepKeys.STATE] === '' || data[businessInfoStepKeys.ZIP_CODE] === '') {
return 4;
}
if (data[businessInfoStepKeys.INCORPORATION_TYPE] === '') {
return 5;
}
if (data[businessInfoStepKeys.INCORPORATION_DATE] === '') {
return 6;
}
if (data[businessInfoStepKeys.INCORPORATION_STATE] === '') {
return 7;
}
return 8;
}
export default getInitialSubstepForBusinessInfo;