uat fixes
This commit is contained in:
@@ -611,7 +611,7 @@ let AboutYou = (props) => {
|
||||
name={"pinswg_appellantphonenumber"}
|
||||
id={"pinswg_appellantphonenumber"}
|
||||
component={RenderTextfield}
|
||||
type="number"
|
||||
type="text"
|
||||
className="govuk-input govuk-input--width-20"
|
||||
validate={[required, phoneNumber]}
|
||||
label={t(
|
||||
@@ -794,7 +794,7 @@ let AboutYou = (props) => {
|
||||
name={"pinswg_agentphonenumber"}
|
||||
id={"pinswg_agentphonenumber"}
|
||||
component={RenderTextfield}
|
||||
type="number"
|
||||
type="text"
|
||||
className="govuk-input govuk-input--width-20"
|
||||
validate={[required, phoneNumber]}
|
||||
label={t(
|
||||
|
||||
@@ -130,27 +130,29 @@ let BuildCheckSection = (props) => {
|
||||
};
|
||||
|
||||
const finaliseAppeal = async () => {
|
||||
setFinaliseAppealProcess(true);
|
||||
//console.log("finalising appeal:");
|
||||
await generateAppealPDF(
|
||||
pdfObj,
|
||||
props.props.accountDetails.containerID,
|
||||
props.appealType.caseReference.ticketnumber,
|
||||
router.query.appealtypes,
|
||||
pdfObj.filesList
|
||||
// props.appealType.fileList
|
||||
)
|
||||
.then((data) => {
|
||||
console.log("have generated pdf:", data);
|
||||
sendCaseCompleteMessage(
|
||||
props.props.accountDetails.containerID,
|
||||
props.appealType.caseReference.ticketnumber
|
||||
);
|
||||
})
|
||||
.then(() => {
|
||||
//console.log("have sent complete message :");
|
||||
setCurrentSection(9999);
|
||||
});
|
||||
confirmSections
|
||||
? (setFinaliseAppealProcess(true),
|
||||
await generateAppealPDF(
|
||||
pdfObj,
|
||||
props.props.accountDetails.containerID,
|
||||
props.appealType.caseReference.ticketnumber,
|
||||
router.query.appealtypes,
|
||||
pdfObj.filesList
|
||||
// props.appealType.fileList
|
||||
)
|
||||
.then((data) => {
|
||||
console.log("have generated pdf:", data);
|
||||
sendCaseCompleteMessage(
|
||||
props.props.accountDetails.containerID,
|
||||
props.appealType.caseReference.ticketnumber
|
||||
);
|
||||
})
|
||||
.then(() => {
|
||||
//console.log("have sent complete message :");
|
||||
setCurrentSection(9999);
|
||||
}))
|
||||
: setConfirmSections(false);
|
||||
};
|
||||
|
||||
return (
|
||||
|
||||
@@ -129,6 +129,7 @@ export default function BuildField(props) {
|
||||
validation={props.validation}
|
||||
dateStart={props.dateStart}
|
||||
dateEnd={props.dateEnd}
|
||||
hint={props.hint}
|
||||
/>
|
||||
);
|
||||
break;
|
||||
|
||||
@@ -313,6 +313,26 @@ let BuildSection = (props) => {
|
||||
|
||||
// Object.assign(values, { "filesList": buildAppealFilesArray });
|
||||
|
||||
// Function to parse a specific key (e.g., 'price') in an array of objects
|
||||
const parseFloatForKeyInObject = (obj, key) => {
|
||||
// Check if the object has the key and the value can be parsed as a float
|
||||
if (
|
||||
obj.hasOwnProperty(key) &&
|
||||
typeof obj[key] === "string" &&
|
||||
!isNaN(obj[key].trim())
|
||||
) {
|
||||
// Parse the value as a float and update the object
|
||||
return { ...obj, [key]: parseFloat(obj[key]) };
|
||||
}
|
||||
// If the key doesn't exist or value can't be parsed, return the original object
|
||||
return obj;
|
||||
};
|
||||
|
||||
valuesObj = parseFloatForKeyInObject(
|
||||
valuesObj,
|
||||
"pinswg_areaofsiteinhectaresdec"
|
||||
);
|
||||
|
||||
delete valuesObj["_pinswg_appellant_value"];
|
||||
//console.log("has errors:", props.invalid);
|
||||
props.invalid == false && updateCaseProgress(valuesObj, false, false);
|
||||
@@ -440,53 +460,56 @@ let BuildSection = (props) => {
|
||||
false,
|
||||
false
|
||||
);
|
||||
// currentSection == 1 &&
|
||||
// setCurrentSection(1);
|
||||
}}
|
||||
>
|
||||
{t("common:continue-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>
|
||||
) : (
|
||||
<button
|
||||
className="govuk-button progress-save "
|
||||
onClick={() => {
|
||||
let valuesObj =
|
||||
props.props.form[props.form]
|
||||
.values || {};
|
||||
{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>
|
||||
) : (
|
||||
<button
|
||||
className="govuk-button progress-save "
|
||||
onClick={() => {
|
||||
let valuesObj =
|
||||
props.props.form[props.form]
|
||||
.values || {};
|
||||
|
||||
// console.log(
|
||||
// "valuesobj:",
|
||||
// valuesObj
|
||||
// );
|
||||
// console.log(
|
||||
// "valuesobj:",
|
||||
// valuesObj
|
||||
// );
|
||||
|
||||
delete valuesObj[
|
||||
"_pinswg_appellant_value"
|
||||
];
|
||||
delete valuesObj[
|
||||
"_pinswg_appellant_value"
|
||||
];
|
||||
|
||||
// console.log("on save:", valuesObj);
|
||||
updateCaseProgress(
|
||||
valuesObj,
|
||||
true,
|
||||
true
|
||||
);
|
||||
}}
|
||||
>
|
||||
{t("common:save-exit-button")}
|
||||
</button>
|
||||
)}
|
||||
// console.log("on save:", valuesObj);
|
||||
updateCaseProgress(
|
||||
valuesObj,
|
||||
true,
|
||||
true
|
||||
);
|
||||
}}
|
||||
>
|
||||
{t("common:save-exit-button")}
|
||||
</button>
|
||||
))}
|
||||
{/* <span
|
||||
onClick={() =>
|
||||
setCurrentSection(sectionCount + 1)
|
||||
@@ -669,6 +692,29 @@ const mapDispatchToProps = (dispatch) => {
|
||||
|
||||
const selector = formValueSelector("appealForm"); // <-- same as form name
|
||||
|
||||
const validate = (values) => {
|
||||
const errors = {};
|
||||
|
||||
const strippedHtml = (htmlStr) => {
|
||||
return htmlStr.replace(/(<([^>]+)>)/gi, "").trim();
|
||||
};
|
||||
|
||||
if (values.hasOwnProperty("pinswg_attachsoc")) {
|
||||
if (values.pinswg_attachsoc == "false") {
|
||||
if (values.hasOwnProperty("pinswg_statementofcase")) {
|
||||
if (strippedHtml(values.pinswg_statementofcase).length == 0)
|
||||
errors.pinswg_statementofcase =
|
||||
"Enter submit a statement of case or select Yes to attach a separate Statement of Case Document";
|
||||
} else {
|
||||
errors.pinswg_statementofcase =
|
||||
"Enter submit a statement of case or select Yes to attach a separate Statement of Case Document";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return errors;
|
||||
};
|
||||
|
||||
export default connect(
|
||||
mapStateToProps,
|
||||
mapDispatchToProps
|
||||
@@ -677,5 +723,6 @@ export default connect(
|
||||
form: "appealForm",
|
||||
destroyOnUnmount: false,
|
||||
enableReinitialize: true, // this is needed!!
|
||||
validate,
|
||||
})(BuildSection)
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user