fix for new appeal and reps updates

This commit is contained in:
2024-12-04 19:30:18 +00:00
parent 47c2c68ed0
commit b668f323fe
15 changed files with 951 additions and 854 deletions
+14 -7
View File
@@ -1675,9 +1675,11 @@ export const FieldsTranslations = (label) => {
let labelTrans =
router.locale == "cy"
? jsonpath('$..[?(@.value=="' + label + '")].value_cy', formObj)
? jsonpath('$..[?(@.value=="' + label + '")].value_cy', formObj)[0]
: label;
//labelTrans = labelTrans.length > 1 ? labelTrans[0] : labelTrans;
return labelTrans;
};
@@ -1749,7 +1751,7 @@ const rejectStyle = {
};
const RenderFileUpload = (field) => {
const files = field.input.value;
let files = field.input.value;
let { t } = useTranslation();
const style = useMemo(
@@ -1912,6 +1914,10 @@ const RenderFileUpload = (field) => {
field.input.onChange(newFilesArr);
};
function removeEmptyObjects(arr) {
return arr.filter((obj) => Object.keys(obj).length > 0);
}
return (
<>
<Dropzone
@@ -1971,10 +1977,11 @@ const RenderFileUpload = (field) => {
{field.meta.touched && field.meta.error && (
<span className="error">{field.meta.error}</span>
)}
{}
{files && Array.isArray(files) && (
<>
{files.length > 0 && <h4>New files</h4>}
{/* {(files = removeEmptyObjects(files))} */}
<br />
{files.map(
(file, i) =>
typeof file.name != "undefined" && (
@@ -2096,7 +2103,7 @@ const RenderSubFields = ({ fields, meta: { touched, error }, ...custom }) => {
{fields.map((member, index) => (
<div key={index}>
<h4>
{subTitle == "owners" ? "Owners" : "Tenant"} #
{subTitle == "owners" ? "Owner" : "Tenant"} #
{index + 1}
</h4>
@@ -2109,7 +2116,7 @@ const RenderSubFields = ({ fields, meta: { touched, error }, ...custom }) => {
validate={[checkValue]}
label={
subTitle == "owners"
? "Owners name"
? "Owner name"
: "Tenant name"
}
className="govuk-input govuk-input--width-10"
@@ -2145,7 +2152,7 @@ const RenderSubFields = ({ fields, meta: { touched, error }, ...custom }) => {
onClick={() => fields.push({})}
>
{subTitle == "owners"
? "Add Owners"
? "Add Owner"
: t("newappeal:new-appeal-add-tenant-label")}
</button>
)}