included emdash in doc upload validation

This commit is contained in:
2026-02-26 13:04:28 +00:00
parent b39ed0fd8c
commit cfe732f299
6 changed files with 131 additions and 126 deletions
+13 -12
View File
@@ -13,7 +13,7 @@ const PaginationControl = (props) => {
currentPage, currentPage,
spinnerState, spinnerState,
getDocumentResults, getDocumentResults,
setCurrentPage, setCurrentPage
} = props; } = props;
let { t } = useTranslation(); let { t } = useTranslation();
@@ -45,7 +45,7 @@ const PaginationControl = (props) => {
const range = { const range = {
start: Math.round(currentPage - delta / 2), start: Math.round(currentPage - delta / 2),
end: Math.round(currentPage + delta / 2), end: Math.round(currentPage + delta / 2)
}; };
if (range.start - 1 === 1 || range.end + 1 === pageCount) { if (range.start - 1 === 1 || range.end + 1 === pageCount) {
@@ -89,7 +89,7 @@ const PaginationControl = (props) => {
<span <span
className="govuk-body govuk-link govuk-!-font-weight-bold govuk-link--no-underline activePaginationItem leftTextButton" className="govuk-body govuk-link govuk-!-font-weight-bold govuk-link--no-underline activePaginationItem leftTextButton"
onClick={() => { onClick={() => {
spinnerState(), (spinnerState(),
setCurrentPage( setCurrentPage(
props.currentView.currentPage - props.currentView.currentPage -
1 1
@@ -99,7 +99,7 @@ const PaginationControl = (props) => {
1, 1,
orderBy, orderBy,
fieldSort fieldSort
); ));
}} }}
> >
{t("common:previous-link-button")} {t("common:previous-link-button")}
@@ -132,12 +132,12 @@ const PaginationControl = (props) => {
key={i} key={i}
onClick={() => { onClick={() => {
spinnerState(); spinnerState();
setCurrentPage(e), (setCurrentPage(e),
getDocumentResults( getDocumentResults(
e, e,
orderBy, orderBy,
fieldSort fieldSort
); ));
}} }}
> >
{e} {e}
@@ -150,7 +150,7 @@ const PaginationControl = (props) => {
<span <span
className="govuk-body govuk-link govuk-!-font-weight-bold govuk-link--no-underline activePaginationItem rightTextButton" className="govuk-body govuk-link govuk-!-font-weight-bold govuk-link--no-underline activePaginationItem rightTextButton"
onClick={() => { onClick={() => {
spinnerState(), (spinnerState(),
setCurrentPage( setCurrentPage(
props.currentView.currentPage + props.currentView.currentPage +
1 1
@@ -160,7 +160,7 @@ const PaginationControl = (props) => {
1, 1,
orderBy, orderBy,
fieldSort fieldSort
); ));
}} }}
> >
{t("common:next-link-button")} {t("common:next-link-button")}
@@ -174,8 +174,9 @@ const PaginationControl = (props) => {
</div> </div>
</div> </div>
<div className="govuk-body-s mobilePageCount"> <div className="govuk-body-s mobilePageCount">
{t("common:pages-label")} {currentPage}{" "} {t("common:pages-label")}{" "}
{t("common:of-label")} {pagesCount} {props.currentView.currentPage} {t("common:of-label")}{" "}
{pagesCount}
</div> </div>
</div> </div>
)} )}
@@ -185,7 +186,7 @@ const PaginationControl = (props) => {
const mapStateToProps = (state) => { const mapStateToProps = (state) => {
return { return {
currentView: state.currentView, currentView: state.currentView
}; };
}; };
@@ -193,7 +194,7 @@ const mapDispatchToProps = (dispatch) => {
return { return {
setCurrentPage: (currentPage) => { setCurrentPage: (currentPage) => {
dispatch(setCurrentPage(currentPage)); dispatch(setCurrentPage(currentPage));
}, }
}; };
}; };
@@ -13,7 +13,7 @@ import {
deleteBlob, deleteBlob,
deleteRepBlob, deleteRepBlob,
getFilesFromBlobHashed, getFilesFromBlobHashed,
getFilesFromBlobproxy, getFilesFromBlobproxy
} from "../../../actions"; } from "../../../actions";
const LoadingMessage = () => <div>Loading the editor...</div>; const LoadingMessage = () => <div>Loading the editor...</div>;
@@ -23,7 +23,7 @@ const ReactQuill = dynamic(
() => import("react-quill-new").then((mod) => mod.default), () => import("react-quill-new").then((mod) => mod.default),
{ {
ssr: false, ssr: false,
loading: () => <LoadingMessage />, // This is valid as long as it's a valid React component loading: () => <LoadingMessage /> // This is valid as long as it's a valid React component
} }
); );
import { useDispatch } from "react-redux"; // Import the useDispatch hook import { useDispatch } from "react-redux"; // Import the useDispatch hook
@@ -35,13 +35,13 @@ import {
parseISO, parseISO,
subDays, subDays,
subMonths, subMonths,
subYears, subYears
} from "date-fns"; } from "date-fns";
import { import {
bytesToSize, bytesToSize,
getThumbnailIconByExtension, getThumbnailIconByExtension,
updateLinks, updateLinks
} from "../../utils"; } from "../../utils";
import { useRouter } from "next/router"; import { useRouter } from "next/router";
@@ -537,18 +537,19 @@ export const RenderPickList = ({
? optionsArr[key] == "Questionnaire" ? optionsArr[key] == "Questionnaire"
? "Holiadur" ? "Holiadur"
: optionsArr[key] == "Statement" : optionsArr[key] == "Statement"
? "Datganiad" ? "Datganiad"
: optionsArr[key] == : optionsArr[key] ==
"Final comments" "Final comments"
? "Sylwadau terfynol" ? "Sylwadau terfynol"
: optionsArr[key] == : optionsArr[key] ==
"Written representations" "Written representations"
? "Sylwadau ysgrifenedig" ? "Sylwadau ysgrifenedig"
: optionsArr[key] == "Inquiry" : optionsArr[key] == "Inquiry"
? "Ymchwiliad" ? "Ymchwiliad"
: optionsArr[key] == "Hearing" : optionsArr[key] ==
? "Gwrandawiad" "Hearing"
: optionsArr[key] ? "Gwrandawiad"
: optionsArr[key]
: optionsArr[key]} : optionsArr[key]}
</option> </option>
); );
@@ -627,31 +628,31 @@ export const RenderDatePicker = ({
startDateArr == 0 startDateArr == 0
? new Date() ? new Date()
: startDateArr[0] == "-" : startDateArr[0] == "-"
? startDateArr[2] == "y" ? startDateArr[2] == "y"
? subYears(new Date(), startDateArr[1]) ? subYears(new Date(), startDateArr[1])
: startDateArr[2] == "m"
? subMonths(new Date(), startDateArr[1])
: subDays(new Date(), startDateArr[1])
: startDateArr[2] == "y"
? addYears(new Date(), startDateArr[1])
: startDateArr[2] == "m" : startDateArr[2] == "m"
? subMonths(new Date(), startDateArr[1]) ? addMonths(new Date(), startDateArr[1])
: subDays(new Date(), startDateArr[1]) : addDays(new Date(), startDateArr[1]);
: startDateArr[2] == "y"
? addYears(new Date(), startDateArr[1])
: startDateArr[2] == "m"
? addMonths(new Date(), startDateArr[1])
: addDays(new Date(), startDateArr[1]);
var maxDate = var maxDate =
endDateArr == 0 endDateArr == 0
? new Date() ? new Date()
: startDateArr[0] == "-" : startDateArr[0] == "-"
? startDateArr[2] == "y" ? startDateArr[2] == "y"
? subYears(new Date(), startDateArr[1]) ? subYears(new Date(), startDateArr[1])
: startDateArr[2] == "m"
? subMonths(new Date(), startDateArr[1])
: subDays(new Date(), startDateArr[1])
: startDateArr[2] == "y"
? addYears(new Date(), startDateArr[1])
: startDateArr[2] == "m" : startDateArr[2] == "m"
? subMonths(new Date(), startDateArr[1]) ? addMonths(new Date(), startDateArr[1])
: subDays(new Date(), startDateArr[1]) : addDays(new Date(), startDateArr[1]);
: startDateArr[2] == "y"
? addYears(new Date(), startDateArr[1])
: startDateArr[2] == "m"
? addMonths(new Date(), startDateArr[1])
: addDays(new Date(), startDateArr[1]);
return ( return (
<> <>
@@ -739,8 +740,8 @@ export const RenderMultiline = ({
[{ "header": [1, 2, false] }], [{ "header": [1, 2, false] }],
["bold", "italic", "underline", "blockquote"], ["bold", "italic", "underline", "blockquote"],
[{ "list": "ordered" }, { "list": "bullet" }], [{ "list": "ordered" }, { "list": "bullet" }],
["clean"], ["clean"]
], ]
}; };
return ( return (
@@ -805,8 +806,8 @@ export const RenderRichMultiline = ({
[{ "header": [1, 2, false] }], [{ "header": [1, 2, false] }],
["bold", "italic", "underline", "blockquote"], ["bold", "italic", "underline", "blockquote"],
[{ "list": "ordered" }, { "list": "bullet" }], [{ "list": "ordered" }, { "list": "bullet" }],
["clean"], ["clean"]
], ]
}; };
return ( return (
@@ -874,19 +875,19 @@ const baseStyle = {
borderStyle: "dashed", borderStyle: "dashed",
backgroundColor: "#fafafa", backgroundColor: "#fafafa",
color: "#bdbdbd", color: "#bdbdbd",
transition: "border .3s ease-in-out", transition: "border .3s ease-in-out"
}; };
const activeStyle = { const activeStyle = {
borderColor: "#2196f3", borderColor: "#2196f3"
}; };
const acceptStyle = { const acceptStyle = {
borderColor: "#00e676", borderColor: "#00e676"
}; };
const rejectStyle = { const rejectStyle = {
borderColor: "#ff1744", borderColor: "#ff1744"
}; };
export const RenderFileUpload = (field) => { export const RenderFileUpload = (field) => {
@@ -897,7 +898,7 @@ export const RenderFileUpload = (field) => {
const style = useMemo( const style = useMemo(
() => ({ () => ({
...baseStyle, ...baseStyle
// ...(isDragActive ? activeStyle : {}), // ...(isDragActive ? activeStyle : {}),
// ...(isDragAccept ? acceptStyle : {}), // ...(isDragAccept ? acceptStyle : {}),
// ...(isDragReject ? rejectStyle : {}), // ...(isDragReject ? rejectStyle : {}),
@@ -993,7 +994,7 @@ export const RenderFileUpload = (field) => {
typeof filesUploadObj[key].name != "undefined" && typeof filesUploadObj[key].name != "undefined" &&
buildAppealFilesArray.push({ buildAppealFilesArray.push({
"name": filesUploadObj[key].name, "name": filesUploadObj[key].name,
"size": filesUploadObj[key].size, "size": filesUploadObj[key].size
}); });
} }
@@ -1087,7 +1088,7 @@ export const RenderFileUpload = (field) => {
setRejectedFiles([]); // Clear any previously rejected file errorsss setRejectedFiles([]); // Clear any previously rejected file errorsss
}; };
const FILENAME_ALLOWED = /^[A-Za-z0-9 ._\-:()]+$/; const FILENAME_ALLOWED = /^[A-Za-z0-9 ._\-:()]+$/;
const validateFilename = (file, t) => { const validateFilename = (file, t) => {
const name = file.name; const name = file.name;
@@ -1098,7 +1099,7 @@ export const RenderFileUpload = (field) => {
code: "filename-invalid-chars", code: "filename-invalid-chars",
message: `${name} ${t( message: `${name} ${t(
"myrepresentations:fileupload-file-error-invalid-filename-label" "myrepresentations:fileupload-file-error-invalid-filename-label"
)}`, )}`
}; };
} }
@@ -1108,7 +1109,7 @@ export const RenderFileUpload = (field) => {
code: "filename-invalid-chars", code: "filename-invalid-chars",
message: `${name} ${t( message: `${name} ${t(
"myrepresentations:fileupload-file-error-invalid-filename-label" "myrepresentations:fileupload-file-error-invalid-filename-label"
)}`, )}`
}; };
} }
@@ -1118,7 +1119,7 @@ export const RenderFileUpload = (field) => {
code: "filename-invalid-chars", code: "filename-invalid-chars",
message: `${name} ${t( message: `${name} ${t(
"myrepresentations:fileupload-file-error-invalid-filename-label" "myrepresentations:fileupload-file-error-invalid-filename-label"
)}`, )}`
}; };
} }
@@ -1138,7 +1139,7 @@ export const RenderFileUpload = (field) => {
"image/jpeg": [".jpg", ".jpeg"], "image/jpeg": [".jpg", ".jpeg"],
"image/png": [".png"], "image/png": [".png"],
"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet": "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet":
[".xlsx"], [".xlsx"]
}} }}
validator={(file) => validateFilename(file, t)} validator={(file) => validateFilename(file, t)}
onDrop={(acceptedFiles, fileRejections, e) => { onDrop={(acceptedFiles, fileRejections, e) => {
@@ -1178,7 +1179,7 @@ export const RenderFileUpload = (field) => {
.values.repfile_name .values.repfile_name
}_-_Attachment_-_${file.name}`, }_-_Attachment_-_${file.name}`,
{ {
type: file.type, type: file.type
} }
) )
); );
@@ -1211,7 +1212,7 @@ export const RenderFileUpload = (field) => {
typeof filesUploadObj[key].name != "undefined" && typeof filesUploadObj[key].name != "undefined" &&
buildAppealFilesArray.push({ buildAppealFilesArray.push({
"name": filesUploadObj[key].name, "name": filesUploadObj[key].name,
"size": filesUploadObj[key].size, "size": filesUploadObj[key].size
}); });
} }
@@ -1313,14 +1314,14 @@ export const RenderFileUpload = (field) => {
{uploadCountMessage > 0 && completedUploadFiles == false && ( {uploadCountMessage > 0 && completedUploadFiles == false && (
<div className="govuk-body govuk-!-font-size-14"> <div className="govuk-body govuk-!-font-size-14">
{t("home:uploading-files-label", { {t("home:uploading-files-label", {
number: uploadCountMessage, number: uploadCountMessage
})} })}
</div> </div>
)} )}
{completedUploadFiles > 0 && uploadCountMessage >= 0 && ( {completedUploadFiles > 0 && uploadCountMessage >= 0 && (
<div className="govuk-body govuk-!-font-size-14"> <div className="govuk-body govuk-!-font-size-14">
{t("home:completed-uploading-files-label", { {t("home:completed-uploading-files-label", {
number: uploadCountMessage, number: uploadCountMessage
})} })}
</div> </div>
)} )}
@@ -1449,9 +1450,9 @@ export function FileUploadField(props) {
? props.filenamePrefix.representationForm.values ? props.filenamePrefix.representationForm.values
.repfile_name .repfile_name
: props.filenamePrefix.hasOwnProperty("formObj") : props.filenamePrefix.hasOwnProperty("formObj")
? props.filenamePrefix.formObj["representationForm"] ? props.filenamePrefix.formObj["representationForm"]
.values.repfile_name .values.repfile_name
: "" : ""
} }
props={props} props={props}
/> />
+38 -38
View File
@@ -14,7 +14,7 @@ import {
deleteBlob, deleteBlob,
getFilesFromBlobHashed, getFilesFromBlobHashed,
uploadSingleFile, uploadSingleFile,
getFilesFromBlobproxy, getFilesFromBlobproxy
} from "../../actions"; } from "../../actions";
import fieldLookup from "../../data/crmfieldlookuptranslations.json"; import fieldLookup from "../../data/crmfieldlookuptranslations.json";
import pickListLookup from "../../data/picklistLookups.json"; import pickListLookup from "../../data/picklistLookups.json";
@@ -30,7 +30,7 @@ import {
parseISO, parseISO,
subDays, subDays,
subMonths, subMonths,
subYears, subYears
} from "date-fns"; } from "date-fns";
import "react-quill-new/dist/quill.snow.css"; import "react-quill-new/dist/quill.snow.css";
const ReactQuill = dynamic(() => import("react-quill-new"), { ssr: false }); const ReactQuill = dynamic(() => import("react-quill-new"), { ssr: false });
@@ -126,7 +126,7 @@ export function Textfield(props) {
parentField, parentField,
parentFieldShowOnValue, parentFieldShowOnValue,
maxFieldLength, maxFieldLength,
hint, hint
} = props; } = props;
const required = (value) => { const required = (value) => {
@@ -339,7 +339,7 @@ export function MultiLinefield(props) {
parentFieldShowOnValue, parentFieldShowOnValue,
validation, validation,
maxFieldLength, maxFieldLength,
hint, hint
} = props; } = props;
const required = (value) => { const required = (value) => {
@@ -484,8 +484,8 @@ export const RenderRichMultiline = ({
[{ "header": [1, 2, false] }], [{ "header": [1, 2, false] }],
["bold", "italic", "underline", "blockquote"], ["bold", "italic", "underline", "blockquote"],
[{ "list": "ordered" }, { "list": "bullet" }], [{ "list": "ordered" }, { "list": "bullet" }],
["clean"], ["clean"]
], ]
}; };
return ( return (
@@ -537,7 +537,7 @@ export function RichMultiLinefield(props) {
parentField, parentField,
parentFieldShowOnValue, parentFieldShowOnValue,
validation, validation,
maxFieldLength, maxFieldLength
} = props; } = props;
const required = (value) => const required = (value) =>
value ? undefined : t("newappeal:is-required-label"); value ? undefined : t("newappeal:is-required-label");
@@ -792,7 +792,7 @@ export function DateFieldPicker(props) {
form, form,
formProps, formProps,
parentFieldShowOnValue, parentFieldShowOnValue,
validation, validation
} = props; } = props;
let dateStart = props.dateStart; let dateStart = props.dateStart;
let dateEnd = props.dateEnd; let dateEnd = props.dateEnd;
@@ -1053,7 +1053,7 @@ const RenderYesNo = ({
{ {
["documentCheckList_" + ["documentCheckList_" +
id]: id]:
custom.requiredDocumentLabel, custom.requiredDocumentLabel
} }
)) ))
: delete docListObj[ : delete docListObj[
@@ -1090,7 +1090,7 @@ export function YesNofield(props) {
formProps, formProps,
validation, validation,
parentFieldShowOnValue, parentFieldShowOnValue,
parentField, parentField
} = props; } = props;
const yesNo = router.locale == "cy" ? ["Ydw", "Na"] : ["Yes", "No"]; const yesNo = router.locale == "cy" ? ["Ydw", "Na"] : ["Yes", "No"];
const required = (value) => (value ? undefined : "Required"); const required = (value) => (value ? undefined : "Required");
@@ -1236,7 +1236,7 @@ const RenderRadio = ({
{ {
["documentCheckList_" + ["documentCheckList_" +
id]: id]:
custom.requiredDocumentLabel, custom.requiredDocumentLabel
} }
)) ))
: delete docListObj[ : delete docListObj[
@@ -1270,7 +1270,7 @@ export function Radiofield(props) {
formProps, formProps,
parentFieldShowOnValue, parentFieldShowOnValue,
parentField, parentField,
validation, validation
} = props; } = props;
const router = useRouter(); const router = useRouter();
@@ -1461,7 +1461,7 @@ const RenderPickList = ({
label, label,
input, input,
errorMsg, errorMsg,
meta: { touched, error }, meta: { touched, error }
}) => { }) => {
let { t } = useTranslation(); let { t } = useTranslation();
@@ -1469,7 +1469,7 @@ const RenderPickList = ({
path: path:
"$..value[?(@ && @.LogicalName=='" + datafieldname + "')]..Options", "$..value[?(@ && @.LogicalName=='" + datafieldname + "')]..Options",
json: picklistData, json: picklistData,
eval: true, eval: true
}); });
dropdownObj = dropdownObj[0]; dropdownObj = dropdownObj[0];
@@ -1549,7 +1549,7 @@ export function NumericField(props) {
formProps, formProps,
parentFieldShowOnValue, parentFieldShowOnValue,
parentField, parentField,
maxFieldLength, maxFieldLength
} = props; } = props;
let { t } = useTranslation(); let { t } = useTranslation();
@@ -1649,7 +1649,7 @@ export function NumericField(props) {
validate={[ validate={[
required, required,
isNumber, isNumber,
maxLength(props.maxFieldLength), maxLength(props.maxFieldLength)
]} ]}
component={RenderTextfield} component={RenderTextfield}
label={props.label} label={props.label}
@@ -1670,7 +1670,7 @@ export function DecimalField(props) {
formProps, formProps,
parentFieldShowOnValue, parentFieldShowOnValue,
parentField, parentField,
maxFieldLength, maxFieldLength
} = props; } = props;
let { t } = useTranslation(); let { t } = useTranslation();
@@ -1868,7 +1868,7 @@ export const FieldsTranslations = (label) => {
let formObj = jsonpath({ let formObj = jsonpath({
path: "$['" + appealtypes + "']", path: "$['" + appealtypes + "']",
json: fieldLookup, json: fieldLookup,
eval: true, eval: true
}); });
let labelTrans = let labelTrans =
@@ -1876,7 +1876,7 @@ export const FieldsTranslations = (label) => {
? jsonpath({ ? jsonpath({
path: '$..[?(@ && @.value=="' + label + '")].value_cy', path: '$..[?(@ && @.value=="' + label + '")].value_cy',
json: formObj, json: formObj,
eval: true, eval: true
})[0] })[0]
: label; : label;
@@ -1895,7 +1895,7 @@ const PickListTranslations = (optionValue) => {
? jsonpath({ ? jsonpath({
path: '$..[?(@ && @.value=="' + optionValue + '")].value_cy', path: '$..[?(@ && @.value=="' + optionValue + '")].value_cy',
json: pickListLookup, json: pickListLookup,
eval: true, eval: true
}) })
: optionValue; : optionValue;
//console.log(optionTrans, optionValue); //console.log(optionTrans, optionValue);
@@ -1948,19 +1948,19 @@ const baseStyle = {
borderStyle: "dashed", borderStyle: "dashed",
backgroundColor: "#fafafa", backgroundColor: "#fafafa",
color: "#bdbdbd", color: "#bdbdbd",
transition: "border .3s ease-in-out", transition: "border .3s ease-in-out"
}; };
const activeStyle = { const activeStyle = {
borderColor: "#2196f3", borderColor: "#2196f3"
}; };
const acceptStyle = { const acceptStyle = {
borderColor: "#00e676", borderColor: "#00e676"
}; };
const rejectStyle = { const rejectStyle = {
borderColor: "#ff1744", borderColor: "#ff1744"
}; };
const RenderFileUpload = (field) => { const RenderFileUpload = (field) => {
@@ -1969,7 +1969,7 @@ const RenderFileUpload = (field) => {
const style = useMemo( const style = useMemo(
() => ({ () => ({
...baseStyle, ...baseStyle
// ...(isDragActive ? activeStyle : {}), // ...(isDragActive ? activeStyle : {}),
// ...(isDragAccept ? acceptStyle : {}), // ...(isDragAccept ? acceptStyle : {}),
// ...(isDragReject ? rejectStyle : {}), // ...(isDragReject ? rejectStyle : {}),
@@ -2098,7 +2098,7 @@ const RenderFileUpload = (field) => {
const blobList = jsonpath({ const blobList = jsonpath({
path: "$..[?(@ && @.documentType=='" + field.documentTypeCode + "')]", path: "$..[?(@ && @.documentType=='" + field.documentTypeCode + "')]",
json: filelistObj, json: filelistObj,
eval: true, eval: true
}); });
//const blobList = filelistObj; //const blobList = filelistObj;
@@ -2175,7 +2175,7 @@ const RenderFileUpload = (field) => {
setRejectedFiles([]); // Clear any previously rejected file errorsss setRejectedFiles([]); // Clear any previously rejected file errorsss
}; };
const FILENAME_ALLOWED = /^[A-Za-z0-9 ._\-:()]+$/; const FILENAME_ALLOWED = /^[A-Za-z0-9 ._\-:()]+$/;
const validateFilename = (file, t) => { const validateFilename = (file, t) => {
const name = file.name; const name = file.name;
@@ -2186,7 +2186,7 @@ const RenderFileUpload = (field) => {
code: "filename-invalid-chars", code: "filename-invalid-chars",
message: `${name} ${t( message: `${name} ${t(
"newappeal:new-appeal-fileupload-file-error-invalid-filename-label" "newappeal:new-appeal-fileupload-file-error-invalid-filename-label"
)}`, )}`
}; };
} }
@@ -2195,7 +2195,7 @@ const RenderFileUpload = (field) => {
code: "filename-invalid-chars", code: "filename-invalid-chars",
message: `${name} ${t( message: `${name} ${t(
"newappeal:new-appeal-fileupload-file-error-invalid-filename-label" "newappeal:new-appeal-fileupload-file-error-invalid-filename-label"
)}`, )}`
}; };
} }
@@ -2205,7 +2205,7 @@ const RenderFileUpload = (field) => {
code: "filename-invalid-chars", code: "filename-invalid-chars",
message: `${name} ${t( message: `${name} ${t(
"newappeal:new-appeal-fileupload-file-error-invalid-filename-label" "newappeal:new-appeal-fileupload-file-error-invalid-filename-label"
)}`, )}`
}; };
} }
@@ -2226,7 +2226,7 @@ const RenderFileUpload = (field) => {
"image/jpeg": [".jpg", ".jpeg"], "image/jpeg": [".jpg", ".jpeg"],
"image/png": [".png"], "image/png": [".png"],
"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet": "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet":
[".xlsx"], [".xlsx"]
}} }}
validator={(file) => validateFilename(file, t)} validator={(file) => validateFilename(file, t)}
onDrop={(acceptedFiles, fileRejections, e) => { onDrop={(acceptedFiles, fileRejections, e) => {
@@ -2286,7 +2286,7 @@ const RenderFileUpload = (field) => {
"undefined" && "undefined" &&
buildAppealFilesArray.push({ buildAppealFilesArray.push({
name: filesUploadObj[key].name, name: filesUploadObj[key].name,
size: filesUploadObj[key].size, size: filesUploadObj[key].size
}); });
} }
@@ -2312,14 +2312,14 @@ const RenderFileUpload = (field) => {
); );
Object.assign(values, { Object.assign(values, {
filesList: buildAppealFilesArray, filesList: buildAppealFilesArray
}); });
// keep your existing server-side invalid handling // keep your existing server-side invalid handling
if (data.invalidFiles?.length > 0) { if (data.invalidFiles?.length > 0) {
setRejectedFiles((prev) => [ setRejectedFiles((prev) => [
...prev, ...prev,
...data.invalidFiles, ...data.invalidFiles
]); ]);
setUploadCountMessage( setUploadCountMessage(
renamedAcceptedFiles.length - renamedAcceptedFiles.length -
@@ -2378,14 +2378,14 @@ const RenderFileUpload = (field) => {
{uploadCountMessage > 0 && completedUploadFiles == false && ( {uploadCountMessage > 0 && completedUploadFiles == false && (
<div className="govuk-body govuk-!-font-size-14"> <div className="govuk-body govuk-!-font-size-14">
{t("home:uploading-files-label", { {t("home:uploading-files-label", {
number: uploadCountMessage, number: uploadCountMessage
})} })}
</div> </div>
)} )}
{completedUploadFiles > 0 && uploadCountMessage >= 0 && ( {completedUploadFiles > 0 && uploadCountMessage >= 0 && (
<div className="govuk-body govuk-!-font-size-14"> <div className="govuk-body govuk-!-font-size-14">
{t("home:completed-uploading-files-label", { {t("home:completed-uploading-files-label", {
number: uploadCountMessage, number: uploadCountMessage
})} })}
</div> </div>
)} )}
@@ -2563,7 +2563,7 @@ const RenderSubFields = ({ fields, meta: { touched, error }, ...custom }) => {
className="gouk-grid-row" className="gouk-grid-row"
style={{ style={{
display: "flex", display: "flex",
marginBottom: "20px", marginBottom: "20px"
}} }}
> >
<Field <Field
@@ -2657,7 +2657,7 @@ export const FieldArrayForm = (props) => {
parentFieldShowOnValue, parentFieldShowOnValue,
parentField, parentField,
maxFieldLength, maxFieldLength,
maxSubField, maxSubField
} = props; } = props;
const dispatch = useDispatch(); // Get dispatch using useDispatch hook const dispatch = useDispatch(); // Get dispatch using useDispatch hook
+13 -12
View File
@@ -13,7 +13,7 @@ const PaginationControl = (props) => {
currentPage, currentPage,
spinnerState, spinnerState,
getSearchPageResults, getSearchPageResults,
setCurrentPage, setCurrentPage
} = props; } = props;
let { t } = useTranslation(); let { t } = useTranslation();
@@ -47,7 +47,7 @@ const PaginationControl = (props) => {
const range = { const range = {
start: Math.round(currentPage - delta / 2), start: Math.round(currentPage - delta / 2),
end: Math.round(currentPage + delta / 2), end: Math.round(currentPage + delta / 2)
}; };
if (range.start - 1 === 1 || range.end + 1 === pageCount) { if (range.start - 1 === 1 || range.end + 1 === pageCount) {
@@ -92,7 +92,7 @@ const PaginationControl = (props) => {
<button <button
className="govuk-body govuk-link govuk-!-font-weight-bold govuk-link--no-underline activePaginationItem leftTextButton" className="govuk-body govuk-link govuk-!-font-weight-bold govuk-link--no-underline activePaginationItem leftTextButton"
onClick={() => { onClick={() => {
spinnerState(), (spinnerState(),
setCurrentPage( setCurrentPage(
props.currentView.currentPage - props.currentView.currentPage -
1 1
@@ -102,7 +102,7 @@ const PaginationControl = (props) => {
1, 1,
orderBy, orderBy,
fieldSort fieldSort
); ));
}} }}
> >
{t("common:previous-link-button")} {t("common:previous-link-button")}
@@ -134,13 +134,13 @@ const PaginationControl = (props) => {
className="govuk-body govuk-link govuk-!-padding-2 govuk-!-font-weight-bold govuk-link--no-underline activePaginationItem" className="govuk-body govuk-link govuk-!-padding-2 govuk-!-font-weight-bold govuk-link--no-underline activePaginationItem"
key={i} key={i}
onClick={() => { onClick={() => {
spinnerState(), (spinnerState(),
setCurrentPage(e), setCurrentPage(e),
getSearchPageResults( getSearchPageResults(
e, e,
orderBy, orderBy,
fieldSort fieldSort
); ));
}} }}
> >
{e} {e}
@@ -153,7 +153,7 @@ const PaginationControl = (props) => {
<button <button
className="govuk-body govuk-link govuk-!-font-weight-bold govuk-link--no-underline activePaginationItem rightTextButton" className="govuk-body govuk-link govuk-!-font-weight-bold govuk-link--no-underline activePaginationItem rightTextButton"
onClick={() => { onClick={() => {
spinnerState(), (spinnerState(),
setCurrentPage( setCurrentPage(
props.currentView.currentPage + props.currentView.currentPage +
1 1
@@ -163,7 +163,7 @@ const PaginationControl = (props) => {
1, 1,
orderBy, orderBy,
fieldSort fieldSort
); ));
}} }}
> >
{t("common:next-link-button")} {t("common:next-link-button")}
@@ -177,8 +177,9 @@ const PaginationControl = (props) => {
</div> </div>
</div> </div>
<div className="govuk-body-s mobilePageCount"> <div className="govuk-body-s mobilePageCount">
{t("common:pages-label")} {currentPage}{" "} {t("common:pages-label")}{" "}
{t("common:of-label")} {pagesCount} {props.currentView.currentPage} {t("common:of-label")}{" "}
{pagesCount}
</div> </div>
</div> </div>
)} )}
@@ -188,7 +189,7 @@ const PaginationControl = (props) => {
const mapStateToProps = (state) => { const mapStateToProps = (state) => {
return { return {
currentView: state.currentView, currentView: state.currentView
}; };
}; };
@@ -196,7 +197,7 @@ const mapDispatchToProps = (dispatch) => {
return { return {
setCurrentPage: (currentPage) => { setCurrentPage: (currentPage) => {
dispatch(setCurrentPage(currentPage)); dispatch(setCurrentPage(currentPage));
}, }
}; };
}; };
+6 -6
View File
@@ -1,7 +1,7 @@
import { import {
createBlob, createBlob,
createRepBlob, createRepBlob,
uploadSingleFile, uploadSingleFile
} from "../../../actions/azurestorage"; } from "../../../actions/azurestorage";
import nextConnect from "next-connect"; import nextConnect from "next-connect";
@@ -11,7 +11,7 @@ import { fileTypeFromBuffer } from "file-type";
import fs from "fs"; import fs from "fs";
import path from "path"; import path from "path";
const FILENAME_ALLOWED = /^[A-Za-z0-9 ._\-:()]+$/; const FILENAME_ALLOWED = /^[A-Za-z0-9 ._\-:()]+$/;
function validateFilenameServer(originalFilename) { function validateFilenameServer(originalFilename) {
const name = path.basename(originalFilename || ""); const name = path.basename(originalFilename || "");
@@ -51,7 +51,7 @@ ApiProxy.post(async (req, res) => {
"image/jpeg", "image/jpeg",
"application/zip", "application/zip",
"image/png", "image/png",
"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet", "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"
]; ];
var allowedFilesFormData = {}; var allowedFilesFormData = {};
@@ -90,7 +90,7 @@ ApiProxy.post(async (req, res) => {
path: file.path, path: file.path,
size: file.size, size: file.size,
headers: file.headers, headers: file.headers,
contentType: fileMimeType, contentType: fileMimeType
}) })
); );
} else { } else {
@@ -128,8 +128,8 @@ ApiProxy.post(async (req, res) => {
export const config = { export const config = {
api: { api: {
bodyParser: false, bodyParser: false
}, }
}; };
export default ApiProxy; export default ApiProxy;
+4 -2
View File
@@ -2314,7 +2314,7 @@ ul#sharePageLinks.active {
@media screen and (max-width: 768px) { @media screen and (max-width: 768px) {
&.activePaginationItem { &.activePaginationItem {
color: $white; // color: $white;
&:before { &:before {
content: ""; content: "";
@@ -2402,8 +2402,10 @@ ul#sharePageLinks.active {
} }
@media screen and (max-width: 768px) { @media screen and (max-width: 768px) {
&.activePaginationItem { &.activePaginationItem {
color: #ffffff; // color: #ffffff;
&:after { &:after {
content: ""; content: "";