diff --git a/client/src/common/countries.js b/client/src/common/countries.js index c86568887..c1bfe5c5a 100644 --- a/client/src/common/countries.js +++ b/client/src/common/countries.js @@ -1,3 +1,8 @@ import intl from 'react-intl-universal'; -export default [{ name: intl.get('libya'), value: 'libya' }]; +export const getCountries = () => [ + { + name: intl.get('libya'), + value: 'libya', + }, +]; diff --git a/client/src/common/currencies.js b/client/src/common/currencies.js index ae1dbd6d9..b47f16807 100644 --- a/client/src/common/currencies.js +++ b/client/src/common/currencies.js @@ -1,6 +1,6 @@ import intl from 'react-intl-universal'; -export default [ +export const getCurrencies = () => [ { name: intl.get('us_dollar'), code: 'USD' }, { name: intl.get('euro'), code: 'EUR' }, { name: intl.get('libyan_diner'), code: 'LYD' }, diff --git a/client/src/common/dateFormatsOptions.js b/client/src/common/dateFormatsOptions.js index 8c6ed99a2..3a194a790 100644 --- a/client/src/common/dateFormatsOptions.js +++ b/client/src/common/dateFormatsOptions.js @@ -1,7 +1,7 @@ import moment from 'moment'; import intl from 'react-intl-universal'; -export default [ +export const getDateFormats =()=> [ { id: 1, name: intl.get('mm_dd_yy'), diff --git a/client/src/common/fiscalYearOptions.js b/client/src/common/fiscalYearOptions.js index 24043ec80..9fd5c3845 100644 --- a/client/src/common/fiscalYearOptions.js +++ b/client/src/common/fiscalYearOptions.js @@ -1,6 +1,6 @@ import intl from 'react-intl-universal'; -export const getFiscalYearOptions = () => [ +export const getFiscalYear = () => [ { id: 0, name: `${intl.get('january')} - ${intl.get('december')}`, diff --git a/client/src/common/languagesOptions.js b/client/src/common/languagesOptions.js index 77ddb2f6b..76f630e76 100644 --- a/client/src/common/languagesOptions.js +++ b/client/src/common/languagesOptions.js @@ -1,6 +1,6 @@ import intl from 'react-intl-universal'; -export default [ +export const getLanguages = () => [ { name: intl.get('english'), value: 'en' }, { name: intl.get('arabic'), value: 'ar' }, ]; diff --git a/client/src/containers/Preferences/General/GeneralForm.js b/client/src/containers/Preferences/General/GeneralForm.js index 06c164b2a..6446ecacb 100644 --- a/client/src/containers/Preferences/General/GeneralForm.js +++ b/client/src/containers/Preferences/General/GeneralForm.js @@ -22,15 +22,20 @@ import { handleDateChange, } from 'utils'; import { CLASSES } from 'common/classes'; -import countriesOptions from 'common/countries'; -import currencies from 'common/currencies'; -import { getFiscalYearOptions } from 'common/fiscalYearOptions'; -import languages from 'common/languagesOptions'; -import dateFormatsOptions from 'common/dateFormatsOptions'; +import { getCountries } from 'common/countries'; +import { getCurrencies } from 'common/currencies'; +import { getFiscalYear } from 'common/fiscalYearOptions'; +import { getLanguages } from 'common/languagesOptions'; +import { getDateFormats } from 'common/dateFormatsOptions'; export default function PreferencesGeneralForm({}) { const history = useHistory(); - const fiscalYearOptions = getFiscalYearOptions(); + + const FiscalYear = getFiscalYear(); + const Countries = getCountries(); + const Languages = getLanguages(); + const Currencies = getCurrencies(); + const DataFormats = getDateFormats(); const handleCloseClick = () => { history.go(-1); @@ -38,6 +43,7 @@ export default function PreferencesGeneralForm({}) { return (
+ {/* ---------- Organization name ---------- */} {({ field, meta: { error, touched } }) => ( + {/* ---------- Financial starting date ---------- */} {({ form, field: { value }, meta: { error, touched } }) => ( + {/* ---------- Location ---------- */} {({ form, field: { value }, meta: { error, touched } }) => ( { form.setFieldValue('location', value); }} @@ -116,6 +124,7 @@ export default function PreferencesGeneralForm({}) { )} + {/* ---------- Base currency ---------- */} {({ form, field: { value }, meta: { error, touched } }) => ( { form.setFieldValue('base_currency', currency.code); }} @@ -148,6 +157,7 @@ export default function PreferencesGeneralForm({}) { )} + {/* --------- Fiscal Year ----------- */} {({ form, field: { value }, meta: { error, touched } }) => ( form.setFieldValue('fiscal_year', value) } @@ -173,6 +183,7 @@ export default function PreferencesGeneralForm({}) { )} + {/* ---------- Language ---------- */} {({ form, field: { value }, meta: { error, touched } }) => ( } > } @@ -198,6 +209,7 @@ export default function PreferencesGeneralForm({}) { )} + {/* ---------- Time zone ---------- */} {({ form, field: { value }, meta: { error, touched } }) => ( + {/* --------- Data format ----------- */} {({ form, field: { value }, meta: { error, touched } }) => ( } > { form.setFieldValue('date_format', dateFormat.value); }} diff --git a/client/src/containers/Setup/SetupOrganizationForm.js b/client/src/containers/Setup/SetupOrganizationForm.js index 4fa0a6a46..4630cd9d2 100644 --- a/client/src/containers/Setup/SetupOrganizationForm.js +++ b/client/src/containers/Setup/SetupOrganizationForm.js @@ -22,16 +22,19 @@ import { handleDateChange } from 'utils'; -import { getFiscalYearOptions } from 'common/fiscalYearOptions'; -import languages from 'common/languagesOptions'; -import currencies from 'common/currencies'; +import { getFiscalYear } from 'common/fiscalYearOptions'; +import { getLanguages } from 'common/languagesOptions'; +import { getCurrencies } from 'common/currencies'; + /** * Setup organization form. */ export default function SetupOrganizationForm({ isSubmitting, values }) { - const fiscalYearOptions = getFiscalYearOptions(); + const FiscalYear = getFiscalYear(); + const Languages = getLanguages(); + const Currencies = getCurrencies(); return ( @@ -97,7 +100,7 @@ export default function SetupOrganizationForm({ isSubmitting, values }) { helperText={} > } />} popoverProps={{ minimal: true }} onItemSelect={(item) => { @@ -132,7 +135,7 @@ export default function SetupOrganizationForm({ isSubmitting, values }) { helperText={} > } />} onItemSelect={(item) => { setFieldValue('language', item.value); @@ -164,7 +167,7 @@ export default function SetupOrganizationForm({ isSubmitting, values }) { helperText={} > } />} selectedItem={value} selectedItemProp={'value'}