Merged PR 2240: refactor(newappeal): simplify nested prop boundaries (Slice 7)

refactor(newappeal): simplify nested prop boundaries (Slice 7)

Related work items: #22588
This commit is contained in:
Robert Bond
2026-04-13 12:25:45 +00:00
parent 783786b9eb
commit ffcccf8981
7 changed files with 98 additions and 80 deletions
+45 -43
View File
@@ -27,6 +27,9 @@ import {
let BuildCheckRow = (props) => {
let { t } = useTranslation();
const legacyProps = props.props;
const legacyFormState = legacyProps.form;
const legacyFormData = legacyProps.formData;
const router = useRouter();
const { locale } = router;
@@ -140,7 +143,7 @@ let BuildCheckRow = (props) => {
// ) {
const fieldTypeValue = fieldtype[0].value;
const fieldValue =
props.props.form["appealForm"].values[
legacyFormState["appealForm"].values[
datafieldname[0].value
];
@@ -190,7 +193,8 @@ let BuildCheckRow = (props) => {
{getDocumentTypeFromFilename(
blob.name
) ===
documentTypeCode[0].value && (
documentTypeCode[0]
.value && (
<div
style={{
display: "flex",
@@ -230,44 +234,42 @@ let BuildCheckRow = (props) => {
);
const renderTenantValue = () =>
typeof fieldValue != "undefined" && fieldValue != null ? (
fieldValue.map((tenant, index) => {
console.log(
typeof tenant.pinswg_owners_firstname
);
return typeof tenant.pinswg_owners_firstname !=
"undefined" ||
typeof tenant.pinswg_agriculturaltenantname_firstname !=
"undefined" ? (
<div
key={index}
style={{
display: "flex"
}}
>
<div className="govuk-!-width-one-half">
{tenant?.pinswg_agriculturaltenantname_firstname &&
tenant.pinswg_agriculturaltenantname_firstname +
" " +
tenant.pinswg_agriculturaltenantname_lastname}
typeof fieldValue != "undefined" && fieldValue != null
? fieldValue.map((tenant, index) => {
console.log(
typeof tenant.pinswg_owners_firstname
);
return typeof tenant.pinswg_owners_firstname !=
"undefined" ||
typeof tenant.pinswg_agriculturaltenantname_firstname !=
"undefined" ? (
<div
key={index}
style={{
display: "flex"
}}
>
<div className="govuk-!-width-one-half">
{tenant?.pinswg_agriculturaltenantname_firstname &&
tenant.pinswg_agriculturaltenantname_firstname +
" " +
tenant.pinswg_agriculturaltenantname_lastname}
{tenant?.pinswg_owners_firstname &&
tenant.pinswg_owners_firstname +
" " +
tenant.pinswg_owners_lastname}
</div>
<div className="govuk-!-width-one-half">
Served:{" "}
{formatDate(tenant.dateserved)}
</div>
</div>
) : (
""
);
})
) : (
"N/A"
);
{tenant?.pinswg_owners_firstname &&
tenant.pinswg_owners_firstname +
" " +
tenant.pinswg_owners_lastname}
</div>
<div className="govuk-!-width-one-half">
Served:{" "}
{formatDate(tenant.dateserved)}
</div>
</div>
) : (
""
);
})
: "N/A";
const formatterMap = {
"{E0DECE4B-6666-4a8f-A065-082708572369}": () => (
@@ -281,13 +283,13 @@ let BuildCheckRow = (props) => {
formatDate(fieldValue),
"{3EF39988-22BB-4f0b-BBBE-64B5A3748AEE}": () =>
getPickListLabel(
props.props.formData.pickListData,
legacyFormData.pickListData,
datafieldname[0].value,
fieldValue
),
"{07FAC785-CD58-4f9f-ABB3-4B7DDC6ED5ED}": () =>
getRadioLabel(
props.props.formData.pickListData,
legacyFormData.pickListData,
datafieldname[0].value,
fieldValue
),
@@ -297,8 +299,8 @@ let BuildCheckRow = (props) => {
? "Nac ydw"
: "No"
: router.locale == "cy"
? "Oes"
: "Yes",
? "Oes"
: "Yes",
"{16D63FD6-119B-4353-BDCA-18358721C3FE}":
renderFileUploadValue,
"{0273EDBD-AC1D-40d3-9FB2-095C621B552D}":