| | |
| | | } from 'react-admin'; |
| | | import PanelTypography from "../components/PanelTypography"; |
| | | import * as Common from '@/utils/common' |
| | | import { describeCronExpression } from "./cronUtils"; |
| | | import { DEFAULT_SCOPE_TYPE, getScopeLabel } from "./guaranteeConstants"; |
| | | |
| | | const GuaranteePanel = () => { |
| | | const record = useRecordContext(); |
| | | if (!record) return null; |
| | | const translate = useTranslate(); |
| | | const scopeTypeLabel = getScopeLabel(record.scopeType, translate); |
| | | const scopeValueLabel = record.scopeValue |
| | | ? record.scopeValue |
| | | : record.scopeType === DEFAULT_SCOPE_TYPE |
| | | ? translate('page.guarantee.scope.globalHelper') |
| | | : translate('common.enums.na'); |
| | | const cronDesc = record.cronExpr |
| | | ? `${describeCronExpression(record.cronExpr, translate)} (${record.cronExpr})` |
| | | : translate('common.enums.na'); |
| | | |
| | | return ( |
| | | <> |
| | | <Card sx={{ width: { xs: 300, sm: 500, md: 600, lg: 800 }, margin: 'auto' }}> |
| | |
| | | <Grid item xs={6}> |
| | | <PanelTypography |
| | | title="table.field.guarantee.scopeType" |
| | | property={record.scopeType} |
| | | property={scopeTypeLabel} |
| | | /> |
| | | </Grid> |
| | | <Grid item xs={6}> |
| | | <PanelTypography |
| | | title="table.field.guarantee.scopeValue" |
| | | property={record.scopeValue} |
| | | property={scopeValueLabel} |
| | | /> |
| | | </Grid> |
| | | <Grid item xs={6}> |
| | | <PanelTypography |
| | | title="table.field.guarantee.cronExpr" |
| | | property={record.cronExpr} |
| | | property={cronDesc} |
| | | /> |
| | | </Grid> |
| | | <Grid item xs={6}> |