diff --git a/editor.planx.uk/src/pages/FlowEditor/components/Settings/GeneralSettings/ContactForm.tsx b/editor.planx.uk/src/pages/FlowEditor/components/Settings/GeneralSettings/ContactForm.tsx index 83d2438261..23527446a7 100644 --- a/editor.planx.uk/src/pages/FlowEditor/components/Settings/GeneralSettings/ContactForm.tsx +++ b/editor.planx.uk/src/pages/FlowEditor/components/Settings/GeneralSettings/ContactForm.tsx @@ -62,7 +62,7 @@ export default function ContactForm({ formikConfig, onSuccess }: FormProps) { onChange={(event) => { onChangeFn("homepage", event); }} - value={formik.values.homepage} + value={formik.values.homepage ?? ""} errorMessage={formik.errors.homepage} id="homepage" /> @@ -91,7 +91,6 @@ export default function ContactForm({ formikConfig, onSuccess }: FormProps) { { + const isSuccess = await useStore.getState().updateTeamSettings({ + referenceCode: values.referenceCode, + }); + if (isSuccess) { + onSuccess(); + resetForm({ values }); + } + }, + }); + + const onChangeFn = (type: string, event: ChangeEvent) => + formik.setFieldValue(type, event.target.value.toUpperCase()); + + return ( + + + Your local authority reference code is required for submissions. + This is a unique three-letter code per local authority. + + + The reference code can be found from Planning Data at:{" "} + + https://www.planning.data.gov.uk/entity/?dataset=local-authority + + + + } + input={ + <> + + { + onChangeFn("referenceCode", event); + }} + value={formik.values.referenceCode ?? ""} + errorMessage={formik.errors.referenceCode} + id="homepage" + /> + + + } + /> + ); +} diff --git a/editor.planx.uk/src/pages/FlowEditor/components/Settings/GeneralSettings/index.tsx b/editor.planx.uk/src/pages/FlowEditor/components/Settings/GeneralSettings/index.tsx index 71ec6eeca2..1352092514 100644 --- a/editor.planx.uk/src/pages/FlowEditor/components/Settings/GeneralSettings/index.tsx +++ b/editor.planx.uk/src/pages/FlowEditor/components/Settings/GeneralSettings/index.tsx @@ -10,6 +10,7 @@ import SettingsSection from "ui/editor/SettingsSection"; import BoundaryForm from "./BoundaryForm"; import ContactForm from "./ContactForm"; +import ReferenceCodeForm from "./ReferenceCodeForm"; export interface FormProps { formikConfig: FormikConfig; @@ -62,7 +63,7 @@ const GeneralSettings: React.FC = () => { - General + Settings Important links and settings for how your users connect with you. @@ -72,6 +73,10 @@ const GeneralSettings: React.FC = () => { <> + )}