refactor phase 3a components chunk 1 targeted actions imports

This commit is contained in:
2026-03-12 12:13:29 +00:00
parent be59237ec9
commit a0a633a9ea
14 changed files with 208 additions and 186 deletions
+11 -10
View File
@@ -9,16 +9,17 @@ import xpath from "xpath";
import fieldLookup from "../../data/crmfieldlookuptranslations.json";
import {
setCurrentSection,
setFormComplete,
setFormComplete
} from "../../store/appealType/action";
import BuildCheckRow from "./buildcheckrow";
import { generateAppealPDF, sendCaseCompleteMessage } from "../../actions";
import { generateAppealPDF } from "../../actions/services/documentService";
import { sendCaseCompleteMessage } from "../../actions/services/portalService";
import {
bytesToSize,
getThumbnailIconByExtension,
updateLinks,
getDocLink,
getDocLink
} from "../utils";
let BuildCheckSection = (props) => {
@@ -40,7 +41,7 @@ let BuildCheckSection = (props) => {
setCurrentSection,
updateCurrentSection,
mandatoryFieldsData,
docsOffline,
docsOffline
} = props;
const parser = new DOMParser();
@@ -118,7 +119,7 @@ let BuildCheckSection = (props) => {
Object.assign(pdfObj, {
"filesList": buildAppealFilesArray,
"containerID": props.props.accountDetails.containerID,
"casefolderID": props.appealType.caseReference.ticketnumber,
"casefolderID": props.appealType.caseReference.ticketnumber
});
const [confirmSections, setConfirmSections] = useState(false);
@@ -132,7 +133,7 @@ let BuildCheckSection = (props) => {
let formObj = jsonpath({
path: "$['" + appealtypes + "']",
json: fieldLookup,
eval: true,
eval: true
});
let labelTrans =
@@ -140,7 +141,7 @@ let BuildCheckSection = (props) => {
? jsonpath({
path: '$..[?(@ && @.value=="' + label + '")].value_cy',
json: formObj,
eval: true,
eval: true
})
: label;
return labelTrans;
@@ -393,7 +394,7 @@ const mapStateToProps = (state) => {
searchResultsObj: state.searchResultsObj,
formData: state.formData,
appealType: state.appealType,
form: state.form,
form: state.form
};
};
@@ -405,7 +406,7 @@ const mapDispatchToProps = (dispatch) => {
updateCurrentSection: (whichSection) => {
dispatch(setCurrentSection(whichSection));
dispatch(setFormComplete("true"));
},
}
};
};
@@ -424,6 +425,6 @@ export default connect(
reduxForm({
form: "appealForm",
destroyOnUnmount: false,
enableReinitialize: true, // this is needed!!
enableReinitialize: true // this is needed!!
})(BuildCheckSection)
);
+12 -11
View File
@@ -5,13 +5,14 @@ import { useState } from "react";
import { connect } from "react-redux";
import { formValueSelector, reduxForm } from "redux-form";
import xpath from "xpath";
import { sendEmail, uploadFiles } from "../../actions";
import { uploadFiles } from "../../actions/services/documentService";
import { sendEmail } from "../../actions/services/notifyService";
import {
setCurrentSection,
setDocumentsList,
setFilesForAppeal,
setNewAppealProgress,
setFileCount,
setFileCount
} from "../../store/appealType/action";
import { getFormCollectionByID, getProgressObj, updateLinks } from "../utils";
import BuildRow from "./buildrow";
@@ -48,7 +49,7 @@ let BuildSection = (props) => {
setCurrentSection,
refno,
gotoSection,
mandatoryFieldsData,
mandatoryFieldsData
} = props;
const documentListObj = props.appealType.documentList;
@@ -159,7 +160,7 @@ let BuildSection = (props) => {
typeof filesUploadObj[key][j].name != "undefined" &&
buildAppealFilesArray.push({
"name": filesUploadObj[key][j].name,
"size": filesUploadObj[key][j].size,
"size": filesUploadObj[key][j].size
});
}
}
@@ -220,7 +221,7 @@ let BuildSection = (props) => {
"/contacts(" + props.props.accountDetails.loggedinUserId + ")",
"pinswg_name": props.appealType.caseReference.ticketnumber,
[updateBindAppealTypeToIncident + "@odata.bind"]:
"/incidents(" + incidentId + ")",
"/incidents(" + incidentId + ")"
});
updateBody = JSON.stringify(updateBody);
@@ -261,7 +262,7 @@ let BuildSection = (props) => {
props.appealType.caseReference.ticketnumber +
"&inid=" +
props.appealType.caseReference.incidentid,
"linkExpiry": 10 * 60,
"linkExpiry": 10 * 60
};
// console.log(
@@ -316,7 +317,7 @@ let BuildSection = (props) => {
for (let j in filesUploadObj[key]) {
buildAppealFilesArray.push({
"name": filesUploadObj[key][j].name,
"size": filesUploadObj[key][j].size,
"size": filesUploadObj[key][j].size
});
}
}
@@ -665,14 +666,14 @@ const mapStateToProps = (state, ownProps) => {
formData: state.formData,
appealType: state.appealType,
initialValues: state.appealType.caseReference.caseDetails,
currentView: state.currentView,
currentView: state.currentView
}
: {
search: state.search,
searchResultsObj: state.searchResultsObj,
formData: state.formData,
appealType: state.appealType,
currentView: state.currentView,
currentView: state.currentView
//form: state.form,
};
};
@@ -696,7 +697,7 @@ const mapDispatchToProps = (dispatch) => {
},
setFileCount: (fileCount) => {
dispatch(setFileCount(fileCount));
},
}
};
};
@@ -758,6 +759,6 @@ export default connect(
form: "appealForm",
destroyOnUnmount: false,
enableReinitialize: true, // this is needed!!
validate,
validate
})(BuildSection)
);
+7 -7
View File
@@ -4,7 +4,7 @@ import { useRouter } from "next/router";
import { useEffect } from "react";
import { connect } from "react-redux";
import { formValueSelector } from "redux-form";
import { sendEmail } from "../../actions";
import { sendEmail } from "../../actions/services/notifyService";
import { setCurrentSection } from "../../store/appealType/action";
import { getFormCollectionByID } from "../utils";
@@ -28,7 +28,7 @@ let CompleteAppeal = (props) => {
"/accounts(" + props.appealType.appealLPA + ")",
"pinswg_name": props.appealType.caseReference.ticketnumber,
[updateBindAppealTypeToIncident + "@odata.bind"]:
"/incidents(" + incidentId + ")",
"/incidents(" + incidentId + ")"
});
updateBody = JSON.stringify(updateBody);
@@ -53,7 +53,7 @@ let CompleteAppeal = (props) => {
const personalisation = {
"caseReference": props.appealType.caseReference.ticketnumber,
"emailAddress": props.props.accountDetails.loggedinUserEmail,
"linkExpiry": 10 * 60,
"linkExpiry": 10 * 60
};
sendEmail(templateId, emailAddress, personalisation, reference);
@@ -73,7 +73,7 @@ let CompleteAppeal = (props) => {
props.props.accountDetails.loggedinUserId,
props.appealType.appealTypeID,
props.props.accountDetails.loggedinUserEmail,
props.props.accountDetails.containerID,
props.props.accountDetails.containerID
]);
let { t } = useTranslation();
@@ -87,7 +87,7 @@ let CompleteAppeal = (props) => {
onSubmit,
handleSubmit,
formTitle,
setCurrentSection,
setCurrentSection
} = props;
const currentSection = props.appealType.currentSection;
@@ -157,7 +157,7 @@ const mapStateToProps = (state) => {
search: state.search,
searchResultsObj: state.searchResultsObj,
formData: state.formData,
appealType: state.appealType,
appealType: state.appealType
//form: state.form,
};
};
@@ -166,7 +166,7 @@ const mapDispatchToProps = (dispatch) => {
return {
setCurrentSection: (currentSection) => {
dispatch(setCurrentSection(currentSection));
},
}
};
};
+38 -33
View File
@@ -5,12 +5,13 @@ import { useState } from "react";
import { connect } from "react-redux";
import { Field, formValueSelector, reduxForm } from "redux-form";
import { consoleLogger, createNewCaseBlob } from "../../actions";
import { consoleLogger } from "../../actions/core/logger";
import { createNewCaseBlob } from "../../actions/services/caseService";
import transLookup from "../../data/lookuptranslations.json";
import {
setAppealLPA,
setAppealTypeID,
setAppealTypeTitle,
setAppealTypeTitle
} from "../../store/appealType/action";
import { getFormCollectionByID } from "../utils";
import Aboutyou from "./aboutyou";
@@ -21,7 +22,7 @@ const RenderLPAList = ({
optionsObj,
meta: { touched, error },
label,
errorMsg,
errorMsg
}) => {
let { t } = useTranslation();
const router = useRouter();
@@ -71,7 +72,7 @@ const RenderLPAList = ({
optionsObj[key].name +
'")].value_cy',
json: transLookup,
eval: true,
eval: true
})
: optionsObj[key].name}
</option>
@@ -90,7 +91,7 @@ const RenderAppealTypeList = ({
optionsObj,
meta: { touched, error },
label,
errorMsg,
errorMsg
}) => {
let { t } = useTranslation();
const router = useRouter();
@@ -133,31 +134,35 @@ const RenderAppealTypeList = ({
_.isEmpty(optionsObj[key])
? ""
: _.isEmpty(optionsObj[key])
? ""
: _.isEmpty(
optionsObj[key].value
)
? ""
: optionsObj[key]
.attributevalue
? ""
: _.isEmpty(
optionsObj[key]
.value
)
? ""
: optionsObj[key]
.attributevalue
}
>
{_.isEmpty(optionsObj[key])
? ""
: _.isEmpty(optionsObj[key])
? ""
: _.isEmpty(optionsObj[key].value)
? ""
: router.locale == "cy"
? jsonpath({
path:
'$..[?(@ && @.value=="' +
optionsObj[key].value +
'")].value_cy',
json: transLookup,
eval: true,
})
: optionsObj[key].value}
? ""
: _.isEmpty(
optionsObj[key].value
)
? ""
: router.locale == "cy"
? jsonpath({
path:
'$..[?(@ && @.value=="' +
optionsObj[key]
.value +
'")].value_cy',
json: transLookup,
eval: true
})
: optionsObj[key].value}
</option>
);
})}
@@ -255,7 +260,7 @@ const RenderRadio = ({
{
["documentCheckList_" +
id]:
custom.requiredDocumentLabel,
custom.requiredDocumentLabel
}
))
: delete docListObj[
@@ -289,7 +294,7 @@ function Radiofield(props) {
form,
formProps,
parentFieldShowOnValue,
validation,
validation
} = props;
let { t } = useTranslation();
const router = useRouter();
@@ -401,9 +406,9 @@ let CreateCase = (props) => {
values.appealTypes == "846040004" && values.confirmHASCAS == "true"
? "846040004"
: values.appealTypes == "846040004" &&
values.confirmHASCAS == "false"
? "846040000"
: values.appealTypes;
values.confirmHASCAS == "false"
? "846040000"
: values.appealTypes;
var whichAppealType = whichAppealType;
@@ -570,7 +575,7 @@ const mapStateToProps = (state) => {
search: state.search,
searchResultsObj: state.searchResultsObj,
formData: state.formData,
appealType: state.appealType,
appealType: state.appealType
//form: state.form,
};
};
@@ -587,7 +592,7 @@ const mapDispatchToProps = (dispatch) => {
},
onChangeSelectLPA: (lpaId) => {
dispatch(setAppealLPA(lpaId));
},
}
};
};
@@ -599,6 +604,6 @@ export default connect(
)(
reduxForm({
form: "caseForm",
destroyOnUnmount: false,
destroyOnUnmount: false
})(CreateCase)
);