feat: display message if list fields is empty
This commit is contained in:
@@ -545,60 +545,64 @@ export const RightSidePanel: React.FC<RightSidePanelProps> = ({ onFinishCapture
|
|||||||
</Box>
|
</Box>
|
||||||
)}
|
)}
|
||||||
{step.type === 'list' && (
|
{step.type === 'list' && (
|
||||||
<>
|
Object.entries(step.fields).length === 0 ? (
|
||||||
<Typography>{t('right_panel.messages.list_selected')}</Typography>
|
<Typography>{t('right_panel.messages.list_empty')}</Typography>
|
||||||
{Object.entries(step.fields).map(([key, field]) => (
|
) : (
|
||||||
<Box key={key}>
|
<>
|
||||||
<TextField
|
<Typography>{t('right_panel.messages.list_selected')}</Typography>
|
||||||
label={t('right_panel.fields.field_label')}
|
{Object.entries(step.fields).map(([key, field]) => (
|
||||||
value={field.label || ''}
|
<Box key={key}>
|
||||||
onChange={(e) => handleTextLabelChange(field.id, e.target.value, step.id, key)}
|
<TextField
|
||||||
fullWidth
|
label={t('right_panel.fields.field_label')}
|
||||||
margin="normal"
|
value={field.label || ''}
|
||||||
InputProps={{
|
onChange={(e) => handleTextLabelChange(field.id, e.target.value, step.id, key)}
|
||||||
readOnly: confirmedListTextFields[field.id]?.[key],
|
fullWidth
|
||||||
startAdornment: (
|
margin="normal"
|
||||||
<InputAdornment position="start">
|
InputProps={{
|
||||||
<EditIcon />
|
readOnly: confirmedListTextFields[field.id]?.[key],
|
||||||
</InputAdornment>
|
startAdornment: (
|
||||||
)
|
<InputAdornment position="start">
|
||||||
}}
|
<EditIcon />
|
||||||
/>
|
</InputAdornment>
|
||||||
<TextField
|
)
|
||||||
label={t('right_panel.fields.field_data')}
|
}}
|
||||||
value={field.data || ''}
|
/>
|
||||||
fullWidth
|
<TextField
|
||||||
margin="normal"
|
label={t('right_panel.fields.field_data')}
|
||||||
InputProps={{
|
value={field.data || ''}
|
||||||
readOnly: true,
|
fullWidth
|
||||||
startAdornment: (
|
margin="normal"
|
||||||
<InputAdornment position="start">
|
InputProps={{
|
||||||
<TextFieldsIcon />
|
readOnly: true,
|
||||||
</InputAdornment>
|
startAdornment: (
|
||||||
)
|
<InputAdornment position="start">
|
||||||
}}
|
<TextFieldsIcon />
|
||||||
/>
|
</InputAdornment>
|
||||||
{!confirmedListTextFields[step.id]?.[key] && (
|
)
|
||||||
<Box display="flex" justifyContent="space-between" gap={2}>
|
}}
|
||||||
<Button
|
/>
|
||||||
variant="contained"
|
{!confirmedListTextFields[step.id]?.[key] && (
|
||||||
onClick={() => handleListTextFieldConfirm(step.id, key)}
|
<Box display="flex" justifyContent="space-between" gap={2}>
|
||||||
disabled={!field.label?.trim()}
|
<Button
|
||||||
>
|
variant="contained"
|
||||||
{t('right_panel.buttons.confirm')}
|
onClick={() => handleListTextFieldConfirm(step.id, key)}
|
||||||
</Button>
|
disabled={!field.label?.trim()}
|
||||||
<Button
|
>
|
||||||
variant="contained"
|
{t('right_panel.buttons.confirm')}
|
||||||
color="error"
|
</Button>
|
||||||
onClick={() => handleListTextFieldDiscard(step.id, key)}
|
<Button
|
||||||
>
|
variant="contained"
|
||||||
{t('right_panel.buttons.discard')}
|
color="error"
|
||||||
</Button>
|
onClick={() => handleListTextFieldDiscard(step.id, key)}
|
||||||
</Box>
|
>
|
||||||
)}
|
{t('right_panel.buttons.discard')}
|
||||||
</Box>
|
</Button>
|
||||||
))}
|
</Box>
|
||||||
</>
|
)}
|
||||||
|
</Box>
|
||||||
|
))}
|
||||||
|
</>
|
||||||
|
)
|
||||||
)}
|
)}
|
||||||
</Box>
|
</Box>
|
||||||
))}
|
))}
|
||||||
|
|||||||
Reference in New Issue
Block a user