Skip to content

Commit

Permalink
Merge branch 'KelvinTegelaar:main' into main
Browse files Browse the repository at this point in the history
  • Loading branch information
markheydon authored Jan 17, 2025
2 parents 2cd089a + 0520849 commit eddb95d
Show file tree
Hide file tree
Showing 13 changed files with 1,271 additions and 168 deletions.
2 changes: 1 addition & 1 deletion public/version.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
{
"version": "7.0.4"
"version": "7.0.5"
}
27 changes: 27 additions & 0 deletions src/components/CippComponents/CippFormComponent.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -225,6 +225,33 @@ export const CippFormComponent = (props) => {
</>
);

case "select":
return (
<>
<div>
<Controller
name={convertedName}
control={formControl.control}
rules={validators}
render={({ field }) => (
<CippAutoComplete
{...other}
isFetching={other.isFetching}
variant="filled"
defaultValue={field.value}
label={label}
multiple={false}
onChange={(value) => field.onChange(value.value)}
/>
)}
/>
</div>
<Typography variant="subtitle3" color="error">
{get(errors, convertedName, {}).message}
</Typography>
</>
);

case "autoComplete":
return (
<>
Expand Down
1 change: 1 addition & 0 deletions src/components/CippWizard/CippWizardOffboarding.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -300,6 +300,7 @@ export const CippWizardOffboarding = (props) => {
onPreviousStep={onPreviousStep}
onNextStep={onNextStep}
formControl={formControl}
replacementBehaviour="removeNulls"
/>
</Stack>
);
Expand Down
12 changes: 11 additions & 1 deletion src/components/CippWizard/CippWizardStepButtons.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,24 @@ export const CippWizardStepButtons = (props) => {
formControl,
noNextButton = false,
noSubmitButton = false,
replacementBehaviour,
queryKeys,
...other
} = props;
const { isValid, isSubmitted, isSubmitting } = useFormState({ control: formControl.control });
const sendForm = ApiPostCall({ relatedQueryKeys: queryKeys });
const handleSubmit = () => {
const values = formControl.getValues();
sendForm.mutate({ url: postUrl, data: values });
const newData = {};
Object.keys(values).forEach((key) => {
const value = values[key];
if (replacementBehaviour !== "removeNulls") {
newData[key] = value;
} else if (row[value] !== undefined) {
newData[key] = row[value];
}
});
sendForm.mutate({ url: postUrl, data: newData });
};

return (
Expand Down
Loading

0 comments on commit eddb95d

Please sign in to comment.