Skip to content

Commit 365970f

Browse files
committed
fix update issue when we switch hvdc-lcc in the ID combobox
Signed-off-by: David BRAQUART <david.braquart@rte-france.com>
1 parent 35482af commit 365970f

2 files changed

Lines changed: 35 additions & 48 deletions

File tree

src/components/dialogs/network-modifications/equipment-deletion/hvdc-lcc-deletion/hvdc-lcc-deletion-specific-form.tsx

Lines changed: 35 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,22 @@
88
import { Grid } from '@mui/material';
99
import {
1010
DELETION_SPECIFIC_DATA,
11+
SHUNT_COMPENSATOR_SELECTED,
1112
SHUNT_COMPENSATOR_SIDE_1,
1213
SHUNT_COMPENSATOR_SIDE_2,
1314
} from 'components/utils/field-constants';
1415
import { useFieldArray } from 'react-hook-form';
1516
import GridSection from '../../../commons/grid-section';
1617
import GridItem from '../../../commons/grid-item';
17-
import ShuntCompensatorSelectionForm from './shunt-compensator-selection-form';
18+
import { CheckboxInput, ID } from '@gridsuite/commons-ui';
19+
import ReadOnlyInput from '../../../../utils/rhf-inputs/read-only/read-only-input';
20+
import { FormattedMessage } from 'react-intl';
21+
22+
interface ShuntCompensatorSelectionFormProps {
23+
title: string;
24+
arrayFormName: string;
25+
mcsRows: Record<'id', string>[];
26+
}
1827

1928
export default function HvdcLccDeletionSpecificForm() {
2029
const { fields: mcsRows1 } = useFieldArray({
@@ -24,6 +33,31 @@ export default function HvdcLccDeletionSpecificForm() {
2433
name: `${DELETION_SPECIFIC_DATA}.${SHUNT_COMPENSATOR_SIDE_2}`,
2534
});
2635

36+
const ShuntCompensatorSelectionForm = ({ title, arrayFormName, mcsRows }: ShuntCompensatorSelectionFormProps) => {
37+
return (
38+
<Grid item container spacing={1} direction="column">
39+
<Grid item>
40+
<h4>
41+
<FormattedMessage id={title} />
42+
</h4>
43+
</Grid>
44+
{mcsRows.map((field, index) => (
45+
<Grid container spacing={1} alignItems="center" key={field.id}>
46+
<Grid item xs={1} alignItems={'start'}>
47+
<CheckboxInput
48+
key={field.id + 'SEL'}
49+
name={`${arrayFormName}[${index}].${SHUNT_COMPENSATOR_SELECTED}`}
50+
/>
51+
</Grid>
52+
<Grid item xs={11} alignItems={'start'}>
53+
<ReadOnlyInput key={field.id + 'ID'} name={`${arrayFormName}[${index}].${ID}`} />
54+
</Grid>
55+
</Grid>
56+
))}
57+
</Grid>
58+
);
59+
};
60+
2761
const mcsOnsideOne = (
2862
<ShuntCompensatorSelectionForm
2963
title="Side1"

src/components/dialogs/network-modifications/equipment-deletion/hvdc-lcc-deletion/shunt-compensator-selection-form.tsx

Lines changed: 0 additions & 47 deletions
This file was deleted.

0 commit comments

Comments
 (0)