added changes

This commit is contained in:
2022-06-14 11:39:06 +01:00
parent 8164aed99b
commit b588927e20
2 changed files with 177 additions and 94 deletions
+140 -2
View File
@@ -15,6 +15,7 @@ import { getFormCollectionByID } from "../utils";
import FileUpload from "./fileupload";
import Aboutyou from "./aboutyou";
import { createNewCase } from "../../actions";
import { FieldsTranslations } from "../elements";
let CreateCase = (props) => {
// useEffect(() => {
@@ -26,7 +27,7 @@ let CreateCase = (props) => {
const router = useRouter();
const { locale } = router;
const { LPAData, onSubmit, handleSubmit } = props;
const { LPAData, onSubmit, handleSubmit, formData } = props;
const appealOptionsObj = _.isEmpty(props)
? [{}]
@@ -155,7 +156,7 @@ let CreateCase = (props) => {
className="govuk-select"
id="appealTypes"
name={name}
//onChange={(e) => props.onChangeSelectAppealType(e)}
onChange={(e) => props.onChangeSelectAppealType(e)}
>
<option value="" disabled defaultValue>
{t("common:drop-down-select")}
@@ -209,6 +210,120 @@ let CreateCase = (props) => {
);
};
const RenderYesNo = ({
datafieldname,
name,
label,
id,
errorMsg,
options,
input: { onChange, value },
meta: { touched, error },
...custom
}) => {
return (
<>
<div
className={
touched && error
? "govuk-form-group govuk-form-group--error"
: "govuk-form-group "
}
>
<fieldset
className="govuk-fieldset"
aria-describedby={id + "_label"}
>
<legend className="govuk-fieldset__legend govuk-fieldset__legend--s govuk-!-font-weight-regular">
<label
className="govuk-fieldset__heading govuk-body-m"
id={id + "_label"}
>
{FieldsTranslations(label)}
</label>
</legend>
{touched && error && (
<span
id={id + "-error"}
className="govuk-error-message"
>
<span className="govuk-visually-hidden">
Error:
</span>{" "}
{errorMsg}
</span>
)}
<div
className={
custom.inline == false
? "govuk-radios govuk-radios--small"
: "govuk-radios govuk-radios--inline govuk-radios--small"
}
>
{custom.hint != false && (
<div className="govuk-hint">
{t(custom.hint)}
</div>
)}
{Object.keys(options).map((key, index) => (
<div
className="govuk-radios__item"
data-children-count={key}
key={key}
>
<Field
id={id + "_" + index}
name={id}
component="input"
type="radio"
className="govuk-radios__input"
value={options[key]}
//checked={value == options[key]}
onChange={(e) => {
let docListObj =
custom.documentList;
if (
custom.requiredDocumentValue ==
"Yes" ||
custom.requiredDocumentValue ==
"Ydw"
) {
e.target.value == "Ydw" ||
e.target.value == "Yes"
? (docListObj =
Object.assign(
docListObj,
{
["documentCheckList_" +
id]:
custom.requiredDocumentLabel,
}
))
: delete docListObj[
"documentCheckList_" +
id
];
console.log(docListObj);
custom.setDocumentsList(
docListObj
);
}
}}
/>
<label
className="govuk-label govuk-radios__label"
htmlFor={id + "_" + index}
>
{options[key]}
</label>
</div>
))}
</div>
</fieldset>
</div>
</>
);
};
const required = (value) => (value ? undefined : "Required");
const [formStep, setFormStep] = useState(0);
@@ -263,6 +378,7 @@ let CreateCase = (props) => {
// }
// );
};
const yesNo = router.locale == "cy" ? ["Ydw", "Na"] : ["Yes", "No"];
return (
<>
@@ -288,6 +404,28 @@ let CreateCase = (props) => {
"newappeal:select-appeal-type-label-error-msg"
)}
/>
{}
<Field
name={"confirmHASCAS"}
datafieldname={"confirmHASCAS"}
label={"Confirm HAS/CAS appeal is required"}
options={yesNo}
id={"confirmHASCAS"}
//validate={[required]}
errorMsg="Select an option"
component={RenderYesNo}
inline={true}
hint={
"This appeal route is only applicable if your application relates the refusal of planning permission, orthe refusal of an application to vary or remove a condition attached to a previous permision. All other applications will be submitted via a Section 78 Planning Appeal"
}
validate={[]}
requiredDocumentLabel={props.requiredDocumentLabel}
requiredDocumentValue={props.requiredDocumentValue}
setDocumentsList={props.setDocumentsList}
documentList={props.documentList}
/>
<button
type="submit"
className="govuk-button"
+37 -92
View File
@@ -15,98 +15,11 @@
<row>
<cell id="{2902cb65-78c7-40ff-a618-a5423c8287cb}">
<labels>
<label description="Name" languagecode="1033" />
<label description="Case reference" languagecode="1033" />
</labels>
<control id="pinswg_name" classid="{4273EDBD-AC1D-40d3-9FB2-095C621B552D}" datafieldname="pinswg_name" />
</cell>
</row>
<row>
<cell id="{edb2e54a-40cc-57d6-150d-84cd436965be}" showlabel="true" locklevel="0">
<labels>
<label description="Case" languagecode="1033" />
</labels>
<control id="pinswg_advertsids" classid="{270BD3DB-D9AF-4782-9025-509E298DEC0A}" datafieldname="pinswg_advertsids" disabled="false" uniqueid="{54aaac17-b94d-bba1-82a8-07917d933d4b}">
<parameters>
<AutoResolve>
true
</AutoResolve>
<DisableMru>
false
</DisableMru>
<DisableQuickFind>
false
</DisableQuickFind>
<DisableViewPicker>
false
</DisableViewPicker>
<DefaultViewId>
{9AC51863-58C7-49A0-ADCC-AFD9A4C3EE59}
</DefaultViewId>
<AllowFilterOff>
false
</AllowFilterOff>
</parameters>
</control>
</cell>
</row>
<row>
<cell id="{3b4bd3b6-b352-4438-1da4-86157c44d522}" showlabel="true" locklevel="0">
<labels>
<label description="Associated (LPA)" languagecode="1033" />
</labels>
<control id="pinswg_associatedlpa" classid="{270BD3DB-D9AF-4782-9025-509E298DEC0A}" datafieldname="pinswg_associatedlpa" disabled="false" uniqueid="{8bc2102c-0000-4721-463d-6b6e64cb6009}">
<parameters>
<AutoResolve>
true
</AutoResolve>
<DisableMru>
false
</DisableMru>
<DisableQuickFind>
false
</DisableQuickFind>
<DisableViewPicker>
true
</DisableViewPicker>
<DefaultViewId>
{0ABD7146-7DE5-EB11-AAC5-00224800BE9C}
</DefaultViewId>
<AllowFilterOff>
false
</AllowFilterOff>
</parameters>
</control>
</cell>
</row>
<row>
<cell id="{832ed08a-b53c-553a-29cc-4c45d9d5c8ab}" showlabel="true" locklevel="0">
<labels>
<label description="Appellant" languagecode="1033" />
</labels>
<control id="pinswg_appellant" classid="{270BD3DB-D9AF-4782-9025-509E298DEC0A}" datafieldname="pinswg_appellant" disabled="false" uniqueid="{66d6d8e1-2302-53b8-1e96-3281782ca7e4}">
<parameters>
<AutoResolve>
true
</AutoResolve>
<DisableMru>
false
</DisableMru>
<DisableQuickFind>
false
</DisableQuickFind>
<DisableViewPicker>
true
</DisableViewPicker>
<DefaultViewId>
{EF816E54-E5D5-EB11-AAC5-00224800BE9C}
</DefaultViewId>
<AllowFilterOff>
false
</AllowFilterOff>
</parameters>
</control>
</cell>
</row>
</row>
</rows>
</section>
</sections>
@@ -494,14 +407,46 @@
<label description="Section" languagecode="1033" />
</labels>
<rows>
<row>
<cell id="{a85e23f4-b453-445b-b62c-a33a54cdc831}" showlabel="true" locklevel="0">
<row>
<cell id="{16D63FD6-119B-4353-BDCA-18358721C3FE}" showlabel="true" locklevel="0">
<labels>
<label description="File upload" languagecode="1033" />
<label description="Site plan" languagecode="1033" hint="Site plan (preferably on a copy of an Ordnance Survey map at not less than 10,000 scale) showing the general location of the proposed development and its boundary. This plan should show two named roads so as to assist the location of the appeal site or premises. The application site should be edged or shaded in red and any other adjoining land owned or controlled by the appellant (if any) edged or shaded in blue." />
</labels>
<control id="pinswg_fileUpload" classid="{16D63FD6-119B-4353-BDCA-18358721C3FE}" datafieldname="pinswg_fileUpload" disabled="false" uniqueid="{5a91c72e-ce0a-4589-ad92-6433524fb090}" />
</cell>
</row>
<row>
<cell id="{16D63FD6-119B-4353-BDCA-18358721C3FE}" showlabel="true" locklevel="0">
<labels>
<label description="Plans, drawings and documents submitted to the LPA (and list)" languagecode="1033" />
</labels>
<control id="pinswg_fileUpload2" classid="{16D63FD6-119B-4353-BDCA-18358721C3FE}" datafieldname="pinswg_fileUpload2" disabled="false" uniqueid="{5a91c72e-ce0a-4589-ad92-6433524fb090}" />
</cell>
</row>
<row>
<cell id="{16D63FD6-119B-4353-BDCA-18358721C3FE}" showlabel="true" locklevel="0">
<labels>
<label description="The discontinuance notice" languagecode="1033" />
</labels>
<control id="pinswg_fileUpload3" classid="{16D63FD6-119B-4353-BDCA-18358721C3FE}" datafieldname="pinswg_fileUpload7" disabled="false" uniqueid="{5a91c72e-ce0a-4589-ad92-6433524fb090}" />
</cell>
</row>
<row>
<cell id="{16D63FD6-119B-4353-BDCA-18358721C3FE}" showlabel="true" locklevel="0">
<labels>
<label description="Correspondence with the LPA relating to the application" languagecode="1033" />
</labels>
<control id="pinswg_fileUpload4" classid="{16D63FD6-119B-4353-BDCA-18358721C3FE}" datafieldname="pinswg_fileUpload4" disabled="false" uniqueid="{5a91c72e-ce0a-4589-ad92-6433524fb090}" />
</cell>
</row>
<row>
<cell id="{16D63FD6-119B-4353-BDCA-18358721C3FE}" showlabel="true" locklevel="0">
<labels>
<label description="Any other material you may deem relevant" languagecode="1033" />
</labels>
<control id="pinswg_fileUpload5" classid="{16D63FD6-119B-4353-BDCA-18358721C3FE}" datafieldname="pinswg_fileUpload6" disabled="false" uniqueid="{5a91c72e-ce0a-4589-ad92-6433524fb090}" />
</cell>
</row>
</rows>
</section>
</sections>