Skip to content

Commit 45b5a39

Browse files
authored
Merge pull request #43 from KelvinTegelaar/main
[pull] main from KelvinTegelaar:main
2 parents 0343124 + 0520849 commit 45b5a39

File tree

13 files changed

+1271
-168
lines changed

13 files changed

+1271
-168
lines changed

public/version.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
{
2-
"version": "7.0.4"
2+
"version": "7.0.5"
33
}

src/components/CippComponents/CippFormComponent.jsx

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -225,6 +225,33 @@ export const CippFormComponent = (props) => {
225225
</>
226226
);
227227

228+
case "select":
229+
return (
230+
<>
231+
<div>
232+
<Controller
233+
name={convertedName}
234+
control={formControl.control}
235+
rules={validators}
236+
render={({ field }) => (
237+
<CippAutoComplete
238+
{...other}
239+
isFetching={other.isFetching}
240+
variant="filled"
241+
defaultValue={field.value}
242+
label={label}
243+
multiple={false}
244+
onChange={(value) => field.onChange(value.value)}
245+
/>
246+
)}
247+
/>
248+
</div>
249+
<Typography variant="subtitle3" color="error">
250+
{get(errors, convertedName, {}).message}
251+
</Typography>
252+
</>
253+
);
254+
228255
case "autoComplete":
229256
return (
230257
<>

src/components/CippWizard/CippWizardOffboarding.jsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -300,6 +300,7 @@ export const CippWizardOffboarding = (props) => {
300300
onPreviousStep={onPreviousStep}
301301
onNextStep={onNextStep}
302302
formControl={formControl}
303+
replacementBehaviour="removeNulls"
303304
/>
304305
</Stack>
305306
);

src/components/CippWizard/CippWizardStepButtons.jsx

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,14 +13,24 @@ export const CippWizardStepButtons = (props) => {
1313
formControl,
1414
noNextButton = false,
1515
noSubmitButton = false,
16+
replacementBehaviour,
1617
queryKeys,
1718
...other
1819
} = props;
1920
const { isValid, isSubmitted, isSubmitting } = useFormState({ control: formControl.control });
2021
const sendForm = ApiPostCall({ relatedQueryKeys: queryKeys });
2122
const handleSubmit = () => {
2223
const values = formControl.getValues();
23-
sendForm.mutate({ url: postUrl, data: values });
24+
const newData = {};
25+
Object.keys(values).forEach((key) => {
26+
const value = values[key];
27+
if (replacementBehaviour !== "removeNulls") {
28+
newData[key] = value;
29+
} else if (row[value] !== undefined) {
30+
newData[key] = row[value];
31+
}
32+
});
33+
sendForm.mutate({ url: postUrl, data: newData });
2434
};
2535

2636
return (

0 commit comments

Comments
 (0)