+ const fieldTypeValue = fieldtype[0].value;
+ const fieldValue =
+ props.props.form["appealForm"].values[
+ datafieldname[0].value
+ ];
-
- {fieldtype[0].value ==
- "{E0DECE4B-6666-4a8f-A065-082708572369}" ? (
-
- ) : fieldtype[0].value ==
- "{5B773807-9FB2-42db-97C3-7A91EFF8ADFF}" ? (
- formatDate(
- props.props.form["appealForm"].values[
- datafieldname[0].value
- ]
- )
- ) : fieldtype[0].value ==
- "{3EF39988-22BB-4f0b-BBBE-64B5A3748AEE}" ? (
- getPickListLabel(
- props.props.formData.pickListData,
- datafieldname[0].value,
- props.props.form["appealForm"].values[
- datafieldname[0].value
- ]
- )
- ) : fieldtype[0].value ==
- "{07FAC785-CD58-4f9f-ABB3-4B7DDC6ED5ED}" ? (
- getRadioLabel(
- props.props.formData.pickListData,
- datafieldname[0].value,
- props.props.form["appealForm"].values[
- datafieldname[0].value
- ]
- )
- ) : fieldtype[0].value ==
- "{67FAC785-CD58-4f9f-ABB3-4B7DDC6ED5ED}" ? (
- props.props.form["appealForm"].values[
- datafieldname[0].value
- ] == "false" ? (
- router.locale == "cy" ? (
- "Nac ydw"
- ) : (
- "No"
- )
- ) : router.locale == "cy" ? (
- "Oes"
- ) : (
- "Yes"
- )
- ) : fieldtype[0].value ==
- "{16D63FD6-119B-4353-BDCA-18358721C3FE}" ? (
- <>
- {props.filesArray.map((blob, i) => (
+ const renderFileUploadValue = () => (
+ <>
+ {props.filesArray.map((blob, i) => (
+
+ {getDocumentTypeFromFilename(blob.name) ===
+ documentTypeCode[0].value && (
+
+

+
+ {blob.name} -{" "}
+ {bytesToSize(blob.size)}{" "}
+
+
+ )}
+
+ ))}
+
+ {typeof fieldValue != "undefined" &&
+ fieldValue.map(
+ (blob, i) =>
+ isObjectAndNotEmpty(blob) && (
{getDocumentTypeFromFilename(
blob.name
) ===
- documentTypeCode[0]
- .value && (
+ documentTypeCode[0].value && (
{
)}
- ))}
-
- {typeof props.props.form["appealForm"]
- .values[datafieldname[0].value] !=
- "undefined" &&
- props.props.form[
- "appealForm"
- ].values[
- datafieldname[0].value
- ].map(
- (blob, i) =>
- isObjectAndNotEmpty(
- blob
- ) && (
-
- {getDocumentTypeFromFilename(
- blob.name
- ) ===
- documentTypeCode[0]
- .value && (
-
-

-
- {
- blob.name
- }{" "}
- -{" "}
- {bytesToSize(
- blob.size
- )}{" "}
-
-
- )}
-
- )
- )}
- >
- ) : fieldtype[0].value ==
- "{0273EDBD-AC1D-40d3-9FB2-095C621B552D}" ? (
- typeof props.props.form["appealForm"]
- .values[datafieldname[0].value] !=
- "undefined" &&
- props.props.form["appealForm"].values[
- datafieldname[0].value
- ] != null ? (
- props.props.form["appealForm"].values[
- datafieldname[0].value
- ].map((tenant, index) => {
- console.log(
- typeof tenant.pinswg_owners_firstname
- );
- return typeof tenant.pinswg_owners_firstname !=
- "undefined" ||
- typeof tenant.pinswg_agriculturaltenantname_firstname !=
- "undefined" ? (
-
-
- {tenant?.pinswg_agriculturaltenantname_firstname &&
- tenant.pinswg_agriculturaltenantname_firstname +
- " " +
- tenant.pinswg_agriculturaltenantname_lastname}
-
- {tenant?.pinswg_owners_firstname &&
- tenant.pinswg_owners_firstname +
- " " +
- tenant.pinswg_owners_lastname}
-
-
- Served:{" "}
- {formatDate(
- tenant.dateserved
- )}
-
-
- ) : (
- ""
- );
- })
- ) : (
- "N/A"
- )
- ) : (
- props.props.form["appealForm"].values[
- datafieldname[0].value
- ]
+ )
)}
+ >
+ );
+
+ 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" ? (
+
+
+ {tenant?.pinswg_agriculturaltenantname_firstname &&
+ tenant.pinswg_agriculturaltenantname_firstname +
+ " " +
+ tenant.pinswg_agriculturaltenantname_lastname}
+
+ {tenant?.pinswg_owners_firstname &&
+ tenant.pinswg_owners_firstname +
+ " " +
+ tenant.pinswg_owners_lastname}
+
+
+ Served:{" "}
+ {formatDate(tenant.dateserved)}
+
+
+ ) : (
+ ""
+ );
+ })
+ ) : (
+ "N/A"
+ );
+
+ const formatterMap = {
+ "{E0DECE4B-6666-4a8f-A065-082708572369}": () => (
+
+ ),
+ "{5B773807-9FB2-42db-97C3-7A91EFF8ADFF}": () =>
+ formatDate(fieldValue),
+ "{3EF39988-22BB-4f0b-BBBE-64B5A3748AEE}": () =>
+ getPickListLabel(
+ props.props.formData.pickListData,
+ datafieldname[0].value,
+ fieldValue
+ ),
+ "{07FAC785-CD58-4f9f-ABB3-4B7DDC6ED5ED}": () =>
+ getRadioLabel(
+ props.props.formData.pickListData,
+ datafieldname[0].value,
+ fieldValue
+ ),
+ "{67FAC785-CD58-4f9f-ABB3-4B7DDC6ED5ED}": () =>
+ fieldValue == "false"
+ ? router.locale == "cy"
+ ? "Nac ydw"
+ : "No"
+ : router.locale == "cy"
+ ? "Oes"
+ : "Yes",
+ "{16D63FD6-119B-4353-BDCA-18358721C3FE}":
+ renderFileUploadValue,
+ "{0273EDBD-AC1D-40d3-9FB2-095C621B552D}":
+ renderTenantValue
+ };
+
+ const defaultFormatter = () => fieldValue;
+ const renderFieldValue =
+ formatterMap[fieldTypeValue] || defaultFormatter;
+ return (
+
+
+ {FieldsTranslations(rows[0].value)}
+
+
+
+ {renderFieldValue()}
diff --git a/context/refactor-tracker.md b/context/refactor-tracker.md
index f69b2f94..657d5fdb 100644
--- a/context/refactor-tracker.md
+++ b/context/refactor-tracker.md
@@ -4,7 +4,7 @@ Base branch for this tracker: `refactor`
## Status
-Current slice: Slice 6 — BuildCheckRow Formatter Map
+Current slice: Slice 7 — Props Boundary Cleanup
Status: READY TO START
---
@@ -62,7 +62,7 @@ Status: COMPLETE
### Slice 6 — BuildCheckRow Formatter Map
-Status: NOT STARTED
+Status: COMPLETE
---