feat(webapp): add all countries to the setup organization page

This commit is contained in:
a.bouhuolia
2023-04-05 01:30:36 +02:00
parent a5c190e094
commit da20b7c837
7 changed files with 2304 additions and 30 deletions

File diff suppressed because it is too large Load Diff

View File

@@ -3,5 +3,4 @@ import intl from 'react-intl-universal';
export const getLanguages = () => [ export const getLanguages = () => [
{ name: intl.get('english'), value: 'en' }, { name: intl.get('english'), value: 'en' },
{ name: intl.get('arabic'), value: 'ar' },
]; ];

View File

@@ -63,7 +63,14 @@ export const AuthFooterLink = styled.p`
`; `;
export const AuthSubmitButton = styled(Button)` export const AuthSubmitButton = styled(Button)`
background-color: #0052cc;
min-height: 45px;
margin-top: 20px; margin-top: 20px;
&.bp3-intent-primary {
background-color: #0052cc;
&:disabled,
&.bp3-disabled {
background-color: rgba(0, 82, 204, 0.4);
}
}
`; `;

View File

@@ -5,15 +5,12 @@ import {
Button, Button,
Intent, Intent,
FormGroup, FormGroup,
InputGroup,
MenuItem, MenuItem,
Classes, Classes,
} from '@blueprintjs/core'; } from '@blueprintjs/core';
import classNames from 'classnames'; import classNames from 'classnames';
import { TimezonePicker } from '@blueprintjs/timezone'; import { TimezonePicker } from '@blueprintjs/timezone';
import useAutofocus from '@/hooks/useAutofocus' import { FFormGroup, FInputGroup, FormattedMessage as T } from '@/components';
import { FormattedMessage as T } from '@/components';
import { getCountries } from '@/constants/countries';
import { Col, Row, ListSelect } from '@/components'; import { Col, Row, ListSelect } from '@/components';
import { inputIntent } from '@/utils'; import { inputIntent } from '@/utils';
@@ -21,6 +18,9 @@ import { inputIntent } from '@/utils';
import { getFiscalYear } from '@/constants/fiscalYearOptions'; import { getFiscalYear } from '@/constants/fiscalYearOptions';
import { getLanguages } from '@/constants/languagesOptions'; import { getLanguages } from '@/constants/languagesOptions';
import { getAllCurrenciesOptions } from '@/constants/currencies'; import { getAllCurrenciesOptions } from '@/constants/currencies';
import { getAllCountries } from '@/utils/countries';
const countries = getAllCountries();
/** /**
* Setup organization form. * Setup organization form.
@@ -29,9 +29,6 @@ export default function SetupOrganizationForm({ isSubmitting, values }) {
const FiscalYear = getFiscalYear(); const FiscalYear = getFiscalYear();
const Languages = getLanguages(); const Languages = getLanguages();
const currencies = getAllCurrenciesOptions(); const currencies = getAllCurrenciesOptions();
const countries = getCountries();
const accountRef = useAutofocus();
return ( return (
<Form> <Form>
@@ -40,22 +37,9 @@ export default function SetupOrganizationForm({ isSubmitting, values }) {
</h3> </h3>
{/* ---------- Organization name ---------- */} {/* ---------- Organization name ---------- */}
<FastField name={'name'}> <FFormGroup name={'name'} label={<T id={'legal_organization_name'} />}>
{({ form, field, meta: { error, touched } }) => ( <FInputGroup name={'name'} />
<FormGroup </FFormGroup>
label={<T id={'legal_organization_name'} />}
className={'form-group--name'}
intent={inputIntent({ error, touched })}
helperText={<ErrorMessage name={'name'} />}
>
<InputGroup
{...field}
intent={inputIntent({ error, touched })}
inputRef={accountRef}
/>
</FormGroup>
)}
</FastField>
{/* ---------- Location ---------- */} {/* ---------- Location ---------- */}
<FastField name={'location'}> <FastField name={'location'}>
@@ -71,11 +55,11 @@ export default function SetupOrganizationForm({ isSubmitting, values }) {
> >
<ListSelect <ListSelect
items={countries} items={countries}
onItemSelect={({ value }) => { onItemSelect={({ countryCode }) => {
form.setFieldValue('location', value); form.setFieldValue('location', countryCode);
}} }}
selectedItem={value} selectedItem={value}
selectedItemProp={'value'} selectedItemProp={'countryCode'}
defaultText={<T id={'select_business_location'} />} defaultText={<T id={'select_business_location'} />}
textProp={'name'} textProp={'name'}
popoverProps={{ minimal: true }} popoverProps={{ minimal: true }}

View File

@@ -16,7 +16,7 @@ import { getSetupOrganizationValidation } from './SetupOrganization.schema';
// Initial values. // Initial values.
const defaultValues = { const defaultValues = {
name: '', name: '',
location: 'libya', location: '',
baseCurrency: '', baseCurrency: '',
language: 'en', language: 'en',
fiscalYear: '', fiscalYear: '',

View File

@@ -55,6 +55,11 @@
height: 40px; height: 40px;
font-size: 15px; font-size: 15px;
width: 100%; width: 100%;
&:disabled,
&.bp3-loading{
background-color: rgba(28, 36, 72, 0.5);
}
} }
} }
} }

View File

@@ -0,0 +1,10 @@
import { Countries } from '@/constants/countries';
export const getAllCountries = () => {
return Object.keys(Countries).map((countryCode) => {
return {
...Countries[countryCode],
countryCode,
}
});
};