feat: conditionally display status field in add mode for DetailContact component

This commit is contained in:
2025-12-02 15:39:20 +07:00
parent edf20050db
commit c82d6d39c1

View File

@@ -205,16 +205,23 @@ const DetailContact = memo(function DetailContact(props) {
]} ]}
> >
<div style={{ padding: '8px 0' }}> <div style={{ padding: '8px 0' }}>
{/* Status field only show in add mode*/}
{props.actionMode === 'add' && (
<>
<div> <div>
<div> <div>
<Text strong>Status</Text> <Text strong>Status</Text>
</div> </div>
<div style={{ display: 'flex', alignItems: 'center', marginTop: '8px' }}> <div
style={{ display: 'flex', alignItems: 'center', marginTop: '8px' }}
>
<div style={{ marginRight: '8px' }}> <div style={{ marginRight: '8px' }}>
<Switch <Switch
disabled={props.readOnly} disabled={props.readOnly}
style={{ style={{
backgroundColor: formData.is_active ? '#23A55A' : '#bfbfbf', backgroundColor: formData.is_active
? '#23A55A'
: '#bfbfbf',
}} }}
checked={formData.is_active} checked={formData.is_active}
onChange={handleStatusToggle} onChange={handleStatusToggle}
@@ -226,6 +233,8 @@ const DetailContact = memo(function DetailContact(props) {
</div> </div>
</div> </div>
<Divider style={{ margin: '12px 0' }} /> <Divider style={{ margin: '12px 0' }} />
</>
)}
<div style={{ marginBottom: 12 }}> <div style={{ marginBottom: 12 }}>
<Text strong>Name</Text> <Text strong>Name</Text>