diff --git a/components/newappeal/aboutyou.js b/components/newappeal/aboutyou.js
index f2c1d6d7..255c6aee 100644
--- a/components/newappeal/aboutyou.js
+++ b/components/newappeal/aboutyou.js
@@ -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 && (
<>
{t("newappeal:about-you-appellant-contact-details")}
@@ -668,7 +671,7 @@ let AboutYou = (props) => {
/>
>
)}
- {appellantAgentValue == "846040001" && (
+ {isAgentSelected && (
<>
{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)
);
diff --git a/components/newappeal/createCase.js b/components/newappeal/createCase.js
index c9dba63a..fa9f9822 100644
--- a/components/newappeal/createCase.js
+++ b/components/newappeal/createCase.js
@@ -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,
diff --git a/context/refactor-tracker.md b/context/refactor-tracker.md
index 312abc25..5d1bc27c 100644
--- a/context/refactor-tracker.md
+++ b/context/refactor-tracker.md
@@ -74,7 +74,7 @@ Status: COMPLETE
### Slice 8 — Start Flow Cleanup (CreateCase / AboutYou)
-Status: NOT STARTED
+Status: COMPLETE
---