added hcas diagnostic choice
This commit is contained in:
@@ -108,7 +108,7 @@ export function Textfield(props) {
|
||||
// console.log(parentField, showIfHasParentShowValue);
|
||||
// console.log(parentField, formProps, form);
|
||||
|
||||
//console.log("validation props:", validation);
|
||||
console.log("validation props:", validation);
|
||||
|
||||
return (
|
||||
<div className="govuk-form-group">
|
||||
|
||||
@@ -239,6 +239,8 @@ let AboutYou = (props) => {
|
||||
...custom
|
||||
}) => {
|
||||
let { t } = useTranslation();
|
||||
const required = (value) => (value ? undefined : "Required");
|
||||
|
||||
return (
|
||||
<>
|
||||
<div
|
||||
@@ -298,6 +300,7 @@ let AboutYou = (props) => {
|
||||
type="radio"
|
||||
className="govuk-radios__input"
|
||||
value={options[key].split("|")[0]}
|
||||
validate={[required]}
|
||||
// checked={
|
||||
// value ==
|
||||
// parseInt(options[key].split("|")[0])
|
||||
@@ -393,12 +396,12 @@ let AboutYou = (props) => {
|
||||
label={label}
|
||||
options={fieldOptions}
|
||||
id={name}
|
||||
//validate={[required]}
|
||||
validate={[required]}
|
||||
errorMsg="Select an option"
|
||||
component={RenderRadio}
|
||||
inline={props.inline}
|
||||
hint={props.hint}
|
||||
validate={eval(validation)}
|
||||
//validate={eval(validation)}
|
||||
requiredDocumentLabel={props.requiredDocumentLabel}
|
||||
requiredDocumentValue={props.requiredDocumentValue}
|
||||
setDocumentsList={props.setDocumentsList}
|
||||
@@ -412,12 +415,12 @@ let AboutYou = (props) => {
|
||||
label={label}
|
||||
options={fieldOptions}
|
||||
id={name}
|
||||
//validate={[required]}
|
||||
validate={[required]}
|
||||
errorMsg="Select an option"
|
||||
component={RenderRadio}
|
||||
inline={props.inline}
|
||||
hint={props.hint}
|
||||
validate={eval(validation)}
|
||||
//validate={eval(validation)}
|
||||
requiredDocumentLabel={props.requiredDocumentLabel}
|
||||
requiredDocumentValue={props.requiredDocumentValue}
|
||||
setDocumentsList={props.setDocumentsList}
|
||||
@@ -504,7 +507,7 @@ let AboutYou = (props) => {
|
||||
options="[846040000|newappeal:about-you-who-are-you-label-appellant,846040001|newappeal:about-you-who-are-you-label-agent]"
|
||||
id={"pinswg_appellantagent"}
|
||||
className="govuk-radios__input"
|
||||
//validate={[required]}
|
||||
validate={"[required]"}
|
||||
errorMsg="Select an option"
|
||||
/>
|
||||
|
||||
@@ -579,7 +582,7 @@ let AboutYou = (props) => {
|
||||
options="[846040000|newappeal:about-you-agent-contact-preferences-value-email,846040001|newappeal:about-you-agent-contact-preferences-value-post]"
|
||||
id={"pinswg_contactprefs"}
|
||||
className="govuk-radios__input"
|
||||
validate={[required]}
|
||||
validate={"[required]"}
|
||||
errorMsg="Select an option"
|
||||
/>
|
||||
<Radiofield
|
||||
@@ -591,8 +594,8 @@ let AboutYou = (props) => {
|
||||
options="[846040000|newappeal:about-you-agent-language-preferences-value-english,846040001|newappeal:about-you-agent-language-preferences-value-welsh]"
|
||||
id={"pinswg_languagepreference"}
|
||||
className="govuk-radios__input"
|
||||
validate={[required]}
|
||||
errorMsg="Select an option"
|
||||
validate={"[required]"}
|
||||
errorMsg="Select an optionqqq"
|
||||
/>
|
||||
</>
|
||||
)}
|
||||
@@ -749,7 +752,7 @@ let AboutYou = (props) => {
|
||||
id={"pinswg_languagepreference"}
|
||||
className="govuk-radios__input"
|
||||
validate={[required]}
|
||||
errorMsg="Select an option"
|
||||
errorMsg="Select an optionwww"
|
||||
/>
|
||||
</>
|
||||
)}
|
||||
|
||||
@@ -156,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")}
|
||||
@@ -210,7 +210,7 @@ let CreateCase = (props) => {
|
||||
);
|
||||
};
|
||||
|
||||
const RenderYesNo = ({
|
||||
const RenderRadio = ({
|
||||
datafieldname,
|
||||
name,
|
||||
label,
|
||||
@@ -221,6 +221,9 @@ let CreateCase = (props) => {
|
||||
meta: { touched, error },
|
||||
...custom
|
||||
}) => {
|
||||
let { t } = useTranslation();
|
||||
const required = (value) => (value ? undefined : "Required");
|
||||
console.log(custom.hint);
|
||||
return (
|
||||
<>
|
||||
<div
|
||||
@@ -232,14 +235,14 @@ let CreateCase = (props) => {
|
||||
>
|
||||
<fieldset
|
||||
className="govuk-fieldset"
|
||||
aria-describedby={id + "_label"}
|
||||
aria-describedby={datafieldname + "-hint"}
|
||||
>
|
||||
<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}
|
||||
</label>
|
||||
</legend>
|
||||
{touched && error && (
|
||||
@@ -260,10 +263,9 @@ let CreateCase = (props) => {
|
||||
: "govuk-radios govuk-radios--inline govuk-radios--small"
|
||||
}
|
||||
>
|
||||
{custom.hint != false && (
|
||||
<div className="govuk-hint">
|
||||
{t(custom.hint)}
|
||||
</div>
|
||||
{" "}
|
||||
{custom.hint != undefined && (
|
||||
<div className="govuk-hint">{custom.hint}</div>
|
||||
)}
|
||||
{Object.keys(options).map((key, index) => (
|
||||
<div
|
||||
@@ -276,20 +278,22 @@ let CreateCase = (props) => {
|
||||
name={id}
|
||||
component="input"
|
||||
type="radio"
|
||||
hint={custom.hint}
|
||||
className="govuk-radios__input"
|
||||
value={options[key]}
|
||||
//checked={value == options[key]}
|
||||
value={options[key].split("|")[0]}
|
||||
validate={[required]}
|
||||
// checked={
|
||||
// value ==
|
||||
// parseInt(options[key].split("|")[0])
|
||||
// }
|
||||
onChange={(e) => {
|
||||
let docListObj =
|
||||
custom.documentList;
|
||||
if (
|
||||
custom.requiredDocumentValue ==
|
||||
"Yes" ||
|
||||
custom.requiredDocumentValue ==
|
||||
"Ydw"
|
||||
"Yes"
|
||||
) {
|
||||
e.target.value == "Ydw" ||
|
||||
e.target.value == "Yes"
|
||||
e.target.value != "846040000"
|
||||
? (docListObj =
|
||||
Object.assign(
|
||||
docListObj,
|
||||
@@ -303,7 +307,6 @@ let CreateCase = (props) => {
|
||||
"documentCheckList_" +
|
||||
id
|
||||
];
|
||||
console.log(docListObj);
|
||||
custom.setDocumentsList(
|
||||
docListObj
|
||||
);
|
||||
@@ -314,7 +317,7 @@ let CreateCase = (props) => {
|
||||
className="govuk-label govuk-radios__label"
|
||||
htmlFor={id + "_" + index}
|
||||
>
|
||||
{options[key]}
|
||||
{t(options[key].split("|")[1])}
|
||||
</label>
|
||||
</div>
|
||||
))}
|
||||
@@ -324,6 +327,91 @@ let CreateCase = (props) => {
|
||||
</>
|
||||
);
|
||||
};
|
||||
|
||||
function Radiofield(props) {
|
||||
const {
|
||||
name,
|
||||
label,
|
||||
datafieldname,
|
||||
parentField,
|
||||
form,
|
||||
formProps,
|
||||
parentFieldShowOnValue,
|
||||
validation,
|
||||
} = props;
|
||||
|
||||
const router = useRouter();
|
||||
const required = (value) => (value ? undefined : "Required");
|
||||
// console.log(props.options);
|
||||
|
||||
const fieldOptions = props.options
|
||||
.slice(1, props.options.length - 1)
|
||||
.split(",");
|
||||
|
||||
//parentFieldShowOnValue
|
||||
var showIfHasParentShowValue = parentField != false;
|
||||
//debugger;
|
||||
// parentField != false &&
|
||||
// !_.isEmpty(formProps[form]) &&
|
||||
// _.has(formProps[form].values, parentField) &&
|
||||
// parentFieldShowOnValue.indexOf(
|
||||
// formProps[form].values[parentField].toString()
|
||||
// ) > -1;
|
||||
|
||||
(showIfHasParentShowValue == parentField) != false &&
|
||||
showIfHasParentShowValue;
|
||||
|
||||
// console.log(
|
||||
// datafieldname,
|
||||
// showIfHasParentShowValue,
|
||||
// formProps[form].values[parentField]
|
||||
// );
|
||||
|
||||
return (
|
||||
<>
|
||||
{parentField != false ? (
|
||||
showIfHasParentShowValue && (
|
||||
<Field
|
||||
name={name}
|
||||
datafieldname={datafieldname}
|
||||
label={label}
|
||||
options={fieldOptions}
|
||||
id={name}
|
||||
validate={[required]}
|
||||
errorMsg="Select an option"
|
||||
component={RenderRadio}
|
||||
inline={props.inline}
|
||||
hint={props.hint}
|
||||
//validate={eval(validation)}
|
||||
requiredDocumentLabel={props.requiredDocumentLabel}
|
||||
requiredDocumentValue={props.requiredDocumentValue}
|
||||
setDocumentsList={props.setDocumentsList}
|
||||
documentList={props.documentList}
|
||||
/>
|
||||
)
|
||||
) : (
|
||||
<Field
|
||||
name={name}
|
||||
datafieldname={datafieldname}
|
||||
label={label}
|
||||
options={fieldOptions}
|
||||
id={name}
|
||||
validate={[required]}
|
||||
errorMsg="Select an option"
|
||||
component={RenderRadio}
|
||||
inline={props.inline}
|
||||
hint={props.hint}
|
||||
//validate={eval(validation)}
|
||||
requiredDocumentLabel={props.requiredDocumentLabel}
|
||||
requiredDocumentValue={props.requiredDocumentValue}
|
||||
setDocumentsList={props.setDocumentsList}
|
||||
documentList={props.documentList}
|
||||
/>
|
||||
)}
|
||||
</>
|
||||
);
|
||||
}
|
||||
|
||||
const required = (value) => (value ? undefined : "Required");
|
||||
|
||||
const [formStep, setFormStep] = useState(0);
|
||||
@@ -333,13 +421,33 @@ let CreateCase = (props) => {
|
||||
|
||||
var appTypeCollection = values.appealTypes;
|
||||
|
||||
appTypeCollection = getFormCollectionByID(appTypeCollection);
|
||||
|
||||
formStep == 0 && setFormStep(1);
|
||||
|
||||
// console.log(values);
|
||||
whichAppealType =
|
||||
values.appealTypes == "846040004" && values.confirmHASCAS == "true"
|
||||
? "846040004"
|
||||
: values.appealTypes == "846040004" &&
|
||||
values.confirmHASCAS == "false"
|
||||
? "846040000"
|
||||
: values.appealTypes;
|
||||
|
||||
// console.log(props.loggedInUser);
|
||||
var whichAppealType = whichAppealType;
|
||||
|
||||
appTypeCollection = getFormCollectionByID(whichAppealType);
|
||||
|
||||
console.log(
|
||||
"/newappeal" +
|
||||
"/" +
|
||||
appTypeCollection.UrlName +
|
||||
"?lpa=" +
|
||||
values.lpaTypes +
|
||||
"&apt=" +
|
||||
whichAppealType +
|
||||
"&id=" //+
|
||||
// data.incidentid
|
||||
);
|
||||
|
||||
delete values.confirmHASCAS;
|
||||
|
||||
createNewCase(
|
||||
appTypeCollection.appealTypeID,
|
||||
@@ -355,7 +463,7 @@ let CreateCase = (props) => {
|
||||
"?lpa=" +
|
||||
values.lpaTypes +
|
||||
"&apt=" +
|
||||
values.appealTypes.split(",")[0] +
|
||||
whichAppealType +
|
||||
"&id=" +
|
||||
data.incidentid
|
||||
);
|
||||
@@ -364,6 +472,7 @@ let CreateCase = (props) => {
|
||||
.catch(({ err }) => {
|
||||
console.log(err);
|
||||
});
|
||||
|
||||
// router.replace(
|
||||
// "/newappeal" +
|
||||
// "/" +
|
||||
@@ -380,6 +489,22 @@ let CreateCase = (props) => {
|
||||
};
|
||||
const yesNo = router.locale == "cy" ? ["Ydw", "Na"] : ["Yes", "No"];
|
||||
|
||||
var parentField = "appealTypes",
|
||||
formProps = props.whichForm,
|
||||
form = "caseForm",
|
||||
parentFieldShowOnValue = "846040004";
|
||||
|
||||
var showIfHasParentShowValue =
|
||||
parentField != false &&
|
||||
!_.isEmpty(formProps[form]) &&
|
||||
_.has(formProps[form].values, parentField) &&
|
||||
parentFieldShowOnValue.indexOf(
|
||||
formProps[form].values[parentField].toString()
|
||||
) > -1;
|
||||
|
||||
(showIfHasParentShowValue == parentField) != false &&
|
||||
showIfHasParentShowValue;
|
||||
|
||||
return (
|
||||
<>
|
||||
{formStep == 0 ? (
|
||||
@@ -404,28 +529,22 @@ 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}
|
||||
/>
|
||||
|
||||
{showIfHasParentShowValue && (
|
||||
<Radiofield
|
||||
name={"confirmHASCAS"}
|
||||
datafieldname={"confirmHASCAS"}
|
||||
label={"Confirm HAS/CAS appeal is required"}
|
||||
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"
|
||||
}
|
||||
options="[true|Yes,false|No]"
|
||||
id={"confirmHASCAS"}
|
||||
className="govuk-radios__input"
|
||||
validate={"[required]"}
|
||||
errorMsg="Select an option"
|
||||
/>
|
||||
)}
|
||||
<button
|
||||
type="submit"
|
||||
className="govuk-button"
|
||||
|
||||
@@ -117,6 +117,7 @@ const Home = (props) => {
|
||||
LPAData={props.LPAData}
|
||||
appealType={props.setAppealType}
|
||||
loggedInUser={props.accountDetails.loggedinUserId}
|
||||
whichForm={props.form}
|
||||
/>
|
||||
</main>
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user