repair: error code brand-device

This commit is contained in:
2025-12-12 16:54:52 +07:00
parent ea3adf40cc
commit fb790e5e37

View File

@@ -15,8 +15,8 @@ const ErrorCodeForm = ({
onErrorCodeIconRemove, onErrorCodeIconRemove,
isEdit = false, isEdit = false,
}) => { }) => {
const [statusValue, setStatusValue] = useState(true);
const [currentIcon, setCurrentIcon] = useState(null); const [currentIcon, setCurrentIcon] = useState(null);
const statusWatch = Form.useWatch('status', errorCodeForm) ?? true;
useEffect(() => { useEffect(() => {
if (errorCodeIcon && typeof errorCodeIcon === 'object' && Object.keys(errorCodeIcon).length > 0) { if (errorCodeIcon && typeof errorCodeIcon === 'object' && Object.keys(errorCodeIcon).length > 0) {
@@ -207,14 +207,13 @@ const ErrorCodeForm = ({
valuePropName="checked" valuePropName="checked"
> >
<div style={{ display: 'flex', alignItems: 'center' }}> <div style={{ display: 'flex', alignItems: 'center' }}>
<Form.Item name="status" valuePropName="checked" noStyle>
<Switch <Switch
defaultChecked={true} disabled={isErrorCodeFormReadOnly}
onChange={(checked) => {
setStatusValue(checked);
}}
/> />
</Form.Item>
<Text style={{ marginLeft: 8 }}> <Text style={{ marginLeft: 8 }}>
{statusValue ? 'Active' : 'Inactive'} {statusWatch ? 'Active' : 'Inactive'}
</Text> </Text>
</div> </div>
</Form.Item> </Form.Item>