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:
@@ -72,6 +72,12 @@ let BuildSection = (props) => {
|
||||
mandatoryFieldsData
|
||||
} = props;
|
||||
|
||||
const legacyProps = props.props;
|
||||
const legacyAccountDetails = legacyProps.accountDetails;
|
||||
const legacyFormState = legacyProps.form;
|
||||
const legacyAppealType = legacyProps.appealType;
|
||||
const legacyUrl = legacyProps.url;
|
||||
|
||||
const documentListObj = props.appealType.documentList;
|
||||
const currentSection = props.appealType.currentSection;
|
||||
|
||||
@@ -130,8 +136,8 @@ let BuildSection = (props) => {
|
||||
await uploadAppealFilesEffect(
|
||||
dataObj,
|
||||
fileListObj,
|
||||
props.props.accountDetails.containerID,
|
||||
props.props.appealType.caseReference.ticketnumber
|
||||
legacyAccountDetails.containerID,
|
||||
legacyAppealType.caseReference.ticketnumber
|
||||
).then((data) => {
|
||||
//console.log("$1", data);
|
||||
setCompletedUploadFiles(true);
|
||||
@@ -223,7 +229,7 @@ let BuildSection = (props) => {
|
||||
Object.assign(updateBody, {
|
||||
"pinswg_appealcasetype": props.appealType.appealTypeID,
|
||||
"pinswg_Appellant@odata.bind":
|
||||
"/contacts(" + props.props.accountDetails.loggedinUserId + ")",
|
||||
"/contacts(" + legacyAccountDetails.loggedinUserId + ")",
|
||||
"pinswg_name": props.appealType.caseReference.ticketnumber,
|
||||
[updateBindAppealTypeToIncident + "@odata.bind"]:
|
||||
"/incidents(" + incidentId + ")"
|
||||
@@ -241,12 +247,12 @@ let BuildSection = (props) => {
|
||||
const reference = "PEDW-PARTIAL";
|
||||
const templateId = "021b0a7b-df00-41f1-b94e-c269bee98c75";
|
||||
const templateIdCY = "f3c4a56b-bfb8-4d39-97dd-888df3062b0a";
|
||||
const emailAddress = props.props.accountDetails.loggedinUserEmail;
|
||||
const emailAddress = legacyAccountDetails.loggedinUserEmail;
|
||||
const personalisation = {
|
||||
"caseReference": props.appealType.caseReference.ticketnumber,
|
||||
"emailAddress": props.props.accountDetails.loggedinUserEmail,
|
||||
"emailAddress": legacyAccountDetails.loggedinUserEmail,
|
||||
"returnLink":
|
||||
props.props.url +
|
||||
legacyUrl +
|
||||
(router.locale != "en" ? "/cy/fymhorth/" : "/myportal/") +
|
||||
appTypeCollection.UrlName +
|
||||
"?lpa=" +
|
||||
@@ -354,7 +360,7 @@ let BuildSection = (props) => {
|
||||
const [hasErrors, setHasErrors] = useState("");
|
||||
|
||||
const getErrors = () => {
|
||||
let errorsobj = props.props.form["appealForm"];
|
||||
let errorsobj = legacyFormState["appealForm"];
|
||||
//setHasErrors(errorsobj.hasOwnProperty("syncErrors"));
|
||||
window.scrollTo(0, 0);
|
||||
};
|
||||
@@ -385,7 +391,7 @@ let BuildSection = (props) => {
|
||||
};
|
||||
|
||||
const hasUploadFiles = () => {
|
||||
const formArr = props.props.form["appealForm"].values;
|
||||
const formArr = legacyFormState["appealForm"].values;
|
||||
const prefix = "pinswg_fileUpload";
|
||||
const hasFiles = Object.keys(formArr).some((key) =>
|
||||
key.startsWith(prefix)
|
||||
@@ -431,11 +437,10 @@ let BuildSection = (props) => {
|
||||
onClick={() => {
|
||||
getErrors();
|
||||
let valuesObj = _.has(
|
||||
props.props.form[props.form],
|
||||
legacyFormState[props.form],
|
||||
"values"
|
||||
)
|
||||
? props.props.form[props.form]
|
||||
.values
|
||||
? legacyFormState[props.form].values
|
||||
: {};
|
||||
|
||||
//console.log("valuesobj:", valuesObj);
|
||||
@@ -470,7 +475,7 @@ let BuildSection = (props) => {
|
||||
className="govuk-button progress-save "
|
||||
onClick={() => {
|
||||
let valuesObj =
|
||||
props.props.form[props.form]
|
||||
legacyFormState[props.form]
|
||||
.values || {};
|
||||
|
||||
// console.log(
|
||||
@@ -532,7 +537,7 @@ let BuildSection = (props) => {
|
||||
className="govuk-button progress-save "
|
||||
onClick={() => {
|
||||
let valuesObj =
|
||||
props.props.form[props.form]
|
||||
legacyFormState[props.form]
|
||||
.values || {};
|
||||
|
||||
// console.log(
|
||||
|
||||
Reference in New Issue
Block a user