fix is_active error code ft vinix

This commit is contained in:
2025-10-30 15:15:26 +07:00
parent 114ef96de8
commit 4544e33d01
4 changed files with 26 additions and 36 deletions

View File

@@ -20,6 +20,8 @@ const SolutionField = ({
onFileView,
errorCodeForm,
}) => {
// Watch the solution status from the form
const watchedStatus = Form.useWatch(`solution_status_${fieldId}`, errorCodeForm);
useEffect(() => {
if (currentSolutionData && errorCodeForm) {
if (currentSolutionData.solution_name) {
@@ -146,34 +148,22 @@ const SolutionField = ({
</Form.Item>
<Form.Item label="Status">
<Form.Item
shouldUpdate={(prevValues, currentValues) =>
prevValues[`solution_status_${fieldId}`] !==
currentValues[`solution_status_${fieldId}`]
}
noStyle
>
{({ getFieldValue, setFieldValue }) => {
const currentStatus = getFieldValue(`solution_status_${fieldId}`);
return (
<div style={{ display: 'flex', alignItems: 'center' }}>
<Switch
checked={currentStatus === true}
onChange={(checked) => {
setFieldValue(`solution_status_${fieldId}`, checked);
}}
disabled={isReadOnly}
style={{
backgroundColor: solutionStatus ? '#23A55A' : '#bfbfbf',
}}
/>
<Text style={{ marginLeft: 8 }}>
{currentStatus === true ? 'Active' : 'Non Active'}
</Text>
</div>
);
}}
</Form.Item>
<div style={{ display: 'flex', alignItems: 'center' }}>
<Form.Item name={`solution_status_${fieldId}`} valuePropName="checked" noStyle>
<Switch
disabled={isReadOnly}
onChange={(checked) => {
onSolutionStatusChange(fieldId, checked);
}}
style={{
backgroundColor: (watchedStatus ?? true) ? '#23A55A' : '#bfbfbf',
}}
/>
</Form.Item>
<Text style={{ marginLeft: 8 }}>
{(watchedStatus ?? true) ? 'Active' : 'Non Active'}
</Text>
</div>
</Form.Item>
<Form.Item label="Solution Type">