Merged PR 2242: Refactor: New Appeal flow structural cleanup (Slices 1–8, no behaviour change)
## Summary This PR merges the completed new-appeal refactor stream (Slices 1–8) into SIPS-Development. This refactor was executed in controlled slices with regression validation at each step. ## Scope Structural and readability improvements only: - XML/form derivation extraction - payload and file helper extraction - side-effect facade introduction - BuildSection and BuildCheckSection decomposition - BuildCheckRow formatter map refactor - nested prop boundary cleanup - start-flow cleanup (CreateCase / AboutYou) ## Behaviour No intended behavioural changes. The following were explicitly preserved: - S78 journey behaviour - payload shapes and field names/ids - HASCAS mapping logic - appellant/agent branching - validation rules and messages - redirect/query parameters (`lpa`, `apt`, `id`) - navigation and side-effect sequencing - EN/CY output parity ## Validation Full regression has been performed on: - start flow (CreateCase / AboutYou) - save and resume flows - file upload handling - check answers rendering - submit/finalisation sequence - confirmation flow - CRM insertion path - EN/CY parity Additional checks: - docsOffline branch behaviour - completion and partial-save email paths - negative-path validation scenarios - lint (warnings baseline unchanged) ## Risk Low: - changes are structural only - no business logic changes - no contract changes ## Rollback Safe rollback via reverting this merge commit. ## Notes This refactor reduces coupling and prepares the new-appeal flow for future appeal-type expansion. Related work items: #22570, #22576, #22577, #22583, #22586, #22587, #22588, #22590
This commit is contained in:
@@ -262,7 +262,7 @@ const RenderRadio = ({
|
||||
{
|
||||
["documentCheckList_" +
|
||||
id]:
|
||||
custom.requiredDocumentLabel,
|
||||
custom.requiredDocumentLabel
|
||||
}
|
||||
))
|
||||
: delete docListObj[
|
||||
@@ -297,7 +297,7 @@ function Radiofield(props) {
|
||||
formProps,
|
||||
parentFieldShowOnValue,
|
||||
validation,
|
||||
hint,
|
||||
hint
|
||||
} = props;
|
||||
|
||||
const router = useRouter();
|
||||
@@ -438,22 +438,25 @@ let AboutYou = (props) => {
|
||||
|
||||
const router = useRouter();
|
||||
const { locale } = router;
|
||||
const isWelsh = router.locale == "cy";
|
||||
|
||||
const {
|
||||
onSubmit,
|
||||
handleSubmit,
|
||||
appellantAgentValue,
|
||||
setFormStep,
|
||||
updateField,
|
||||
updateField
|
||||
} = props;
|
||||
|
||||
const [isAgent, setIsAgent] = useState(false);
|
||||
const isAgentSelected = appellantAgentValue == "846040001";
|
||||
const isAppellantSelected = appellantAgentValue == "846040000";
|
||||
|
||||
const yesNo = router.locale == "cy" ? ["Ydw", "Na"] : ["Yes", "No"];
|
||||
const appellantAgent =
|
||||
router.locale == "cy" ? ["Apelydd", "Asiant"] : ["Appellant", "Agent"];
|
||||
const contactPref =
|
||||
router.locale == "cy" ? ["Ebost", "Post"] : ["Email", "Post"];
|
||||
const yesNo = isWelsh ? ["Ydw", "Na"] : ["Yes", "No"];
|
||||
const appellantAgent = isWelsh
|
||||
? ["Apelydd", "Asiant"]
|
||||
: ["Appellant", "Agent"];
|
||||
const contactPref = isWelsh ? ["Ebost", "Post"] : ["Email", "Post"];
|
||||
|
||||
const required = (value) =>
|
||||
value ? undefined : t("newappeal:is-required-label");
|
||||
@@ -493,7 +496,7 @@ let AboutYou = (props) => {
|
||||
};
|
||||
|
||||
const handlePartialUpdate = () => {
|
||||
if (appellantAgentValue == "846040001" && isAgent == false) {
|
||||
if (isAgentSelected && isAgent == false) {
|
||||
updateField("caseForm", "pinswg_appellantfirstname", "");
|
||||
updateField("caseForm", "pinswg_appellantlastname", "");
|
||||
updateField("caseForm", "pinswg_appellantemailaddress", "");
|
||||
@@ -570,7 +573,7 @@ let AboutYou = (props) => {
|
||||
errorMsg={t("newappeal:select-an-option-label")}
|
||||
hint={t("newappeal:about-you-who-are-you-hint-label")}
|
||||
/>
|
||||
{appellantAgentValue == "846040000" && (
|
||||
{isAppellantSelected && (
|
||||
<>
|
||||
<h2 className="govuk-heading-s">
|
||||
{t("newappeal:about-you-appellant-contact-details")}
|
||||
@@ -668,7 +671,7 @@ let AboutYou = (props) => {
|
||||
/>
|
||||
</>
|
||||
)}
|
||||
{appellantAgentValue == "846040001" && (
|
||||
{isAgentSelected && (
|
||||
<>
|
||||
<h2 className="govuk-heading-s">
|
||||
{t("newappeal:about-you-appellant-contact-details")}
|
||||
@@ -891,15 +894,15 @@ const mapStateToProps = (state) => {
|
||||
pinswg_appellantaddress:
|
||||
state.accountDetails.accountDetails.address1_composite,
|
||||
pinswg_appellantphonenumber:
|
||||
state.accountDetails.accountDetails.telephone1,
|
||||
},
|
||||
state.accountDetails.accountDetails.telephone1
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
const mapDispatchToProps = (dispatch) => {
|
||||
return {
|
||||
updateField: (form, field, newValue) =>
|
||||
dispatch(change(form, field, newValue)),
|
||||
dispatch(change(form, field, newValue))
|
||||
};
|
||||
};
|
||||
|
||||
@@ -915,7 +918,7 @@ AboutYou = connect((state) => {
|
||||
const appellantAgentValue = selector(state, "pinswg_appellantagent");
|
||||
|
||||
return {
|
||||
appellantAgentValue,
|
||||
appellantAgentValue
|
||||
};
|
||||
})(AboutYou);
|
||||
|
||||
@@ -928,6 +931,6 @@ export default connect(
|
||||
reduxForm({
|
||||
form: "caseForm",
|
||||
enableReinitialize: true, // this is needed!!
|
||||
destroyOnUnmount: false,
|
||||
destroyOnUnmount: false
|
||||
})(AboutYou)
|
||||
);
|
||||
|
||||
@@ -0,0 +1,5 @@
|
||||
const CheckSectionHeading = ({ title }) => {
|
||||
return <h1 className="govuk-heading-m">{title}</h1>;
|
||||
};
|
||||
|
||||
export default CheckSectionHeading;
|
||||
@@ -0,0 +1,63 @@
|
||||
const ConfirmationCheckboxGroup = ({
|
||||
downloadAppealForm,
|
||||
onDownloadChange,
|
||||
onConfirmChange,
|
||||
downloadLabel,
|
||||
confirmLabel,
|
||||
paragraphOne,
|
||||
paragraphTwo,
|
||||
paragraphTwoLink
|
||||
}) => {
|
||||
return (
|
||||
<div className="govuk-form-group ">
|
||||
<fieldset className="govuk-fieldset">
|
||||
<div className="govuk-checkboxes govuk-checkboxes--small">
|
||||
<div className="govuk-checkboxes__item">
|
||||
<input
|
||||
name="pinswg_downloadAppealForm"
|
||||
id="pinswg_downloadAppealForm"
|
||||
type="checkbox"
|
||||
className="govuk-checkboxes__input"
|
||||
checked={downloadAppealForm}
|
||||
onChange={onDownloadChange}
|
||||
/>
|
||||
<label
|
||||
className="govuk-label govuk-checkboxes__label"
|
||||
htmlFor="pinswg_downloadAppealForm"
|
||||
>
|
||||
{downloadLabel}
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
<div className="govuk-checkboxes govuk-checkboxes--small">
|
||||
<div className="govuk-checkboxes__item">
|
||||
<input
|
||||
name="pinswg_checkconfirmation"
|
||||
id="pinswg_checkconfirmation"
|
||||
type="checkbox"
|
||||
className="govuk-checkboxes__input"
|
||||
value=""
|
||||
onChange={onConfirmChange}
|
||||
/>
|
||||
<label
|
||||
className="govuk-label govuk-checkboxes__label"
|
||||
htmlFor="pinswg_checkconfirmation"
|
||||
>
|
||||
{confirmLabel}
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
</fieldset>
|
||||
<div>
|
||||
<p className="govuk-body">{paragraphOne}</p>
|
||||
</div>
|
||||
<div>
|
||||
<p className="govuk-body">
|
||||
{paragraphTwo} {paragraphTwoLink}
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
};
|
||||
|
||||
export default ConfirmationCheckboxGroup;
|
||||
@@ -0,0 +1,19 @@
|
||||
const DocsOfflineNotice = ({ noticeText, returnLink }) => {
|
||||
return (
|
||||
<>
|
||||
<div className="govuk-warning-text ">
|
||||
<span className="govuk-warning-text__icon" aria-hidden="true">
|
||||
!
|
||||
</span>
|
||||
<strong className="govuk-warning-text__text govuk-!-margin-top-2">
|
||||
<span className="govuk-visually-hidden">Notice</span>
|
||||
{noticeText}
|
||||
{" "}
|
||||
</strong>
|
||||
</div>{" "}
|
||||
{returnLink}
|
||||
</>
|
||||
);
|
||||
};
|
||||
|
||||
export default DocsOfflineNotice;
|
||||
@@ -0,0 +1,11 @@
|
||||
const FinalisingStatePanel = ({ heading, label, waitLabel }) => {
|
||||
return (
|
||||
<div className="">
|
||||
<h3 className="govuk-heading-m govuk-!-margin-top-9">{heading}</h3>
|
||||
<p className="govuk-body">{label}</p>
|
||||
<p className="govuk-body textloading">{waitLabel}</p>
|
||||
</div>
|
||||
);
|
||||
};
|
||||
|
||||
export default FinalisingStatePanel;
|
||||
@@ -0,0 +1,5 @@
|
||||
const SectionReviewList = ({ children }) => {
|
||||
return <dl className="govuk-summary-list ">{children}</dl>;
|
||||
};
|
||||
|
||||
export default SectionReviewList;
|
||||
@@ -0,0 +1,5 @@
|
||||
const SubmitActionsPanel = ({ children }) => {
|
||||
return <div className="govuk-button-group">{children}</div>;
|
||||
};
|
||||
|
||||
export default SubmitActionsPanel;
|
||||
@@ -0,0 +1,31 @@
|
||||
const ErrorSummary = ({ hasErrors, errorItems }) => {
|
||||
return hasErrors ? (
|
||||
<div
|
||||
className="govuk-error-summary"
|
||||
aria-labelledby="error-summary-title"
|
||||
role="alert"
|
||||
tabIndex="-1"
|
||||
data-module="govuk-error-summary"
|
||||
>
|
||||
<h2 className="govuk-error-summary__title" id="error-summary-title">
|
||||
The following fields have a problem :
|
||||
</h2>
|
||||
<div className="govuk-error-summary__body">
|
||||
<ul className="govuk-list govuk-error-summary__list">
|
||||
{errorItems.map((item, i) => (
|
||||
<li key={i}>
|
||||
<a href={"#" + item.field + "_label"}>
|
||||
{" "}
|
||||
{item.label}
|
||||
</a>
|
||||
</li>
|
||||
))}
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
) : (
|
||||
""
|
||||
);
|
||||
};
|
||||
|
||||
export default ErrorSummary;
|
||||
@@ -0,0 +1,5 @@
|
||||
const PrimaryActionButtons = ({ children }) => {
|
||||
return <div className="govuk-button-group">{children}</div>;
|
||||
};
|
||||
|
||||
export default PrimaryActionButtons;
|
||||
@@ -0,0 +1,14 @@
|
||||
const SaveStatusIndicator = ({ text }) => {
|
||||
return (
|
||||
<span className=" progress-save-active">
|
||||
{text}
|
||||
<img
|
||||
className="data-loading-icon"
|
||||
src="/assets/images/loading.gif"
|
||||
alt={text}
|
||||
/>
|
||||
</span>
|
||||
);
|
||||
};
|
||||
|
||||
export default SaveStatusIndicator;
|
||||
@@ -0,0 +1,5 @@
|
||||
const SectionHeader = ({ title }) => {
|
||||
return <h1 className="govuk-heading-m ">{title}</h1>;
|
||||
};
|
||||
|
||||
export default SectionHeader;
|
||||
@@ -0,0 +1,12 @@
|
||||
const SidebarProgressPanel = ({ children }) => {
|
||||
return (
|
||||
<div className="govuk-grid-column-one-third">
|
||||
<div className="at-nav-container">
|
||||
{children}
|
||||
<hr className="govuk-section-break govuk-section-break--m govuk-section-break--visible" />
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
};
|
||||
|
||||
export default SidebarProgressPanel;
|
||||
@@ -2,23 +2,34 @@ import { JSONPath as jsonpath } from "jsonpath-plus";
|
||||
import useTranslation from "next-translate/useTranslation";
|
||||
import { useRouter } from "next/router";
|
||||
import { connect } from "react-redux";
|
||||
import xpath from "xpath";
|
||||
import {
|
||||
getPickListLabel,
|
||||
getRadioLabel,
|
||||
bytesToSize,
|
||||
getDocumentTypeFromFilename,
|
||||
getThumbnailIconByExtension,
|
||||
getThumbnailIconByExtension
|
||||
} from "../../components/utils";
|
||||
import fieldLookup from "../../data/crmfieldlookuptranslations.json";
|
||||
|
||||
import {
|
||||
setCurrentSection,
|
||||
setFormComplete,
|
||||
setFormComplete
|
||||
} from "../../store/appealType/action";
|
||||
import {
|
||||
parseRowOuterHTML,
|
||||
parseXml,
|
||||
selectCurrentSectionRows,
|
||||
selectRowDataFieldName,
|
||||
selectRowDocumentTypeCode,
|
||||
selectRowFieldType,
|
||||
selectRowLabelDescriptions
|
||||
} from "../../lib/newappeal/formDerivation";
|
||||
|
||||
let BuildCheckRow = (props) => {
|
||||
let { t } = useTranslation();
|
||||
const legacyProps = props.props;
|
||||
const legacyFormState = legacyProps.form;
|
||||
const legacyFormData = legacyProps.formData;
|
||||
|
||||
const router = useRouter();
|
||||
const { locale } = router;
|
||||
@@ -30,18 +41,12 @@ let BuildCheckRow = (props) => {
|
||||
onSubmit,
|
||||
updateCurrentSection,
|
||||
setCurrentSection,
|
||||
mandatoryFieldsData,
|
||||
mandatoryFieldsData
|
||||
} = props;
|
||||
|
||||
const parser = new DOMParser();
|
||||
var doc = parser.parseFromString(props.formXML, "text/xml");
|
||||
var doc = parseXml(props.formXML);
|
||||
|
||||
var rowXML = xpath.select(
|
||||
"/form/tabs/tab[" +
|
||||
whichSection +
|
||||
"]/columns//sections/section/rows/row",
|
||||
doc
|
||||
);
|
||||
var rowXML = selectCurrentSectionRows(doc, whichSection);
|
||||
|
||||
function formatDate(dateObj) {
|
||||
var m = new Date(dateObj);
|
||||
@@ -66,7 +71,7 @@ let BuildCheckRow = (props) => {
|
||||
let formObj = jsonpath({
|
||||
path: "$['" + appealtypes + "']",
|
||||
json: fieldLookup,
|
||||
eval: true,
|
||||
eval: true
|
||||
});
|
||||
|
||||
let labelTrans =
|
||||
@@ -74,7 +79,7 @@ let BuildCheckRow = (props) => {
|
||||
? jsonpath({
|
||||
path: '$..[?(@ && @.value=="' + label + '")].value_cy',
|
||||
json: formObj,
|
||||
eval: true,
|
||||
eval: true
|
||||
})
|
||||
: label;
|
||||
return labelTrans;
|
||||
@@ -91,29 +96,23 @@ let BuildCheckRow = (props) => {
|
||||
return (
|
||||
<>
|
||||
{Object.keys(rowXML).map((key, index) => {
|
||||
var doc = parser.parseFromString(
|
||||
rowXML[key].outerHTML,
|
||||
"text/xml"
|
||||
);
|
||||
var doc = parseRowOuterHTML(rowXML[key].outerHTML);
|
||||
if (_.isEmpty(rowXML[key].innerHTML)) {
|
||||
("");
|
||||
} else {
|
||||
var rows = xpath.select("//label/@description", doc);
|
||||
var fieldtype = xpath.select("//@classid", doc);
|
||||
var datafieldname = xpath.select("//@datafieldname", doc);
|
||||
var rows = selectRowLabelDescriptions(doc);
|
||||
var fieldtype = selectRowFieldType(doc);
|
||||
var datafieldname = selectRowDataFieldName(doc);
|
||||
const isRequiredField = jsonpath({
|
||||
path:
|
||||
"$..value[?(@ && @.LogicalName=='" +
|
||||
datafieldname[0].value +
|
||||
"')]",
|
||||
json: mandatoryFieldsData,
|
||||
eval: true,
|
||||
eval: true
|
||||
});
|
||||
|
||||
var documentTypeCode = xpath.select(
|
||||
"//@ishareDocumentCode",
|
||||
doc
|
||||
);
|
||||
var documentTypeCode = selectRowDocumentTypeCode(doc);
|
||||
|
||||
// if (datafieldname[0].value.indexOf("fileUpload") > 0) {
|
||||
// isRequiredField.push({
|
||||
@@ -142,66 +141,54 @@ let BuildCheckRow = (props) => {
|
||||
// datafieldname[0].value
|
||||
// ] != "undefined"
|
||||
// ) {
|
||||
return (
|
||||
<div className="govuk-summary-list__row" key={key}>
|
||||
<dt className="govuk-summary-list__key">
|
||||
{FieldsTranslations(rows[0].value)}
|
||||
</dt>
|
||||
const fieldTypeValue = fieldtype[0].value;
|
||||
const fieldValue =
|
||||
legacyFormState["appealForm"].values[
|
||||
datafieldname[0].value
|
||||
];
|
||||
|
||||
<dd className="govuk-summary-list__value">
|
||||
{fieldtype[0].value ==
|
||||
"{E0DECE4B-6666-4a8f-A065-082708572369}" ? (
|
||||
<div
|
||||
dangerouslySetInnerHTML={{
|
||||
__html: props.props.form[
|
||||
"appealForm"
|
||||
].values[datafieldname[0].value],
|
||||
}}
|
||||
/>
|
||||
) : 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) => (
|
||||
<div key={i}>
|
||||
{getDocumentTypeFromFilename(blob.name) ===
|
||||
documentTypeCode[0].value && (
|
||||
<div
|
||||
style={{
|
||||
display: "flex",
|
||||
alignItems: "flex-start"
|
||||
}}
|
||||
className="govuk-!-margin-bottom-2"
|
||||
>
|
||||
<img
|
||||
style={{
|
||||
minWidth: "50",
|
||||
width: "50"
|
||||
}}
|
||||
src={getThumbnailIconByExtension(
|
||||
blob.name
|
||||
)}
|
||||
alt={blob.name}
|
||||
width="50"
|
||||
/>
|
||||
<span
|
||||
style={{
|
||||
maxWidth: "85%"
|
||||
}}
|
||||
className="govuk-body govuk-!-font-size-14 govuk-!-margin-left-2"
|
||||
>
|
||||
{blob.name} -{" "}
|
||||
{bytesToSize(blob.size)}{" "}
|
||||
</span>
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
))}
|
||||
<br />
|
||||
{typeof fieldValue != "undefined" &&
|
||||
fieldValue.map(
|
||||
(blob, i) =>
|
||||
isObjectAndNotEmpty(blob) && (
|
||||
<div key={i}>
|
||||
{getDocumentTypeFromFilename(
|
||||
blob.name
|
||||
@@ -212,14 +199,14 @@ let BuildCheckRow = (props) => {
|
||||
style={{
|
||||
display: "flex",
|
||||
alignItems:
|
||||
"flex-start",
|
||||
"flex-start"
|
||||
}}
|
||||
className="govuk-!-margin-bottom-2"
|
||||
>
|
||||
<img
|
||||
style={{
|
||||
minWidth: "50",
|
||||
width: "50",
|
||||
width: "50"
|
||||
}}
|
||||
src={getThumbnailIconByExtension(
|
||||
blob.name
|
||||
@@ -229,7 +216,7 @@ let BuildCheckRow = (props) => {
|
||||
/>
|
||||
<span
|
||||
style={{
|
||||
maxWidth: "85%",
|
||||
maxWidth: "85%"
|
||||
}}
|
||||
className="govuk-body govuk-!-font-size-14 govuk-!-margin-left-2"
|
||||
>
|
||||
@@ -241,124 +228,96 @@ let BuildCheckRow = (props) => {
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
))}
|
||||
<br />
|
||||
{typeof props.props.form["appealForm"]
|
||||
.values[datafieldname[0].value] !=
|
||||
"undefined" &&
|
||||
props.props.form[
|
||||
"appealForm"
|
||||
].values[
|
||||
datafieldname[0].value
|
||||
].map(
|
||||
(blob, i) =>
|
||||
isObjectAndNotEmpty(
|
||||
blob
|
||||
) && (
|
||||
<div key={i}>
|
||||
{getDocumentTypeFromFilename(
|
||||
blob.name
|
||||
) ===
|
||||
documentTypeCode[0]
|
||||
.value && (
|
||||
<div
|
||||
style={{
|
||||
display:
|
||||
"flex",
|
||||
alignItems:
|
||||
"flex-start",
|
||||
}}
|
||||
className="govuk-!-margin-bottom-2"
|
||||
>
|
||||
<img
|
||||
style={{
|
||||
minWidth:
|
||||
"50",
|
||||
width: "50",
|
||||
}}
|
||||
src={getThumbnailIconByExtension(
|
||||
blob.name
|
||||
)}
|
||||
alt={
|
||||
blob.name
|
||||
}
|
||||
width="50"
|
||||
/>
|
||||
<span
|
||||
style={{
|
||||
maxWidth:
|
||||
"85%",
|
||||
}}
|
||||
className="govuk-body govuk-!-font-size-14 govuk-!-margin-left-2"
|
||||
>
|
||||
{
|
||||
blob.name
|
||||
}{" "}
|
||||
-{" "}
|
||||
{bytesToSize(
|
||||
blob.size
|
||||
)}{" "}
|
||||
</span>
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
)
|
||||
)}
|
||||
</>
|
||||
) : 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" ? (
|
||||
<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"
|
||||
)
|
||||
) : (
|
||||
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" ? (
|
||||
<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";
|
||||
|
||||
const formatterMap = {
|
||||
"{E0DECE4B-6666-4a8f-A065-082708572369}": () => (
|
||||
<div
|
||||
dangerouslySetInnerHTML={{
|
||||
__html: fieldValue
|
||||
}}
|
||||
/>
|
||||
),
|
||||
"{5B773807-9FB2-42db-97C3-7A91EFF8ADFF}": () =>
|
||||
formatDate(fieldValue),
|
||||
"{3EF39988-22BB-4f0b-BBBE-64B5A3748AEE}": () =>
|
||||
getPickListLabel(
|
||||
legacyFormData.pickListData,
|
||||
datafieldname[0].value,
|
||||
fieldValue
|
||||
),
|
||||
"{07FAC785-CD58-4f9f-ABB3-4B7DDC6ED5ED}": () =>
|
||||
getRadioLabel(
|
||||
legacyFormData.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 (
|
||||
<div className="govuk-summary-list__row" key={key}>
|
||||
<dt className="govuk-summary-list__key">
|
||||
{FieldsTranslations(rows[0].value)}
|
||||
</dt>
|
||||
|
||||
<dd className="govuk-summary-list__value">
|
||||
{renderFieldValue()}
|
||||
</dd>
|
||||
|
||||
<dd className="govuk-summary-list__actions">
|
||||
@@ -397,12 +356,12 @@ const mapDispatchToProps = (dispatch) => {
|
||||
updateCurrentSection: (whichSection) => {
|
||||
dispatch(setCurrentSection(whichSection));
|
||||
dispatch(setFormComplete("true"));
|
||||
},
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
const mapStateToProps = (state) => ({
|
||||
count: state.count,
|
||||
count: state.count
|
||||
});
|
||||
|
||||
export default connect(mapStateToProps, mapDispatchToProps)(BuildCheckRow);
|
||||
|
||||
@@ -12,15 +12,26 @@ import {
|
||||
setFormComplete
|
||||
} from "../../store/appealType/action";
|
||||
import BuildCheckRow from "./buildcheckrow";
|
||||
|
||||
import { generateAppealPDF } from "../../actions/services/documentService";
|
||||
import { sendCaseCompleteMessage } from "../../actions/services/portalService";
|
||||
import {
|
||||
bytesToSize,
|
||||
getThumbnailIconByExtension,
|
||||
updateLinks,
|
||||
getDocLink
|
||||
} from "../utils";
|
||||
import {
|
||||
dedupeFilesListByName,
|
||||
removeDuplicatesByKey
|
||||
} from "../../lib/newappeal/fileListHelpers";
|
||||
import {
|
||||
generateAppealPDFEffect,
|
||||
sendCaseCompleteMessageEffect
|
||||
} from "../../lib/newappeal/journeyEffects";
|
||||
import CheckSectionHeading from "./buildCheckSection/CheckSectionHeading";
|
||||
import ConfirmationCheckboxGroup from "./buildCheckSection/ConfirmationCheckboxGroup";
|
||||
import DocsOfflineNotice from "./buildCheckSection/DocsOfflineNotice";
|
||||
import FinalisingStatePanel from "./buildCheckSection/FinalisingStatePanel";
|
||||
import SectionReviewList from "./buildCheckSection/SectionReviewList";
|
||||
import SubmitActionsPanel from "./buildCheckSection/SubmitActionsPanel";
|
||||
|
||||
let BuildCheckSection = (props) => {
|
||||
useEffect(() => {
|
||||
@@ -44,6 +55,11 @@ let BuildCheckSection = (props) => {
|
||||
docsOffline
|
||||
} = props;
|
||||
|
||||
const legacyProps = props.props;
|
||||
const legacyAppealType = legacyProps.appealType;
|
||||
const legacyFormState = legacyProps.form;
|
||||
const legacyAccountDetails = legacyProps.accountDetails;
|
||||
|
||||
const parser = new DOMParser();
|
||||
var doc = parser.parseFromString(props.formXML, "text/xml");
|
||||
var titles = xpath.select(
|
||||
@@ -78,7 +94,7 @@ let BuildCheckSection = (props) => {
|
||||
|
||||
let buildAppealFilesArray = [];
|
||||
//console.log("attached docs: - ", buildAppealFilesArray);
|
||||
buildAppealFilesArray = props.props.appealType.fileList?.value[0] || [];
|
||||
buildAppealFilesArray = legacyAppealType.fileList?.value[0] || [];
|
||||
//let filesUploadObj = buildAppealFilesArray;
|
||||
// let filesUploadObj = props.appealType.fileList.hasOwnProperty("value")
|
||||
// ? props.appealType.fileList.value[0]
|
||||
@@ -97,28 +113,18 @@ let BuildCheckSection = (props) => {
|
||||
});
|
||||
//console.log(buildAppealFilesArray);
|
||||
|
||||
function removeDuplicates(arr, key) {
|
||||
const seen = new Set();
|
||||
return arr.filter((item) => {
|
||||
const value = item[key];
|
||||
if (seen.has(value)) {
|
||||
return false; // Duplicate found
|
||||
} else {
|
||||
seen.add(value); // Add value to the set
|
||||
return true; // Keep the item
|
||||
}
|
||||
});
|
||||
}
|
||||
buildAppealFilesArray = removeDuplicatesByKey(
|
||||
buildAppealFilesArray,
|
||||
"name"
|
||||
);
|
||||
|
||||
buildAppealFilesArray = removeDuplicates(buildAppealFilesArray, "name");
|
||||
|
||||
let pdfObj = props.props.form.appealForm.values;
|
||||
let pdfObj = legacyFormState.appealForm.values;
|
||||
|
||||
pdfObj = updateLinks(pdfObj);
|
||||
|
||||
Object.assign(pdfObj, {
|
||||
"filesList": buildAppealFilesArray,
|
||||
"containerID": props.props.accountDetails.containerID,
|
||||
"containerID": legacyAccountDetails.containerID,
|
||||
"casefolderID": props.appealType.caseReference.ticketnumber
|
||||
});
|
||||
|
||||
@@ -152,19 +158,16 @@ let BuildCheckSection = (props) => {
|
||||
const finaliseAppeal = async () => {
|
||||
//console.log("finalising appeal:", pdfObj);
|
||||
|
||||
const uniqueArray = pdfObj.filesList.filter(
|
||||
(value, index, self) =>
|
||||
index === self.findIndex((t) => t.name === value.name)
|
||||
);
|
||||
const uniqueArray = dedupeFilesListByName(pdfObj.filesList);
|
||||
|
||||
pdfObj.filesList = uniqueArray;
|
||||
pdfObj.locale = locale;
|
||||
|
||||
confirmSections
|
||||
? (setFinaliseAppealProcess(true),
|
||||
await generateAppealPDF(
|
||||
await generateAppealPDFEffect(
|
||||
pdfObj,
|
||||
props.props.accountDetails.containerID,
|
||||
legacyAccountDetails.containerID,
|
||||
props.appealType.caseReference.ticketnumber,
|
||||
router.query.appealtypes,
|
||||
pdfObj.filesList
|
||||
@@ -172,10 +175,10 @@ let BuildCheckSection = (props) => {
|
||||
)
|
||||
.then((data) => {
|
||||
console.log("have generated pdf:", data);
|
||||
sendCaseCompleteMessage(
|
||||
props.props.accountDetails.containerID,
|
||||
sendCaseCompleteMessageEffect(
|
||||
legacyAccountDetails.containerID,
|
||||
props.appealType.caseReference.ticketnumber,
|
||||
props.props.accountDetails.accountDetails
|
||||
legacyAccountDetails.accountDetails
|
||||
.pinswg_typeofinvolvement
|
||||
);
|
||||
})
|
||||
@@ -197,18 +200,15 @@ let BuildCheckSection = (props) => {
|
||||
try {
|
||||
setDownloadInProgress(true);
|
||||
|
||||
const uniqueArray = pdfObj.filesList.filter(
|
||||
(value, index, self) =>
|
||||
index === self.findIndex((t) => t.name === value.name)
|
||||
);
|
||||
const uniqueArray = dedupeFilesListByName(pdfObj.filesList);
|
||||
|
||||
pdfObj.filesList = uniqueArray;
|
||||
pdfObj.locale = locale;
|
||||
|
||||
const containerID =
|
||||
props.accountDetails?.containerID ||
|
||||
props.props?.accountDetails?.containerID ||
|
||||
props.props?.props?.accountDetails?.containerID;
|
||||
legacyProps?.accountDetails?.containerID ||
|
||||
legacyProps?.props?.accountDetails?.containerID;
|
||||
const caseRef =
|
||||
props?.currentView?.caseReference?.ticketnumber ||
|
||||
props?.appealType?.caseReference?.ticketnumber;
|
||||
@@ -221,7 +221,7 @@ let BuildCheckSection = (props) => {
|
||||
return;
|
||||
}
|
||||
|
||||
const pdfBlob = await generateAppealPDF(
|
||||
const pdfBlob = await generateAppealPDFEffect(
|
||||
pdfObj,
|
||||
containerID,
|
||||
caseRef,
|
||||
@@ -253,10 +253,8 @@ let BuildCheckSection = (props) => {
|
||||
<div className="govuk-grid-row" key={1222}>
|
||||
<div className="govuk-grid-column-full">
|
||||
<div>
|
||||
<h1 className="govuk-heading-m">
|
||||
Are these answers correct?
|
||||
</h1>
|
||||
<dl className="govuk-summary-list ">
|
||||
<CheckSectionHeading title="Are these answers correct?" />
|
||||
<SectionReviewList>
|
||||
{Object.keys(titles).map((key) => (
|
||||
<div key={key}>
|
||||
<h2 className="govuk-heading-m govuk-!-margin-top-9">
|
||||
@@ -274,7 +272,7 @@ let BuildCheckSection = (props) => {
|
||||
/>
|
||||
</div>
|
||||
))}
|
||||
</dl>
|
||||
</SectionReviewList>
|
||||
{/* <dl className="govuk-summary-list govuk-!-margin-bottom-9 at-summary-list">
|
||||
{buildAppealFilesArray.length > 0
|
||||
? buildAppealFilesArray.map((blob, i) => {
|
||||
@@ -329,120 +327,61 @@ let BuildCheckSection = (props) => {
|
||||
</dl> */}
|
||||
</div>
|
||||
{finaliseAppealProcess ? (
|
||||
<div className="">
|
||||
<h3 className="govuk-heading-m govuk-!-margin-top-9">
|
||||
{t("newappeal:new-appeal-finalising-heading")}
|
||||
</h3>
|
||||
<p className="govuk-body">
|
||||
{t("newappeal:new-appeal-finalising-label")}
|
||||
</p>
|
||||
<p className="govuk-body textloading">
|
||||
{t("newappeal:new-appeal-wait-label")}
|
||||
</p>
|
||||
</div>
|
||||
<FinalisingStatePanel
|
||||
heading={t("newappeal:new-appeal-finalising-heading")}
|
||||
label={t("newappeal:new-appeal-finalising-label")}
|
||||
waitLabel={t("newappeal:new-appeal-wait-label")}
|
||||
/>
|
||||
) : (
|
||||
<>
|
||||
<div className="govuk-form-group ">
|
||||
<fieldset className="govuk-fieldset">
|
||||
<div className="govuk-checkboxes govuk-checkboxes--small">
|
||||
<div className="govuk-checkboxes__item">
|
||||
<input
|
||||
name="pinswg_downloadAppealForm"
|
||||
id="pinswg_downloadAppealForm"
|
||||
type="checkbox"
|
||||
className="govuk-checkboxes__input"
|
||||
checked={downloadAppealForm}
|
||||
onChange={(e) => {
|
||||
setDownloadAppealForm(
|
||||
e.target.checked
|
||||
);
|
||||
}}
|
||||
/>
|
||||
<label
|
||||
className="govuk-label govuk-checkboxes__label"
|
||||
htmlFor="pinswg_downloadAppealForm"
|
||||
>
|
||||
{t(
|
||||
"newappeal:new-appeal-check-download-label"
|
||||
)}
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
<div className="govuk-checkboxes govuk-checkboxes--small">
|
||||
<div className="govuk-checkboxes__item">
|
||||
<input
|
||||
name="pinswg_checkconfirmation"
|
||||
id="pinswg_checkconfirmation"
|
||||
type="checkbox"
|
||||
className="govuk-checkboxes__input"
|
||||
value=""
|
||||
onChange={(e) => {
|
||||
setConfirmSections(
|
||||
!confirmSections
|
||||
);
|
||||
}}
|
||||
/>
|
||||
<label
|
||||
className="govuk-label govuk-checkboxes__label"
|
||||
htmlFor="pinswg_checkconfirmation"
|
||||
>
|
||||
{t(
|
||||
"newappeal:new-appeal-check-confirm-label"
|
||||
)}
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
</fieldset>
|
||||
<div>
|
||||
<p className="govuk-body">
|
||||
{t(
|
||||
"newappeal:new-appeal-check-confirm-paragraph-one"
|
||||
<ConfirmationCheckboxGroup
|
||||
downloadAppealForm={downloadAppealForm}
|
||||
onDownloadChange={(e) => {
|
||||
setDownloadAppealForm(e.target.checked);
|
||||
}}
|
||||
onConfirmChange={(e) => {
|
||||
setConfirmSections(!confirmSections);
|
||||
}}
|
||||
downloadLabel={t(
|
||||
"newappeal:new-appeal-check-download-label"
|
||||
)}
|
||||
confirmLabel={t(
|
||||
"newappeal:new-appeal-check-confirm-label"
|
||||
)}
|
||||
paragraphOne={t(
|
||||
"newappeal:new-appeal-check-confirm-paragraph-one"
|
||||
)}
|
||||
paragraphTwo={t(
|
||||
"newappeal:new-appeal-check-confirm-paragraph-two"
|
||||
)}
|
||||
paragraphTwoLink={
|
||||
<Link
|
||||
target="_blank"
|
||||
href={t(
|
||||
"newappeal:new-appeal-check-confirm-paragraph-two-link"
|
||||
)}
|
||||
</p>
|
||||
</div>
|
||||
<div>
|
||||
<p className="govuk-body">
|
||||
>
|
||||
{t(
|
||||
"newappeal:new-appeal-check-confirm-paragraph-two"
|
||||
)}{" "}
|
||||
<Link
|
||||
target="_blank"
|
||||
href={t(
|
||||
"newappeal:new-appeal-check-confirm-paragraph-two-link"
|
||||
)}
|
||||
>
|
||||
{t(
|
||||
"newappeal:new-appeal-check-confirm-paragraph-two-link"
|
||||
)}
|
||||
</Link>
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
"newappeal:new-appeal-check-confirm-paragraph-two-link"
|
||||
)}
|
||||
</Link>
|
||||
}
|
||||
/>
|
||||
|
||||
<div className="govuk-button-group">
|
||||
<SubmitActionsPanel>
|
||||
{ShowDocLinks ? (
|
||||
<>
|
||||
<div className="govuk-warning-text ">
|
||||
<span
|
||||
className="govuk-warning-text__icon"
|
||||
aria-hidden="true"
|
||||
>
|
||||
!
|
||||
</span>
|
||||
<strong className="govuk-warning-text__text govuk-!-margin-top-2">
|
||||
<span className="govuk-visually-hidden">
|
||||
Notice
|
||||
</span>
|
||||
<DocsOfflineNotice
|
||||
noticeText={t(
|
||||
"myportal:docsoffline-newappeal-label"
|
||||
)}
|
||||
returnLink={
|
||||
<Link className="govuk-link" href="/">
|
||||
{t(
|
||||
"myportal:docsoffline-newappeal-label"
|
||||
"newappeal:return-to-myportal-link"
|
||||
)}
|
||||
{" "}
|
||||
</strong>
|
||||
</div>{" "}
|
||||
<Link className="govuk-link" href="/">
|
||||
{t("newappeal:return-to-myportal-link")}
|
||||
</Link>
|
||||
</>
|
||||
</Link>
|
||||
}
|
||||
/>
|
||||
) : (
|
||||
<>
|
||||
<button
|
||||
@@ -468,7 +407,7 @@ let BuildCheckSection = (props) => {
|
||||
</a>
|
||||
</>
|
||||
)}
|
||||
</div>
|
||||
</SubmitActionsPanel>
|
||||
</>
|
||||
)}
|
||||
</div>
|
||||
|
||||
@@ -209,7 +209,7 @@ export default function BuildField(props) {
|
||||
uploadCount={uploadCount}
|
||||
setFileCount={setFileCount}
|
||||
setUploadCount={setUploadCount}
|
||||
props={props?.props?.props?.props}
|
||||
props={pageProps}
|
||||
/>
|
||||
</div>
|
||||
),
|
||||
|
||||
@@ -1,11 +1,30 @@
|
||||
import _ from "lodash";
|
||||
import useTranslation from "next-translate/useTranslation";
|
||||
import { useRouter } from "next/router";
|
||||
import xpath from "xpath";
|
||||
import BuildField from "./buildfield";
|
||||
import {
|
||||
parseRowOuterHTML,
|
||||
selectRowDataFieldContent,
|
||||
selectRowDataFieldName,
|
||||
selectRowDateEnd,
|
||||
selectRowDateStart,
|
||||
selectRowDocumentTypeCode,
|
||||
selectRowFieldType,
|
||||
selectRowHint,
|
||||
selectRowLabelDescriptions,
|
||||
selectRowMaxFieldLength,
|
||||
selectRowMaxSubField,
|
||||
selectRowParentField,
|
||||
selectRowParentFieldShowOnValue,
|
||||
selectRowRequiredDocumentLabel,
|
||||
selectRowRequiredDocumentValue,
|
||||
selectRowValidation
|
||||
} from "../../lib/newappeal/formDerivation";
|
||||
|
||||
export default function BuildRow(props) {
|
||||
let { t } = useTranslation();
|
||||
const legacyProps = props.props;
|
||||
const legacyPageProps = legacyProps.props;
|
||||
|
||||
const router = useRouter();
|
||||
const { locale } = router;
|
||||
@@ -20,56 +39,39 @@ export default function BuildRow(props) {
|
||||
uploadCount,
|
||||
setFileCount,
|
||||
completedUploadFilesCount,
|
||||
setCompletedUploadFilesCount,
|
||||
setCompletedUploadFilesCount
|
||||
} = props;
|
||||
|
||||
const parser = new DOMParser();
|
||||
|
||||
return (
|
||||
<div className="govuk-grid-column-full">
|
||||
{Object.keys(rowXML).map((key, index) => {
|
||||
var doc = parser.parseFromString(
|
||||
rowXML[key].outerHTML,
|
||||
"text/xml"
|
||||
);
|
||||
var doc = parseRowOuterHTML(rowXML[key].outerHTML);
|
||||
if (_.isEmpty(rowXML[key].innerHTML)) {
|
||||
("");
|
||||
} else {
|
||||
var rows = xpath.select("//label/@description", doc);
|
||||
var fieldtype = xpath.select("//@classid", doc);
|
||||
var validation = xpath.select("//@validation", doc);
|
||||
var maxFieldLength = xpath.select("//@maxFieldLength", doc);
|
||||
var maxSubField = xpath.select("//@maxsubfield", doc);
|
||||
var datafieldname = xpath.select("//@datafieldname", doc);
|
||||
var datafieldcontent = xpath.select(
|
||||
"//@datafieldcontent",
|
||||
doc
|
||||
);
|
||||
var parentField = xpath.select("//@parentField", doc);
|
||||
var rows = selectRowLabelDescriptions(doc);
|
||||
var fieldtype = selectRowFieldType(doc);
|
||||
var validation = selectRowValidation(doc);
|
||||
var maxFieldLength = selectRowMaxFieldLength(doc);
|
||||
var maxSubField = selectRowMaxSubField(doc);
|
||||
var datafieldname = selectRowDataFieldName(doc);
|
||||
var datafieldcontent = selectRowDataFieldContent(doc);
|
||||
var parentField = selectRowParentField(doc);
|
||||
|
||||
var parentFieldShowOnValue = xpath.select(
|
||||
"//@parentFieldShowOnValue",
|
||||
doc
|
||||
);
|
||||
var parentFieldShowOnValue =
|
||||
selectRowParentFieldShowOnValue(doc);
|
||||
|
||||
var requiredDocumentValue = xpath.select(
|
||||
"//@requiredDocumentValue",
|
||||
doc
|
||||
);
|
||||
var requiredDocumentValue =
|
||||
selectRowRequiredDocumentValue(doc);
|
||||
|
||||
var requiredDocumentLabel = xpath.select(
|
||||
"//@requiredDocumentLabel",
|
||||
doc
|
||||
);
|
||||
var requiredDocumentLabel =
|
||||
selectRowRequiredDocumentLabel(doc);
|
||||
|
||||
var documentTypeCode = xpath.select(
|
||||
"//@ishareDocumentCode",
|
||||
doc
|
||||
);
|
||||
var documentTypeCode = selectRowDocumentTypeCode(doc);
|
||||
|
||||
var hint = xpath.select("//label/@hint", doc);
|
||||
var dateStart = xpath.select("//@dateStart", doc);
|
||||
var dateEnd = xpath.select("//@dateEnd", doc);
|
||||
var hint = selectRowHint(doc);
|
||||
var dateStart = selectRowDateStart(doc);
|
||||
var dateEnd = selectRowDateEnd(doc);
|
||||
|
||||
hint = !_.isEmpty(hint) && hint[0].value;
|
||||
|
||||
@@ -128,7 +130,7 @@ export default function BuildRow(props) {
|
||||
key={key}
|
||||
props={props}
|
||||
picklistData={
|
||||
props.props.props.formData.pickListData
|
||||
legacyPageProps.formData.pickListData
|
||||
}
|
||||
mandatoryFieldsData={mandatoryFieldsData}
|
||||
documentTypeCode={documentTypeCode}
|
||||
@@ -158,7 +160,7 @@ export default function BuildRow(props) {
|
||||
key={key}
|
||||
props={props}
|
||||
picklistData={
|
||||
props.props.props.formData.pickListData
|
||||
legacyPageProps.formData.pickListData
|
||||
}
|
||||
mandatoryFieldsData={mandatoryFieldsData}
|
||||
hint={hint}
|
||||
@@ -168,13 +170,13 @@ export default function BuildRow(props) {
|
||||
maxFieldLength={maxFieldLength}
|
||||
dateStart={dateStart}
|
||||
dateEnd={dateEnd}
|
||||
setDocumentsList={props.props.setDocumentsList}
|
||||
setDocumentsList={legacyProps.setDocumentsList}
|
||||
documentList={
|
||||
props.props.appealType.documentList
|
||||
legacyProps.appealType.documentList
|
||||
}
|
||||
documentTypeCode={documentTypeCode}
|
||||
setFilesForAppeal={
|
||||
props.props.setFilesForAppeal
|
||||
legacyProps.setFilesForAppeal
|
||||
}
|
||||
maxSubField={maxSubField}
|
||||
setFileCount={setFileCount}
|
||||
|
||||
@@ -4,9 +4,16 @@ import { useRouter } from "next/router";
|
||||
import { useState } from "react";
|
||||
import { connect } from "react-redux";
|
||||
import { formValueSelector, reduxForm } from "redux-form";
|
||||
import xpath from "xpath";
|
||||
import { uploadFiles } from "../../actions/services/documentService";
|
||||
import { sendEmail } from "../../actions/services/notifyService";
|
||||
import { mergeWithExistingFilesList } from "../../lib/newappeal/fileListHelpers";
|
||||
import {
|
||||
uploadAppealFilesEffect,
|
||||
sendPartialSaveEmailEffect
|
||||
} from "../../lib/newappeal/journeyEffects";
|
||||
import {
|
||||
normalizeYesNoBooleans,
|
||||
removeNullKeys,
|
||||
stripInternalKeys
|
||||
} from "../../lib/newappeal/payloadCleanup";
|
||||
import {
|
||||
setCurrentSection,
|
||||
setDocumentsList,
|
||||
@@ -16,9 +23,22 @@ import {
|
||||
} from "../../store/appealType/action";
|
||||
import { getFormCollectionByID, getProgressObj, updateLinks } from "../utils";
|
||||
import BuildRow from "./buildrow";
|
||||
import {
|
||||
parseXml,
|
||||
selectAllTabTitleDescriptions,
|
||||
selectCurrentSectionRows,
|
||||
selectCurrentSectionTitleDescriptions,
|
||||
selectErrorFieldLabelDescription,
|
||||
selectFormTabs
|
||||
} from "../../lib/newappeal/formDerivation";
|
||||
|
||||
import { FieldsTranslations } from "../elements";
|
||||
import BuildProgress from "./buildprogress";
|
||||
import ErrorSummary from "./buildSection/ErrorSummary";
|
||||
import PrimaryActionButtons from "./buildSection/PrimaryActionButtons";
|
||||
import SaveStatusIndicator from "./buildSection/SaveStatusIndicator";
|
||||
import SectionHeader from "./buildSection/SectionHeader";
|
||||
import SidebarProgressPanel from "./buildSection/SidebarProgressPanel";
|
||||
|
||||
let BuildSection = (props) => {
|
||||
const [currentSectionSelected, setCurrentSectionSelected] = useState(1);
|
||||
@@ -52,29 +72,22 @@ 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;
|
||||
|
||||
const parser = new DOMParser();
|
||||
var doc = parser.parseFromString(props.formXML, "text/xml");
|
||||
var titles = xpath.select(
|
||||
"//form/tabs/tab[" + currentSection + " ]/labels/label/@description",
|
||||
doc
|
||||
);
|
||||
var rowXML = xpath.select(
|
||||
"/form/tabs/tab[" +
|
||||
currentSection +
|
||||
"]/columns//sections/section/rows/row",
|
||||
//"/form/tabs/tab/columns//sections/section/rows/row",
|
||||
doc
|
||||
);
|
||||
var doc = parseXml(props.formXML);
|
||||
var titles = selectCurrentSectionTitleDescriptions(doc, currentSection);
|
||||
var rowXML = selectCurrentSectionRows(doc, currentSection);
|
||||
|
||||
var formObjXML = xpath.select("/form/tabs", doc);
|
||||
var formObjXML = selectFormTabs(doc);
|
||||
|
||||
var titleList = xpath.select(
|
||||
"//form/tabs/tab[*]/labels/label/@description",
|
||||
doc
|
||||
);
|
||||
var titleList = selectAllTabTitleDescriptions(doc);
|
||||
|
||||
const progObj = getProgressObj(
|
||||
formXML,
|
||||
@@ -120,11 +133,11 @@ let BuildSection = (props) => {
|
||||
// _.includes(key, "pinswg_fileUpload") == true && delete dataObj[key];
|
||||
// }
|
||||
|
||||
await uploadFiles(
|
||||
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);
|
||||
@@ -167,12 +180,10 @@ let BuildSection = (props) => {
|
||||
|
||||
//console.log(buildAppealFilesArray);
|
||||
|
||||
buildAppealFilesArray = values.hasOwnProperty("filesList")
|
||||
? (buildAppealFilesArray.concat(values.filesList),
|
||||
buildAppealFilesArray.filter(function (item, idx) {
|
||||
return item.name;
|
||||
}))
|
||||
: buildAppealFilesArray;
|
||||
buildAppealFilesArray = mergeWithExistingFilesList(
|
||||
buildAppealFilesArray,
|
||||
values
|
||||
);
|
||||
|
||||
Object.assign(values, { "filesList": buildAppealFilesArray });
|
||||
|
||||
@@ -218,25 +229,15 @@ 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 + ")"
|
||||
});
|
||||
|
||||
updateBody = JSON.stringify(updateBody);
|
||||
updateBody = updateBody.replace(/:"Yes"/gm, `:true`);
|
||||
updateBody = updateBody.replace(/:"No"/gm, `:false`);
|
||||
updateBody = JSON.parse(updateBody);
|
||||
|
||||
Object.keys(updateBody).forEach((key) => {
|
||||
if (updateBody[key] === null) {
|
||||
delete updateBody[key];
|
||||
}
|
||||
if (key.indexOf("_") == 0) {
|
||||
delete updateBody[key];
|
||||
}
|
||||
});
|
||||
updateBody = normalizeYesNoBooleans(updateBody);
|
||||
updateBody = removeNullKeys(updateBody);
|
||||
updateBody = stripInternalKeys(updateBody);
|
||||
|
||||
//console.log(updateBody);
|
||||
|
||||
@@ -246,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=" +
|
||||
@@ -283,7 +284,7 @@ let BuildSection = (props) => {
|
||||
// );
|
||||
|
||||
sendSavedEmail == true &&
|
||||
sendEmail(
|
||||
sendPartialSaveEmailEffect(
|
||||
router.locale != "en" ? templateIdCY : templateId,
|
||||
emailAddress,
|
||||
personalisation,
|
||||
@@ -359,71 +360,38 @@ 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);
|
||||
};
|
||||
|
||||
let errorsobj = {};
|
||||
const ShowErrorHeader = (props) => {
|
||||
errorsobj = props.props.appealForm.syncErrors;
|
||||
errorsobj = _.keys(errorsobj);
|
||||
|
||||
const getErrorItems = () => {
|
||||
let errorsobj = _.keys(
|
||||
_.get(props, "props.form.appealForm.syncErrors", {})
|
||||
);
|
||||
const getErrorLabel = (whichField) => {
|
||||
var doc = parser.parseFromString(props.formXML, "text/xml");
|
||||
var errorFieldLabel = xpath.select(
|
||||
"//*[control/@id='" + whichField + "']//@description",
|
||||
doc
|
||||
var doc = parseXml(props.formXML);
|
||||
var errorFieldLabel = selectErrorFieldLabelDescription(
|
||||
doc,
|
||||
whichField
|
||||
);
|
||||
|
||||
return errorFieldLabel[0].value;
|
||||
};
|
||||
|
||||
const ShowErrors = () => {
|
||||
let errorList = [];
|
||||
for (let i = 0; i < errorsobj.length; ++i) {
|
||||
//get label from error key - search rowxml for id = errorobj
|
||||
let errorItems = [];
|
||||
for (let i = 0; i < errorsobj.length; ++i) {
|
||||
errorItems.push({
|
||||
"field": errorsobj[i],
|
||||
"label": getErrorLabel(errorsobj[i])
|
||||
});
|
||||
}
|
||||
|
||||
errorList.push(
|
||||
<li key={i}>
|
||||
<a href={"#" + errorsobj[i] + "_label"}>
|
||||
{" "}
|
||||
{getErrorLabel(errorsobj[i])}
|
||||
</a>
|
||||
</li>
|
||||
);
|
||||
}
|
||||
|
||||
return errorList;
|
||||
};
|
||||
|
||||
return !_.isEmpty(errorsobj) ? (
|
||||
<div
|
||||
className="govuk-error-summary"
|
||||
aria-labelledby="error-summary-title"
|
||||
role="alert"
|
||||
tabIndex="-1"
|
||||
data-module="govuk-error-summary"
|
||||
>
|
||||
<h2
|
||||
className="govuk-error-summary__title"
|
||||
id="error-summary-title"
|
||||
>
|
||||
The following fields have a problem :
|
||||
</h2>
|
||||
<div className="govuk-error-summary__body">
|
||||
<ul className="govuk-list govuk-error-summary__list">
|
||||
<ShowErrors />
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
) : (
|
||||
""
|
||||
);
|
||||
return errorItems;
|
||||
};
|
||||
|
||||
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)
|
||||
@@ -435,19 +403,12 @@ let BuildSection = (props) => {
|
||||
return (
|
||||
<div className="govuk-grid-row">
|
||||
<div className="govuk-grid-column-two-thirds wgForm ">
|
||||
<h1 className="govuk-heading-m ">
|
||||
{FieldsTranslations(titles[0].value)}
|
||||
</h1>
|
||||
<SectionHeader title={FieldsTranslations(titles[0].value)} />
|
||||
<form onSubmit={handleSubmit(onHandleSubmit)}>
|
||||
{hasErrors == true ? (
|
||||
<ShowErrorHeader
|
||||
hasErrors={hasErrors}
|
||||
props={props.props.form}
|
||||
formXML={formXML}
|
||||
/>
|
||||
) : (
|
||||
""
|
||||
)}
|
||||
<ErrorSummary
|
||||
hasErrors={hasErrors == true}
|
||||
errorItems={getErrorItems()}
|
||||
/>
|
||||
<BuildRow
|
||||
rowXML={rowXML}
|
||||
whichSection={props.whichSection}
|
||||
@@ -466,7 +427,7 @@ let BuildSection = (props) => {
|
||||
}
|
||||
/>
|
||||
|
||||
<div className="govuk-button-group">
|
||||
<PrimaryActionButtons>
|
||||
{props.sectionCount != currentSection ? (
|
||||
<>
|
||||
<button
|
||||
@@ -476,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);
|
||||
@@ -503,26 +463,19 @@ let BuildSection = (props) => {
|
||||
</button>
|
||||
{currentSection > 1 &&
|
||||
(savingStatus ? (
|
||||
<span className=" progress-save-active">
|
||||
{router.locale == "cy"
|
||||
? "Nôl data"
|
||||
: "Saving data"}
|
||||
<img
|
||||
className="data-loading-icon"
|
||||
src="/assets/images/loading.gif"
|
||||
alt={
|
||||
router.locale == "cy"
|
||||
? "Nôl data"
|
||||
: "Saving data"
|
||||
}
|
||||
/>
|
||||
</span>
|
||||
<SaveStatusIndicator
|
||||
text={
|
||||
router.locale == "cy"
|
||||
? "Nôl data"
|
||||
: "Saving data"
|
||||
}
|
||||
/>
|
||||
) : (
|
||||
<button
|
||||
className="govuk-button progress-save "
|
||||
onClick={() => {
|
||||
let valuesObj =
|
||||
props.props.form[props.form]
|
||||
legacyFormState[props.form]
|
||||
.values || {};
|
||||
|
||||
// console.log(
|
||||
@@ -572,26 +525,19 @@ let BuildSection = (props) => {
|
||||
{t("common:submit-button")}{" "}
|
||||
</button>
|
||||
{savingStatus ? (
|
||||
<span className=" progress-save-active">
|
||||
{router.locale == "cy"
|
||||
? "Nôl data"
|
||||
: "Saving data"}
|
||||
<img
|
||||
className="data-loading-icon"
|
||||
src="/assets/images/loading.gif"
|
||||
alt={
|
||||
router.locale == "cy"
|
||||
? "Nôl data"
|
||||
: "Saving data"
|
||||
}
|
||||
/>
|
||||
</span>
|
||||
<SaveStatusIndicator
|
||||
text={
|
||||
router.locale == "cy"
|
||||
? "Nôl data"
|
||||
: "Saving data"
|
||||
}
|
||||
/>
|
||||
) : (
|
||||
<button
|
||||
className="govuk-button progress-save "
|
||||
onClick={() => {
|
||||
let valuesObj =
|
||||
props.props.form[props.form]
|
||||
legacyFormState[props.form]
|
||||
.values || {};
|
||||
|
||||
// console.log(
|
||||
@@ -631,29 +577,25 @@ let BuildSection = (props) => {
|
||||
) : (
|
||||
""
|
||||
)} */}
|
||||
</div>
|
||||
</PrimaryActionButtons>
|
||||
</form>
|
||||
</div>
|
||||
<div className="govuk-grid-column-one-third">
|
||||
<div className="at-nav-container">
|
||||
{/* <span>
|
||||
Last section is {lastIndex} - {currentSection}
|
||||
</span> */}
|
||||
<BuildProgress
|
||||
progObj={progObj}
|
||||
props={props}
|
||||
titleList={titleList}
|
||||
documentListObj={documentListObj}
|
||||
formObjXML={formXML}
|
||||
mandatoryFieldsData={mandatoryFieldsData}
|
||||
currentSection={currentSection}
|
||||
initialValues={props.initialValues}
|
||||
setCurrentSection={setCurrentSection}
|
||||
/>
|
||||
|
||||
<hr className="govuk-section-break govuk-section-break--m govuk-section-break--visible" />
|
||||
</div>
|
||||
</div>
|
||||
<SidebarProgressPanel>
|
||||
{/* <span>
|
||||
Last section is {lastIndex} - {currentSection}
|
||||
</span> */}
|
||||
<BuildProgress
|
||||
progObj={progObj}
|
||||
props={props}
|
||||
titleList={titleList}
|
||||
documentListObj={documentListObj}
|
||||
formObjXML={formXML}
|
||||
mandatoryFieldsData={mandatoryFieldsData}
|
||||
currentSection={currentSection}
|
||||
initialValues={props.initialValues}
|
||||
setCurrentSection={setCurrentSection}
|
||||
/>
|
||||
</SidebarProgressPanel>
|
||||
</div>
|
||||
);
|
||||
};
|
||||
|
||||
@@ -4,14 +4,19 @@ import { useRouter } from "next/router";
|
||||
import { useEffect } from "react";
|
||||
import { connect } from "react-redux";
|
||||
import { formValueSelector } from "redux-form";
|
||||
import { sendEmail } from "../../actions/services/notifyService";
|
||||
import { sendCompletionEmailEffect } from "../../lib/newappeal/journeyEffects";
|
||||
import { normalizeYesNoBooleans } from "../../lib/newappeal/payloadCleanup";
|
||||
import { setCurrentSection } from "../../store/appealType/action";
|
||||
import { getFormCollectionByID } from "../utils";
|
||||
|
||||
let CompleteAppeal = (props) => {
|
||||
const legacyProps = props.props;
|
||||
const legacyFormState = legacyProps.form;
|
||||
const legacyAccountDetails = legacyProps.accountDetails;
|
||||
|
||||
useEffect(() => {
|
||||
let incidentId = props.appealType.caseReference.incidentid;
|
||||
let updateBody = props.props.form.appealForm.values;
|
||||
let updateBody = legacyFormState.appealForm.values;
|
||||
|
||||
let appTypeCollection = getFormCollectionByID(
|
||||
props.appealType.appealTypeID
|
||||
@@ -23,7 +28,7 @@ let CompleteAppeal = (props) => {
|
||||
|
||||
Object.assign(updateBody, {
|
||||
"pinswg_Appellant@odata.bind":
|
||||
"/contacts(" + props.props.accountDetails.loggedinUserId + ")",
|
||||
"/contacts(" + legacyAccountDetails.loggedinUserId + ")",
|
||||
"pinswg_LocalPlanningAuthority@odata.bind":
|
||||
"/accounts(" + props.appealType.appealLPA + ")",
|
||||
"pinswg_name": props.appealType.caseReference.ticketnumber,
|
||||
@@ -31,10 +36,7 @@ let CompleteAppeal = (props) => {
|
||||
"/incidents(" + incidentId + ")"
|
||||
});
|
||||
|
||||
updateBody = JSON.stringify(updateBody);
|
||||
updateBody = updateBody.replace(/:"Yes"/gm, `:true`);
|
||||
updateBody = updateBody.replace(/:"No"/gm, `:false`);
|
||||
updateBody = JSON.parse(updateBody);
|
||||
updateBody = normalizeYesNoBooleans(updateBody);
|
||||
|
||||
let updateFormCollection = appTypeCollection.LogicalCollectionName;
|
||||
let primaryAttribute = appTypeCollection.PrimaryIdAttribute;
|
||||
@@ -46,13 +48,18 @@ let CompleteAppeal = (props) => {
|
||||
: "618e0463-b092-4733-a024-bf8a3bbde808";
|
||||
|
||||
const reference = "PEDW-COMPLETE" + isWelsh && "-CY";
|
||||
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,
|
||||
"linkExpiry": 10 * 60
|
||||
};
|
||||
sendEmail(templateId, emailAddress, personalisation, reference);
|
||||
sendCompletionEmailEffect(
|
||||
templateId,
|
||||
emailAddress,
|
||||
personalisation,
|
||||
reference
|
||||
);
|
||||
|
||||
// sendCaseCompleteMessage(
|
||||
// props.props.accountDetails.containerID,
|
||||
@@ -65,12 +72,12 @@ let CompleteAppeal = (props) => {
|
||||
window.scrollTo({ top: 0, behavior: "smooth" });
|
||||
}, [
|
||||
props.appealType.caseReference,
|
||||
props.props.form.appealForm.values,
|
||||
legacyFormState.appealForm.values,
|
||||
props.appealType.appealLPA,
|
||||
props.props.accountDetails.loggedinUserId,
|
||||
legacyAccountDetails.loggedinUserId,
|
||||
props.appealType.appealTypeID,
|
||||
props.props.accountDetails.loggedinUserEmail,
|
||||
props.props.accountDetails.containerID
|
||||
legacyAccountDetails.loggedinUserEmail,
|
||||
legacyAccountDetails.containerID
|
||||
]);
|
||||
|
||||
let { t } = useTranslation();
|
||||
|
||||
@@ -378,6 +378,7 @@ let CreateCase = (props) => {
|
||||
|
||||
const router = useRouter();
|
||||
const { locale } = router;
|
||||
const isWelsh = router.locale == "cy";
|
||||
|
||||
const { LPAData, onSubmit, handleSubmit, formData } = props;
|
||||
|
||||
@@ -399,16 +400,17 @@ let CreateCase = (props) => {
|
||||
event.preventDefault();
|
||||
|
||||
var appTypeCollection = values.appealTypes;
|
||||
const selectedAppealType = values.appealTypes;
|
||||
const confirmHASCAS = values.confirmHASCAS;
|
||||
|
||||
formStep == 0 && setFormStep(1);
|
||||
|
||||
whichAppealType =
|
||||
values.appealTypes == "846040004" && values.confirmHASCAS == "true"
|
||||
selectedAppealType == "846040004" && confirmHASCAS == "true"
|
||||
? "846040004"
|
||||
: values.appealTypes == "846040004" &&
|
||||
values.confirmHASCAS == "false"
|
||||
: selectedAppealType == "846040004" && confirmHASCAS == "false"
|
||||
? "846040000"
|
||||
: values.appealTypes;
|
||||
: selectedAppealType;
|
||||
|
||||
var whichAppealType = whichAppealType;
|
||||
|
||||
@@ -435,15 +437,17 @@ let CreateCase = (props) => {
|
||||
// values,
|
||||
// props.containerID
|
||||
// )
|
||||
const selectedLpaName = props.LPAData.LPAData.value.filter((obj) => {
|
||||
return obj.accountid === values.lpaTypes;
|
||||
})[0].name;
|
||||
|
||||
createNewCaseBlob(
|
||||
appTypeCollection.appealTypeID,
|
||||
values.lpaTypes,
|
||||
props.loggedInUser,
|
||||
values,
|
||||
props.containerID,
|
||||
props.LPAData.LPAData.value.filter((obj) => {
|
||||
return obj.accountid === values.lpaTypes;
|
||||
})[0].name
|
||||
selectedLpaName
|
||||
)
|
||||
.then((data) => {
|
||||
router.replace(
|
||||
@@ -477,7 +481,7 @@ let CreateCase = (props) => {
|
||||
// }
|
||||
// );
|
||||
};
|
||||
const yesNo = router.locale == "cy" ? ["Ydw", "Na"] : ["Yes", "No"];
|
||||
const yesNo = isWelsh ? ["Ydw", "Na"] : ["Yes", "No"];
|
||||
|
||||
var parentField = "appealTypes",
|
||||
formProps = props.whichForm,
|
||||
|
||||
Reference in New Issue
Block a user