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