fix question column

This commit is contained in:
karimaldeen 2024-09-14 17:02:32 +03:00
parent 091c0bf15c
commit b7276a2c6a
3 changed files with 94 additions and 10 deletions

View File

@ -45,19 +45,59 @@ export const useColumns = () => {
}, },
{ {
title: `${t("columns.content")}`, title: `${t("columns.content")}`,
dataIndex: "name", dataIndex: "content",
key: "name", key: "content",
align: "center", align: "center",
render: (text, record) => record?.content, render: (text, record) => record?.content,
ellipsis: true, ellipsis: true,
}, },
{ {
title: t("columns.isBase"), title: `${t("columns.hint")}`,
dataIndex: "hint",
key: "hint",
align: "center",
render: (text, record) => {
return (
<>{record?.hint ?? "karim"}</>
);
},
ellipsis: true,
},
{
title: `${t("columns.tags")}`,
dataIndex: "tags",
key: "tags",
align: "center",
render: (text, record) => {
const tags = record?.tags?.map((item:any)=>{
return item?.name
}) ?? [];
return (
<div>
{tags.length > 0 ? (
tags.map((tag, index) => (
<span key={index}>
{tag}
{index < tags.length - 1 && ', '}
</span>
))
) : (
<span>_</span>
)}
</div>
);
},
ellipsis: true,
},
{
title: t("columns.question_type"),
dataIndex: "isBase", dataIndex: "isBase",
key: "isBase", key: "isBase",
align: "center", align: "center",
render: (text, record) => render: (text, record) =>
record?.isBase ? t("practical.yes") : t("practical.no"), record?.isBase ? t("columns.base_question") : t("columns.normal_question"),
}, },
{ {
@ -66,7 +106,6 @@ export const useColumns = () => {
align: "center", align: "center",
render: (_text, record, index) => { render: (_text, record, index) => {
return ( return (
<ActionButtons <ActionButtons
canDelete={canDeleteQuestion} canDelete={canDeleteQuestion}

View File

@ -45,19 +45,59 @@ export const useColumns = () => {
}, },
{ {
title: `${t("columns.content")}`, title: `${t("columns.content")}`,
dataIndex: "name", dataIndex: "content",
key: "name", key: "content",
align: "center", align: "center",
render: (text, record) => record?.content, render: (text, record) => record?.content,
ellipsis: true, ellipsis: true,
}, },
{ {
title: t("columns.isBase"), title: `${t("columns.hint")}`,
dataIndex: "hint",
key: "hint",
align: "center",
render: (text, record) => {
return (
<>{record?.hint ?? "_"}</>
);
},
ellipsis: true,
},
{
title: `${t("columns.tags")}`,
dataIndex: "tags",
key: "tags",
align: "center",
render: (text, record) => {
const tags = record?.tags?.map((item:any)=>{
return item?.name
}) ?? [];
return (
<div>
{tags.length > 0 ? (
tags.map((tag, index) => (
<span key={index}>
{tag}
{index < tags.length - 1 && ', '}
</span>
))
) : (
<span>_</span>
)}
</div>
);
},
ellipsis: true,
},
{
title: t("columns.question_type"),
dataIndex: "isBase", dataIndex: "isBase",
key: "isBase", key: "isBase",
align: "center", align: "center",
render: (text, record) => render: (text, record) =>
record?.isBase ? t("practical.yes") : t("practical.no"), record?.isBase ? t("columns.base_question") : t("columns.normal_question"),
}, },
{ {

View File

@ -187,7 +187,12 @@
"subject":"المادة", "subject":"المادة",
"quiz_status":"حالة الاختبار", "quiz_status":"حالة الاختبار",
"creator_name":"اسم المنشئ", "creator_name":"اسم المنشئ",
"created_by":"أنشئ بواسطة" "created_by":"أنشئ بواسطة",
"question_type": "نوع تمرين",
"base_question": " تمرين متعدد ",
"normal_question": " تمرين عادي",
"hint":"شرح ",
"tags":"كلمات مفتاحية"
}, },
"practical": { "practical": {
"to_confirm_deletion_please_re_enter": "لتأكيد الحذف، يرجى إعادة الإدخال", "to_confirm_deletion_please_re_enter": "لتأكيد الحذف، يرجى إعادة الإدخال",