fix : common rtl

This commit is contained in:
elforjani3
2021-06-14 15:45:11 +02:00
parent 0a276ca5e0
commit aa21da88b3
7 changed files with 44 additions and 23 deletions

View File

@@ -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',
},
];

View File

@@ -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' },

View File

@@ -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'),

View File

@@ -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')}`,

View File

@@ -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' },
];

View File

@@ -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 (
<Form>
{/* ---------- Organization name ---------- */}
<FastField name={'name'}>
{({ field, meta: { error, touched } }) => (
<FormGroup
@@ -53,6 +59,7 @@ export default function PreferencesGeneralForm({}) {
)}
</FastField>
{/* ---------- Financial starting date ---------- */}
<FastField name={'financial_date_start'}>
{({ form, field: { value }, meta: { error, touched } }) => (
<FormGroup
@@ -89,6 +96,7 @@ export default function PreferencesGeneralForm({}) {
)}
</FastField>
{/* ---------- Location ---------- */}
<FastField name={'location'}>
{({ form, field: { value }, meta: { error, touched } }) => (
<FormGroup
@@ -102,7 +110,7 @@ export default function PreferencesGeneralForm({}) {
intent={inputIntent({ error, touched })}
>
<ListSelect
items={countriesOptions}
items={Countries}
onItemSelect={({ value }) => {
form.setFieldValue('location', value);
}}
@@ -116,6 +124,7 @@ export default function PreferencesGeneralForm({}) {
)}
</FastField>
{/* ---------- Base currency ---------- */}
<FastField name={'base_currency'}>
{({ form, field: { value }, meta: { error, touched } }) => (
<FormGroup
@@ -133,7 +142,7 @@ export default function PreferencesGeneralForm({}) {
}
>
<ListSelect
items={currencies}
items={Currencies}
onItemSelect={(currency) => {
form.setFieldValue('base_currency', currency.code);
}}
@@ -148,6 +157,7 @@ export default function PreferencesGeneralForm({}) {
)}
</FastField>
{/* --------- Fiscal Year ----------- */}
<FastField name={'fiscal_year'}>
{({ form, field: { value }, meta: { error, touched } }) => (
<FormGroup
@@ -159,7 +169,7 @@ export default function PreferencesGeneralForm({}) {
intent={inputIntent({ error, touched })}
>
<ListSelect
items={fiscalYearOptions}
items={FiscalYear}
onItemSelect={({ value }) =>
form.setFieldValue('fiscal_year', value)
}
@@ -173,6 +183,7 @@ export default function PreferencesGeneralForm({}) {
)}
</FastField>
{/* ---------- Language ---------- */}
<FastField name={'language'}>
{({ form, field: { value }, meta: { error, touched } }) => (
<FormGroup
@@ -184,7 +195,7 @@ export default function PreferencesGeneralForm({}) {
helperText={<ErrorMessage name="language" />}
>
<ListSelect
items={languages}
items={Languages}
selectedItemProp={'value'}
textProp={'name'}
defaultText={<T id={'select_language'} />}
@@ -198,6 +209,7 @@ export default function PreferencesGeneralForm({}) {
)}
</FastField>
{/* ---------- Time zone ---------- */}
<FastField name={'time_zone'}>
{({ form, field: { value }, meta: { error, touched } }) => (
<FormGroup
@@ -224,6 +236,7 @@ export default function PreferencesGeneralForm({}) {
)}
</FastField>
{/* --------- Data format ----------- */}
<FastField name={'date_format'}>
{({ form, field: { value }, meta: { error, touched } }) => (
<FormGroup
@@ -235,7 +248,7 @@ export default function PreferencesGeneralForm({}) {
helperText={<ErrorMessage name="date_format" />}
>
<ListSelect
items={dateFormatsOptions}
items={DataFormats}
onItemSelect={(dateFormat) => {
form.setFieldValue('date_format', dateFormat.value);
}}

View File

@@ -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 (
<Form>
@@ -97,7 +100,7 @@ export default function SetupOrganizationForm({ isSubmitting, values }) {
helperText={<ErrorMessage name={'baseCurrency'} />}
>
<ListSelect
items={currencies}
items={Currencies}
noResults={<MenuItem disabled={true} text={<T id={'no_results'} />} />}
popoverProps={{ minimal: true }}
onItemSelect={(item) => {
@@ -132,7 +135,7 @@ export default function SetupOrganizationForm({ isSubmitting, values }) {
helperText={<ErrorMessage name={'language'} />}
>
<ListSelect
items={languages}
items={Languages}
noResults={<MenuItem disabled={true} text={<T id={'no_results'} />} />}
onItemSelect={(item) => {
setFieldValue('language', item.value);
@@ -164,7 +167,7 @@ export default function SetupOrganizationForm({ isSubmitting, values }) {
helperText={<ErrorMessage name={'fiscalYear'} />}
>
<ListSelect
items={fiscalYearOptions}
items={FiscalYear}
noResults={<MenuItem disabled={true} text={<T id={'no_results'} />} />}
selectedItem={value}
selectedItemProp={'value'}