Merge remote-tracking branch 'origin/feature/breadcrumb/fix_localize'

This commit is contained in:
Ahmed Bouhuolia
2020-05-20 07:06:15 +02:00
78 changed files with 833 additions and 538 deletions

View File

@@ -52,11 +52,11 @@ function AccountFormDialog({
}) {
const { formatMessage } = useIntl();
const accountFormValidationSchema = Yup.object().shape({
name: Yup.string().required(formatMessage({ id: 'required' })),
name: Yup.string().required().label(formatMessage({id:'account_name_'})),
code: Yup.number(),
account_type_id: Yup.string()
.nullable()
.required(formatMessage({ id: 'required' })),
.required().label(formatMessage({id:'account_type_id'})),
description: Yup.string().trim()
});
@@ -375,7 +375,7 @@ function AccountFormDialog({
text={
selectedSubaccount
? selectedSubaccount.name
: 'Select Parent Account'
: <T id={'select_parent_account'}/>
}
/>
</Select>

View File

@@ -46,13 +46,11 @@ function CurrencyDialog({
}) {
const {formatMessage} = useIntl();
const ValidationSchema = Yup.object().shape({
currency_name: Yup.string().required(
formatMessage({ id: 'required' })
),
const validationSchema = Yup.object().shape({
currency_name: Yup.string().required().label(formatMessage({id:'currency_name_'})),
currency_code: Yup.string()
.max(4)
.required(formatMessage({ id: 'required' })),
.required().label(formatMessage({id:'currency_code_'})),
});
const initialValues = useMemo(() => ({
currency_name: '',
@@ -63,9 +61,9 @@ function CurrencyDialog({
values,
errors,
touched,
isSubmitting,
setFieldValue,
getFieldProps,
isSubmitting,
handleSubmit,
resetForm,
} = useFormik({
@@ -74,13 +72,13 @@ function CurrencyDialog({
...(payload.action === 'edit' &&
pick(currency, Object.keys(initialValues))),
},
validationSchema: ValidationSchema,
validationSchema: validationSchema,
onSubmit: (values, { setSubmitting }) => {
if (payload.action === 'edit') {
requestEditCurrency(currency.id, values).then((response) => {
closeDialog(name);
AppToaster.show({
message: 'the_currency_has_been_edited',
message: formatMessage({id:'the_currency_has_been_successfully_edited'}),
intent: Intent.SUCCESS,
});
setSubmitting(false);
@@ -92,7 +90,7 @@ function CurrencyDialog({
requestSubmitCurrencies(values).then((response) => {
closeDialog(name);
AppToaster.show({
message: 'the_currency_has_been_submit',
message: formatMessage({id:'the_currency_has_been_successfully_created'}),
intent: Intent.SUCCESS,
});
setSubmitting(false);

View File

@@ -49,9 +49,9 @@ function ExchangeRateDialog({
const [selectedItems, setSelectedItems] = useState({});
const validationSchema = Yup.object().shape({
exchange_rate: Yup.number().required(),
currency_code: Yup.string().max(3).required(),
date: Yup.date().required(),
exchange_rate: Yup.number().required().label(formatMessage({id:'exchange_rate_'})),
currency_code: Yup.string().max(3).required(formatMessage({id:'currency_code_'})),
date: Yup.date().required().label(formatMessage({id:'date'})),
});
const initialValues = useMemo(() => ({
@@ -82,7 +82,7 @@ function ExchangeRateDialog({
.then((response) => {
closeDialog(name);
AppToaster.show({
message: 'the_exchange_rate_has_been_edited',
message: formatMessage({id:'the_exchange_rate_has_been_successfully_edited'})
});
setSubmitting(false);
})
@@ -94,7 +94,7 @@ function ExchangeRateDialog({
.then((response) => {
closeDialog(name);
AppToaster.show({
message: 'the_exchangeRate_has_been_submit',
message: formatMessage({id:'the_exchange_rate_has_been_successfully_created'})
});
setSubmitting(false);
})

View File

@@ -37,12 +37,12 @@ function InviteUserDialog({
}, false);
const validationSchema = Yup.object().shape({
first_name: Yup.string().required(formatMessage({ id: 'required' })),
last_name: Yup.string().required(formatMessage({ id: 'required' })),
first_name: Yup.string().required().label(formatMessage({id:'first_name_'})),
last_name: Yup.string().required().label(formatMessage({id:'last_name_'})),
email: Yup.string()
.email()
.required(formatMessage({ id: 'required' })),
phone_number: Yup.number().required(formatMessage({ id: 'required' })),
.required().label(formatMessage({id:'email'})),
phone_number: Yup.number().required().label(formatMessage({id:'phone_number_'})),
});
const initialValues = useMemo(
@@ -74,7 +74,7 @@ function InviteUserDialog({
.then((response) => {
closeDialog(name);
AppToaster.show({
message: 'the_user_details_has_been_updated',
message: formatMessage({id:'the_user_details_has_been_updated'}),
});
setSubmitting(false);
})

View File

@@ -61,7 +61,7 @@ function ItemCategoryDialog({
() => requestFetchItemCategories());
const validationSchema = Yup.object().shape({
name: Yup.string().required(),
name: Yup.string().required().label(formatMessage({id:'category_name_'})),
parent_category_id: Yup.string().nullable(),
description: Yup.string().trim()
});

View File

@@ -30,7 +30,7 @@ function ItemFromDialog({
const [state, setState] = useState({});
const { formatMessage } = useIntl();
const ValidationSchema = Yup.object().shape({
name: Yup.string().required(formatMessage({ id: 'required' })),
name: Yup.string().required().label(formatMessage({id:'category_name_'})),
description: Yup.string().trim(),
});
@@ -42,7 +42,7 @@ function ItemFromDialog({
submitItemCategory({ values })
.then((response) => {
AppToaster.show({
message: 'the_category_has_been_submit',
message: formatMessage({id:'the_category_has_been_successfully_created'}),
});
})
.catch((error) => {

View File

@@ -36,7 +36,7 @@ function UserFormDialog({
}, false);
const validationSchema = Yup.object().shape({
email: Yup.string().email().required(),
email: Yup.string().email().required().label(formatMessage({id:'email'})),
});
const initialValues = {