diff --git a/components/elements/index.js b/components/elements/index.js index faf92d20..917ddf91 100644 --- a/components/elements/index.js +++ b/components/elements/index.js @@ -1,4 +1,4 @@ -import { Field, reduxForm } from "redux-form"; +import { Field, reduxForm, FieldArray } from "redux-form"; import { useRouter } from "next/router"; import DatePicker, { registerLocale, setDefaultLocale } from "react-datepicker"; import React, { useCallback, useEffect, useMemo, useState } from "react"; @@ -1736,3 +1736,94 @@ const RenderFileUpload = (field) => { ); }; + +const renderField = ({ input, label, type, meta: { touched, error } }) => ( +
+ +
+ + {touched && error && {error}} +
+
+); + +const renderSubFields = ({ fields }) => ( + +); + +export const FieldArrayForm = (props) => { + const { + name, + label, + validation, + form, + formProps, + parentFieldShowOnValue, + parentField, + maxFieldLength, + } = props; + + var showIfHasParentShowValue = + parentField != false && + !_.isEmpty(formProps[form]) && + _.has(formProps[form].values, parentField) && + parentFieldShowOnValue.indexOf( + formProps[form].values[parentField].toString() + ) > -1; + + (showIfHasParentShowValue == parentField) != false && + showIfHasParentShowValue; + + parentFieldShowOnValue; + const { handleSubmit, pristine, reset, submitting } = props; + return ( + <> + {" "} + {showIfHasParentShowValue && ( + + )} + + ); +}; diff --git a/components/newappeal/buildCheckfield.js b/components/newappeal/buildCheckfield.js index 1fdef5df..23bd2d81 100644 --- a/components/newappeal/buildCheckfield.js +++ b/components/newappeal/buildCheckfield.js @@ -42,6 +42,9 @@ export default function BuildField(props) { case "{4273EDBD-AC1D-40d3-9FB2-095C621B552D}": return <>{fieldValue}; break; + case "{0273EDBD-AC1D-40d3-9FB2-095C621B552D}": + return <>{}; + break; case "{5B773807-9FB2-42db-97C3-7A91EFF8ADFF}": return ( <> diff --git a/components/newappeal/buildcheckrow.js b/components/newappeal/buildcheckrow.js index 9197f561..b2298b83 100644 --- a/components/newappeal/buildcheckrow.js +++ b/components/newappeal/buildcheckrow.js @@ -10,6 +10,7 @@ import { getFormCollectionByID, getPickListLabel, getRadioLabel, + getFieldArrayLabel, } from "../../components/utils"; import { @@ -169,6 +170,35 @@ let BuildCheckRow = (props) => { : fieldtype[0].value == "{16D63FD6-119B-4353-BDCA-18358721C3FE}" ? "ssss" + : fieldtype[0].value == + "{0273EDBD-AC1D-40d3-9FB2-095C621B552D}" + ? props.props.form[ + "appealForm" + ].values[ + datafieldname[0].value + ].map((tenant, index) => { + return ( +
+
+ { + tenant.pinswg_agriculturaltenantname + } +
+
+ Served:{" "} + {formatDate( + tenant.dateserved + )} +
+
+ ); + }) : props.props.form["appealForm"] .values[ datafieldname[0].value diff --git a/components/newappeal/buildchecksection.js b/components/newappeal/buildchecksection.js index 906866cc..5674275b 100644 --- a/components/newappeal/buildchecksection.js +++ b/components/newappeal/buildchecksection.js @@ -72,7 +72,7 @@ let BuildCheckSection = (props) => { }; let buildAppealFilesArray = []; - console.log("attached docs: - ", buildAppealFilesArray); + //console.log("attached docs: - ", buildAppealFilesArray); let filesUplaodObj = Object.keys(props.props.form.appealForm.values) .filter(function (k) { @@ -83,8 +83,6 @@ let BuildCheckSection = (props) => { return newData; }, {}); - console.log(filesUplaodObj); - for (let key in filesUplaodObj) { for (let j in filesUplaodObj[key]) { typeof filesUplaodObj[key][j].name != "undefined" && @@ -95,8 +93,6 @@ let BuildCheckSection = (props) => { } } - console.log(buildAppealFilesArray); - let pdfObj = props.props.form.appealForm.values; Object.assign(pdfObj, { diff --git a/components/newappeal/buildfield.js b/components/newappeal/buildfield.js index 14247df0..392e0918 100644 --- a/components/newappeal/buildfield.js +++ b/components/newappeal/buildfield.js @@ -13,6 +13,7 @@ import { RichMultiLinefield, Textfield, YesNofield, + FieldArrayForm, } from "../elements"; export default function BuildField(props) { @@ -217,6 +218,17 @@ export default function BuildField(props) { ); break; + case "{0273EDBD-AC1D-40d3-9FB2-095C621B552D}": + return ( + + ); case "{9EF39988-22BB-4f0b-BBBE-64B5A3748AEE}": return ( { backgroundColor: "white", padding: 5, }, - + questionAnswerRow: { + width: "100%", + flex: 1, + flexDirection: "row", + flexGrow: 1, + }, + questionAnswerColLeft: { + width: "40%", + }, + questionAnswerColRight: { + padding: 5, + width: "40%", + }, sectionContainer: { backgroundColor: "#F8F8F8", padding: 10, @@ -248,6 +260,8 @@ export const AppealRow_pdf = (props) => { break; case "{07FAC785-CD58-4f9f-ABB3-4B7DDC6ED5ED}": var fieldCopy = datafieldcontent[0].value + .replace("]", "") + .replace("[", "") .split(",") .find((a) => a.includes( @@ -416,6 +430,81 @@ export const AppealRow_pdf = (props) => { ); break; + case "{0273EDBD-AC1D-40d3-9FB2-095C621B552D}": + return ( + + + + {rows[0].value} + + + + + {props.props[ + datafieldname[0].value + ].map((tenant) => { + return ( + + + { + tenant.pinswg_agriculturaltenantname + } + + + + Notice + served:{" "} + {formatDate( + tenant.dateserved + )} + + + ); + })} + + + + ); default: return (