This commit is contained in:
karimaldeen 2024-09-12 16:24:13 +03:00
parent e17629a9ba
commit bcc86c7841
5 changed files with 12 additions and 6 deletions

View File

@ -28,6 +28,8 @@ const SelectField = ({
formik.setFieldValue(name, value); formik.setFieldValue(name, value);
}; };
const options = translateOptions(option, t); const options = translateOptions(option, t);
console.log(options);
return ( return (
<div className="ValidationField w-100"> <div className="ValidationField w-100">
<ValidationFieldLabel <ValidationFieldLabel

View File

@ -1,4 +1,6 @@
export const translateOptions = (options: any, t: any) => { export const translateOptions = (options: any, t: any) => {
console.log(options);
return options?.map((opt: any) => ({ return options?.map((opt: any) => ({
...opt, ...opt,
label: t(`${opt?.label}`), label: t(`${opt?.label}`),

View File

@ -19,6 +19,7 @@ const Form = () => {
placeholder="term" placeholder="term"
label="term" label="term"
option={termsArray} option={termsArray}
/> />
</Col> </Col>
</Row> </Row>

View File

@ -1,6 +1,6 @@
export const enumToArray = (enumObj: any) => { export const enumToArray = (enumObj: any) => {
return Object.keys(enumObj).map((key) => ({ return Object.keys(enumObj).map((key) => ({
value: enumObj[key], id: enumObj[key],
label: `select.enums.${enumObj[key]}`, name: `select.enums.${enumObj[key]}`,
})); }));
}; };

View File

@ -413,6 +413,10 @@
"id_image":"صورة الهوية" "id_image":"صورة الهوية"
}, },
"select": { "select": {
"enums": {
"first_term": "الفصل الأول",
"second_term": "الفصل الثاني"
},
"Payments": { "Payments": {
"paid": "قبض", "paid": "قبض",
"to_be_paid": "مرتجع", "to_be_paid": "مرتجع",
@ -663,10 +667,7 @@
"admin": "المسؤول", "admin": "المسؤول",
"branchAdmin": "مسؤول الفروع" "branchAdmin": "مسؤول الفروع"
}, },
"enums": {
"first_term": "الفصل الأول",
"second_term": "الفصل الثاني"
},
"array": { "array": {
"Period": { "Period": {
"Today": "اليوم", "Today": "اليوم",