logic for has or cas
This commit is contained in:
+128
-35
@@ -621,6 +621,7 @@ const RenderYesNo = ({
|
|||||||
|
|
||||||
export function YesNofield(props) {
|
export function YesNofield(props) {
|
||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
|
let { t } = useTranslation();
|
||||||
|
|
||||||
const { name, label, inline, validation } = props;
|
const { name, label, inline, validation } = props;
|
||||||
const yesNo = router.locale == "cy" ? ["Ydw", "Na"] : ["Yes", "No"];
|
const yesNo = router.locale == "cy" ? ["Ydw", "Na"] : ["Yes", "No"];
|
||||||
@@ -773,6 +774,7 @@ export function Radiofield(props) {
|
|||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
const required = (value) => (value ? undefined : "Required");
|
const required = (value) => (value ? undefined : "Required");
|
||||||
// console.log(props.options);
|
// console.log(props.options);
|
||||||
|
let { t } = useTranslation();
|
||||||
|
|
||||||
const fieldOptions = props.options
|
const fieldOptions = props.options
|
||||||
.slice(1, props.options.length - 1)
|
.slice(1, props.options.length - 1)
|
||||||
@@ -996,51 +998,142 @@ export function PickList(props) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export function NumericField(props) {
|
export function NumericField(props) {
|
||||||
const { name, label, validation } = props;
|
const {
|
||||||
|
name,
|
||||||
|
label,
|
||||||
|
validation,
|
||||||
|
form,
|
||||||
|
formProps,
|
||||||
|
parentFieldShowOnValue,
|
||||||
|
parentField,
|
||||||
|
} = props;
|
||||||
const required = (value) => (value ? undefined : "Required");
|
const required = (value) => (value ? undefined : "Required");
|
||||||
|
|
||||||
|
//parentFieldShowOnValue
|
||||||
|
var showIfHasParentShowValue =
|
||||||
|
parentField != false &&
|
||||||
|
!_.isEmpty(formProps[form]) &&
|
||||||
|
_.has(formProps[form].values, parentField) &&
|
||||||
|
parentFieldShowOnValue.indexOf(
|
||||||
|
formProps[form].values[parentField].toString()
|
||||||
|
) > -1;
|
||||||
|
|
||||||
|
(showIfHasParentShowValue == parentField) != false &&
|
||||||
|
showIfHasParentShowValue;
|
||||||
|
|
||||||
|
console.log("parentField:", parentField, showIfHasParentShowValue);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="govuk-form-group">
|
<>
|
||||||
<Field
|
{parentField != false ? (
|
||||||
name={props.name}
|
showIfHasParentShowValue && (
|
||||||
id={props.name}
|
<div className="govuk-form-group">
|
||||||
type="number"
|
<Field
|
||||||
className="govuk-input govuk-input--width-20"
|
name={props.name}
|
||||||
spellCheck="false"
|
id={props.name}
|
||||||
aria-describedby={name}
|
type="number"
|
||||||
pattern="[0-9]*"
|
className="govuk-input govuk-input--width-20"
|
||||||
inputMode="numeric"
|
spellCheck="false"
|
||||||
parse={Number}
|
aria-describedby={name}
|
||||||
validate={eval(validation)}
|
pattern="[0-9]*"
|
||||||
component={RenderTextfield}
|
inputMode="numeric"
|
||||||
label={label}
|
parse={Number}
|
||||||
/>
|
validate={eval(validation)}
|
||||||
</div>
|
component={RenderTextfield}
|
||||||
|
label={label}
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
)
|
||||||
|
) : (
|
||||||
|
<div className="govuk-form-group">
|
||||||
|
<Field
|
||||||
|
name={props.name}
|
||||||
|
id={props.name}
|
||||||
|
type="number"
|
||||||
|
className="govuk-input govuk-input--width-20"
|
||||||
|
spellCheck="false"
|
||||||
|
aria-describedby={name}
|
||||||
|
pattern="[0-9]*"
|
||||||
|
inputMode="numeric"
|
||||||
|
parse={Number}
|
||||||
|
validate={eval(validation)}
|
||||||
|
component={RenderTextfield}
|
||||||
|
label={label}
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
)}
|
||||||
|
</>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
export function DecimalField(props) {
|
export function DecimalField(props) {
|
||||||
const { name, label, validation } = props;
|
const {
|
||||||
|
name,
|
||||||
|
label,
|
||||||
|
validation,
|
||||||
|
form,
|
||||||
|
formProps,
|
||||||
|
parentFieldShowOnValue,
|
||||||
|
parentField,
|
||||||
|
} = props;
|
||||||
const required = (value) => (value ? undefined : "Required");
|
const required = (value) => (value ? undefined : "Required");
|
||||||
|
|
||||||
|
//parentFieldShowOnValue
|
||||||
|
var showIfHasParentShowValue =
|
||||||
|
parentField != false &&
|
||||||
|
!_.isEmpty(formProps[form]) &&
|
||||||
|
_.has(formProps[form].values, parentField) &&
|
||||||
|
parentFieldShowOnValue.indexOf(
|
||||||
|
formProps[form].values[parentField].toString()
|
||||||
|
) > -1;
|
||||||
|
|
||||||
|
(showIfHasParentShowValue == parentField) != false &&
|
||||||
|
showIfHasParentShowValue;
|
||||||
|
|
||||||
|
console.log("parentField:", parentField, showIfHasParentShowValue);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="govuk-form-group">
|
<>
|
||||||
<Field
|
{parentField != false ? (
|
||||||
name={props.name}
|
showIfHasParentShowValue && (
|
||||||
id={props.name}
|
<div className="govuk-form-group">
|
||||||
// component="input"
|
<Field
|
||||||
type="number"
|
name={props.name}
|
||||||
className="govuk-input govuk-input--width-10"
|
id={props.name}
|
||||||
spellCheck="false"
|
// component="input"
|
||||||
aria-describedby={name}
|
type="number"
|
||||||
pattern="[0-9]*"
|
className="govuk-input govuk-input--width-10"
|
||||||
inputMode="numeric"
|
spellCheck="false"
|
||||||
parse={Number}
|
aria-describedby={name}
|
||||||
validate={eval(validation)}
|
pattern="[0-9]*"
|
||||||
component={RenderTextfield}
|
inputMode="numeric"
|
||||||
label={props.label}
|
parse={Number}
|
||||||
/>
|
validate={eval(validation)}
|
||||||
</div>
|
component={RenderTextfield}
|
||||||
|
label={props.label}
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
)
|
||||||
|
) : (
|
||||||
|
<div className="govuk-form-group">
|
||||||
|
<Field
|
||||||
|
name={props.name}
|
||||||
|
id={props.name}
|
||||||
|
// component="input"
|
||||||
|
type="number"
|
||||||
|
className="govuk-input govuk-input--width-10"
|
||||||
|
spellCheck="false"
|
||||||
|
aria-describedby={name}
|
||||||
|
pattern="[0-9]*"
|
||||||
|
inputMode="numeric"
|
||||||
|
parse={Number}
|
||||||
|
validate={eval(validation)}
|
||||||
|
component={RenderTextfield}
|
||||||
|
label={props.label}
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
)}
|
||||||
|
</>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -149,7 +149,11 @@ export default function BuildField(props) {
|
|||||||
<NumericField
|
<NumericField
|
||||||
name={props.datafieldname}
|
name={props.datafieldname}
|
||||||
label={props.label}
|
label={props.label}
|
||||||
|
form={props.props.props.form}
|
||||||
|
formProps={props.props.props.props.form}
|
||||||
validation={props.validation}
|
validation={props.validation}
|
||||||
|
parentField={props.parentField}
|
||||||
|
parentFieldShowOnValue={props.parentFieldShowOnValue}
|
||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
break;
|
break;
|
||||||
@@ -158,7 +162,11 @@ export default function BuildField(props) {
|
|||||||
<DecimalField
|
<DecimalField
|
||||||
name={props.datafieldname}
|
name={props.datafieldname}
|
||||||
label={props.label}
|
label={props.label}
|
||||||
|
form={props.props.props.form}
|
||||||
|
formProps={props.props.props.props.form}
|
||||||
validation={props.validation}
|
validation={props.validation}
|
||||||
|
parentField={props.parentField}
|
||||||
|
parentFieldShowOnValue={props.parentFieldShowOnValue}
|
||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
break;
|
break;
|
||||||
|
|||||||
@@ -448,6 +448,8 @@ let CreateCase = (props) => {
|
|||||||
|
|
||||||
delete values.confirmHASCAS;
|
delete values.confirmHASCAS;
|
||||||
|
|
||||||
|
console.log(appTypeCollection);
|
||||||
|
|
||||||
createNewCase(
|
createNewCase(
|
||||||
appTypeCollection.appealTypeID,
|
appTypeCollection.appealTypeID,
|
||||||
values.lpaTypes,
|
values.lpaTypes,
|
||||||
|
|||||||
@@ -21,30 +21,11 @@
|
|||||||
</cell>
|
</cell>
|
||||||
</row>
|
</row>
|
||||||
<row>
|
<row>
|
||||||
<cell id="{a3018a30-9552-d2a6-5796-78a11a3b1c17}" showlabel="true" locklevel="0">
|
<cell id="{164eb8e5-6562-923d-5d29-824723d3177a}" showlabel="true" locklevel="0">
|
||||||
<labels>
|
<labels>
|
||||||
<label description="Case" languagecode="1033" />
|
<label description="What is this appeal type?" languagecode="1033" />
|
||||||
</labels>
|
</labels>
|
||||||
<control id="pinswg_planningappeals78ids" classid="{270BD3DB-D9AF-4782-9025-509E298DEC0A}" datafieldname="pinswg_planningappeals78ids" disabled="false" uniqueid="{e66b1aa3-59b9-7508-818e-c5289da259d3}">
|
<control id="pinswg_hascas_appealtype" classid="{07FAC785-CD58-4f9f-ABB3-4B7DDC6ED5ED}" datafieldcontent="[846040000|Householder Appeal,846040001|Minor Commercial appeal]" datafieldname="pinswg_hascas_appealtype" disabled="false" uniqueid="{d36097a3-122e-273b-75b4-2230a0917679}" />
|
||||||
</control>
|
|
||||||
</cell>
|
|
||||||
</row>
|
|
||||||
<row>
|
|
||||||
<cell id="{9cdd3935-7db9-8449-0442-80b615089b76}" showlabel="true" locklevel="0">
|
|
||||||
<labels>
|
|
||||||
<label description="Associated (LPA)" languagecode="1033" />
|
|
||||||
</labels>
|
|
||||||
<control id="pinswg_localplanningauthority" classid="{270BD3DB-D9AF-4782-9025-509E298DEC0A}" datafieldname="pinswg_localplanningauthority" disabled="false" uniqueid="{70a200cc-bb9e-6844-4a34-1a602a160655}">
|
|
||||||
</control>
|
|
||||||
</cell>
|
|
||||||
</row>
|
|
||||||
<row>
|
|
||||||
<cell id="{a60c3762-2733-ed52-7323-5b8b2c35673a}" 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="{741912d8-01ae-e9d6-1d7c-cc2aedc47696}">
|
|
||||||
</control>
|
|
||||||
</cell>
|
</cell>
|
||||||
</row>
|
</row>
|
||||||
</rows>
|
</rows>
|
||||||
@@ -312,6 +293,14 @@
|
|||||||
<label description="Section" languagecode="1033" />
|
<label description="Section" languagecode="1033" />
|
||||||
</labels>
|
</labels>
|
||||||
<rows>
|
<rows>
|
||||||
|
<row>
|
||||||
|
<cell id="{736042e8-d03e-e30e-520e-c2226136c43c}" showlabel="true" locklevel="0">
|
||||||
|
<labels>
|
||||||
|
<label description="What is overall the size of the appeal site, as shown on the red line boundary plan? (in hectares)" languagecode="1033" />
|
||||||
|
</labels>
|
||||||
|
<control validation="[required]" id="pinswg_areaofsiteinhectaresdec" parentField="pinswg_hascas_appealtype" parentFieldShowOnValue="846040001" classid="{C3EFE0C3-0EC6-42be-8349-CBD9079DFD8E}" datafieldname="pinswg_areaofsiteinhectaresdec" disabled="false" />
|
||||||
|
</cell>
|
||||||
|
</row>
|
||||||
<row>
|
<row>
|
||||||
<cell id="{977a773c-b96c-8e0a-776e-240024ea1839}" showlabel="true" locklevel="0">
|
<cell id="{977a773c-b96c-8e0a-776e-240024ea1839}" showlabel="true" locklevel="0">
|
||||||
<labels>
|
<labels>
|
||||||
@@ -325,7 +314,7 @@
|
|||||||
<labels>
|
<labels>
|
||||||
<label description="Is flooding an issue?" languagecode="1033" />
|
<label description="Is flooding an issue?" languagecode="1033" />
|
||||||
</labels>
|
</labels>
|
||||||
<control validation="[required]" id="pinswg_isfloodingandissue" classid="{67FAC785-CD58-4f9f-ABB3-4B7DDC6ED5ED}" datafieldname="pinswg_isfloodingandissue" disabled="false" uniqueid="{d36097a3-122e-273b-75b4-2230a0917679}" />
|
<control validation="[required]" id="pinswg_isfloodinganissue" classid="{67FAC785-CD58-4f9f-ABB3-4B7DDC6ED5ED}" datafieldname="pinswg_isfloodinganissue" disabled="false" uniqueid="{d36097a3-122e-273b-75b4-2230a0917679}" />
|
||||||
</cell>
|
</cell>
|
||||||
</row>
|
</row>
|
||||||
<row>
|
<row>
|
||||||
@@ -333,7 +322,7 @@
|
|||||||
<labels>
|
<labels>
|
||||||
<label description="Do the works affect the setting of a Listed Building?" languagecode="1033" />
|
<label description="Do the works affect the setting of a Listed Building?" languagecode="1033" />
|
||||||
</labels>
|
</labels>
|
||||||
<control validation="[required]" id="pinswg_developmentaffectsettingofalisted" classid="{67FAC785-CD58-4f9f-ABB3-4B7DDC6ED5ED}" datafieldname="pinswg_developmentaffectsettingofalisted" disabled="false" uniqueid="{001d4a59-1a09-007c-c0bc-e72b09693863}" />
|
<control validation="[required]" id="pinswg_developmentaffectsettingifalisted" classid="{67FAC785-CD58-4f9f-ABB3-4B7DDC6ED5ED}" datafieldname="pinswg_developmentaffectsettingifalisted" disabled="false" uniqueid="{001d4a59-1a09-007c-c0bc-e72b09693863}" />
|
||||||
</cell>
|
</cell>
|
||||||
</row>
|
</row>
|
||||||
<row>
|
<row>
|
||||||
@@ -488,21 +477,45 @@
|
|||||||
</labels>
|
</labels>
|
||||||
<rows>
|
<rows>
|
||||||
<row>
|
<row>
|
||||||
<cell id="{a85e23f4-b453-445b-b62c-a33a54cdc831}" showlabel="true" locklevel="0">
|
<cell id="{16D63FD6-119B-4353-BDCA-18358721C3FE}" showlabel="true" locklevel="0">
|
||||||
<labels>
|
<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>
|
</labels>
|
||||||
<control id="pinswg_fileUpload" classid="{16D63FD6-119B-4353-BDCA-18358721C3FE}" datafieldname="pinswg_fileUpload" disabled="false" uniqueid="{5a91c72e-ce0a-4589-ad92-6433524fb090}" />
|
<control id="pinswg_fileUpload" classid="{16D63FD6-119B-4353-BDCA-18358721C3FE}" datafieldname="pinswg_fileUpload" disabled="false" uniqueid="{5a91c72e-ce0a-4589-ad92-6433524fb090}" />
|
||||||
</cell>
|
</cell>
|
||||||
</row>
|
</row>
|
||||||
<row>
|
<row>
|
||||||
<cell id="{a85e23f4-b453-445b-b62c-a33a54cdc831}" showlabel="true" locklevel="0">
|
<cell id="{16D63FD6-119B-4353-BDCA-18358721C3FE}" showlabel="true" locklevel="0">
|
||||||
<labels>
|
<labels>
|
||||||
<label description="File upload2" languagecode="1033" />
|
<label description="Plans, drawings and documents submitted to the LPA (and list)" languagecode="1033" />
|
||||||
</labels>
|
</labels>
|
||||||
<control id="pinswg_fileUpload2" classid="{16D63FD6-119B-4353-BDCA-18358721C3FE}" datafieldname="pinswg_fileUpload2" disabled="false" uniqueid="{5a91c72e-ce0a-4589-ad92-6433524fb090}" />
|
<control id="pinswg_fileUpload2" classid="{16D63FD6-119B-4353-BDCA-18358721C3FE}" datafieldname="pinswg_fileUpload2" disabled="false" uniqueid="{5a91c72e-ce0a-4589-ad92-6433524fb090}" />
|
||||||
</cell>
|
</cell>
|
||||||
</row>
|
</row>
|
||||||
|
<row>
|
||||||
|
<cell id="{16D63FD6-119B-4353-BDCA-18358721C3FE}" showlabel="true" locklevel="0">
|
||||||
|
<labels>
|
||||||
|
<label description="Design and Access Statement (if relevant)" languagecode="1033" />
|
||||||
|
</labels>
|
||||||
|
<control id="pinswg_fileUpload3" classid="{16D63FD6-119B-4353-BDCA-18358721C3FE}" datafieldname="pinswg_fileUpload3" 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_fileUpload6" classid="{16D63FD6-119B-4353-BDCA-18358721C3FE}" datafieldname="pinswg_fileUpload6" disabled="false" uniqueid="{5a91c72e-ce0a-4589-ad92-6433524fb090}" />
|
||||||
|
</cell>
|
||||||
|
</row>
|
||||||
</rows>
|
</rows>
|
||||||
</section>
|
</section>
|
||||||
</sections>
|
</sections>
|
||||||
|
|||||||
@@ -19,7 +19,15 @@ const ApiResponse = (req, res) => {
|
|||||||
"attributevalue": 846040025,
|
"attributevalue": 846040025,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"value": "Householder and Minor Commercial Appeals - HAS/CAS",
|
"value": "Householder Appeals - HAS",
|
||||||
|
"stringmapid": "585d46a7-9138-ec11-aacb-00224800be9c",
|
||||||
|
"organizationid": "01191a4d-105f-eb11-aaba-00224800be9c",
|
||||||
|
"attributevalue@OData.Community.Display.V1.FormattedValue":
|
||||||
|
"846,040,004",
|
||||||
|
"attributevalue": 846040004,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"value": "Minor Commercial Appeals - CAS",
|
||||||
"stringmapid": "585d46a7-9138-ec11-aacb-00224800be9c",
|
"stringmapid": "585d46a7-9138-ec11-aacb-00224800be9c",
|
||||||
"organizationid": "01191a4d-105f-eb11-aaba-00224800be9c",
|
"organizationid": "01191a4d-105f-eb11-aaba-00224800be9c",
|
||||||
"attributevalue@OData.Community.Display.V1.FormattedValue":
|
"attributevalue@OData.Community.Display.V1.FormattedValue":
|
||||||
|
|||||||
Reference in New Issue
Block a user