mirror of
https://github.com/bigcapitalhq/bigcapital.git
synced 2026-02-15 20:30:33 +00:00
feat(webapp): add all countries to the setup organization page
This commit is contained in:
2269
packages/webapp/src/constants/countries.ts
Normal file
2269
packages/webapp/src/constants/countries.ts
Normal file
File diff suppressed because it is too large
Load Diff
@@ -3,5 +3,4 @@ import intl from 'react-intl-universal';
|
||||
|
||||
export const getLanguages = () => [
|
||||
{ name: intl.get('english'), value: 'en' },
|
||||
{ name: intl.get('arabic'), value: 'ar' },
|
||||
];
|
||||
|
||||
@@ -63,7 +63,14 @@ export const AuthFooterLink = styled.p`
|
||||
`;
|
||||
|
||||
export const AuthSubmitButton = styled(Button)`
|
||||
background-color: #0052cc;
|
||||
min-height: 45px;
|
||||
margin-top: 20px;
|
||||
|
||||
&.bp3-intent-primary {
|
||||
background-color: #0052cc;
|
||||
|
||||
&:disabled,
|
||||
&.bp3-disabled {
|
||||
background-color: rgba(0, 82, 204, 0.4);
|
||||
}
|
||||
}
|
||||
`;
|
||||
|
||||
@@ -5,15 +5,12 @@ import {
|
||||
Button,
|
||||
Intent,
|
||||
FormGroup,
|
||||
InputGroup,
|
||||
MenuItem,
|
||||
Classes,
|
||||
} from '@blueprintjs/core';
|
||||
import classNames from 'classnames';
|
||||
import { TimezonePicker } from '@blueprintjs/timezone';
|
||||
import useAutofocus from '@/hooks/useAutofocus'
|
||||
import { FormattedMessage as T } from '@/components';
|
||||
import { getCountries } from '@/constants/countries';
|
||||
import { FFormGroup, FInputGroup, FormattedMessage as T } from '@/components';
|
||||
|
||||
import { Col, Row, ListSelect } from '@/components';
|
||||
import { inputIntent } from '@/utils';
|
||||
@@ -21,6 +18,9 @@ import { inputIntent } from '@/utils';
|
||||
import { getFiscalYear } from '@/constants/fiscalYearOptions';
|
||||
import { getLanguages } from '@/constants/languagesOptions';
|
||||
import { getAllCurrenciesOptions } from '@/constants/currencies';
|
||||
import { getAllCountries } from '@/utils/countries';
|
||||
|
||||
const countries = getAllCountries();
|
||||
|
||||
/**
|
||||
* Setup organization form.
|
||||
@@ -29,9 +29,6 @@ export default function SetupOrganizationForm({ isSubmitting, values }) {
|
||||
const FiscalYear = getFiscalYear();
|
||||
const Languages = getLanguages();
|
||||
const currencies = getAllCurrenciesOptions();
|
||||
const countries = getCountries();
|
||||
|
||||
const accountRef = useAutofocus();
|
||||
|
||||
return (
|
||||
<Form>
|
||||
@@ -40,22 +37,9 @@ export default function SetupOrganizationForm({ isSubmitting, values }) {
|
||||
</h3>
|
||||
|
||||
{/* ---------- Organization name ---------- */}
|
||||
<FastField name={'name'}>
|
||||
{({ form, field, meta: { error, touched } }) => (
|
||||
<FormGroup
|
||||
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>
|
||||
<FFormGroup name={'name'} label={<T id={'legal_organization_name'} />}>
|
||||
<FInputGroup name={'name'} />
|
||||
</FFormGroup>
|
||||
|
||||
{/* ---------- Location ---------- */}
|
||||
<FastField name={'location'}>
|
||||
@@ -71,11 +55,11 @@ export default function SetupOrganizationForm({ isSubmitting, values }) {
|
||||
>
|
||||
<ListSelect
|
||||
items={countries}
|
||||
onItemSelect={({ value }) => {
|
||||
form.setFieldValue('location', value);
|
||||
onItemSelect={({ countryCode }) => {
|
||||
form.setFieldValue('location', countryCode);
|
||||
}}
|
||||
selectedItem={value}
|
||||
selectedItemProp={'value'}
|
||||
selectedItemProp={'countryCode'}
|
||||
defaultText={<T id={'select_business_location'} />}
|
||||
textProp={'name'}
|
||||
popoverProps={{ minimal: true }}
|
||||
|
||||
@@ -16,7 +16,7 @@ import { getSetupOrganizationValidation } from './SetupOrganization.schema';
|
||||
// Initial values.
|
||||
const defaultValues = {
|
||||
name: '',
|
||||
location: 'libya',
|
||||
location: '',
|
||||
baseCurrency: '',
|
||||
language: 'en',
|
||||
fiscalYear: '',
|
||||
|
||||
@@ -55,6 +55,11 @@
|
||||
height: 40px;
|
||||
font-size: 15px;
|
||||
width: 100%;
|
||||
|
||||
&:disabled,
|
||||
&.bp3-loading{
|
||||
background-color: rgba(28, 36, 72, 0.5);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
10
packages/webapp/src/utils/countries.tsx
Normal file
10
packages/webapp/src/utils/countries.tsx
Normal file
@@ -0,0 +1,10 @@
|
||||
import { Countries } from '@/constants/countries';
|
||||
|
||||
export const getAllCountries = () => {
|
||||
return Object.keys(Countries).map((countryCode) => {
|
||||
return {
|
||||
...Countries[countryCode],
|
||||
countryCode,
|
||||
}
|
||||
});
|
||||
};
|
||||
Reference in New Issue
Block a user