filename changes to include case ref and cat code

This commit is contained in:
2022-06-21 12:09:03 +01:00
parent bd04900ff8
commit eb5d03a068
11 changed files with 128 additions and 35 deletions
+62 -5
View File
@@ -108,7 +108,7 @@ export function Textfield(props) {
// console.log(parentField, showIfHasParentShowValue);
// console.log(parentField, formProps, form);
console.log("validation props:", validation);
//console.log("validation props:", validation);
return (
<div className="govuk-form-group">
@@ -1207,6 +1207,8 @@ export function FileUploadField(props) {
//validate={[required]}
label={props.label}
errorMsg="Is required"
ticketnumber={props.ticketnumber}
documentTypeCode={props.documentTypeCode}
/>
</>
);
@@ -1399,12 +1401,67 @@ const RenderFileUpload = (field) => {
break;
}
};
const getDocumentType = (docCode) => {
console.log(docCode);
switch (docCode) {
case "000001":
return "000001";
break;
case "000002":
return "000002";
break;
case "000003":
return "000003";
break;
case "000004":
return "000004";
break;
case "000005":
return "000005";
break;
case "000006":
return "000006";
break;
case "000007":
return "000007";
break;
case "000008":
return "000008";
break;
case "000009":
return "000009";
break;
case "000010":
return "000010";
break;
default:
return "000000";
}
};
return (
<>
<Dropzone
onDrop={(filesToUpload, e) =>
field.input.onChange(filesToUpload)
}
// onDrop={(filesToUpload, e) =>
// field.input.onChange(filesToUpload)
// }
onDrop={(filesToUpload, e) => {
console.log(field.ticketnumber, field.documentTypeCode);
const renamedAcceptedFiles = filesToUpload.map(
(file) =>
new File(
[file],
`${field.ticketnumber}_${getDocumentType(
field.documentTypeCode
)}_${file.name}`,
{
type: file.type,
}
)
);
field.input.onChange(renamedAcceptedFiles);
}}
>
{({ getRootProps, getInputProps }) => (
<>
@@ -1435,7 +1492,7 @@ const RenderFileUpload = (field) => {
alt={file.name}
width="50"
/>
<span className="govuk-body govuk-!-padding-left-5">
<span className="govuk-body govuk-!-font-size-14 govuk-!-padding-left-5">
{file.name} ({bytesToSize(file.size)})
</span>
</div>
+1
View File
@@ -63,6 +63,7 @@ const MyPortal = (props) => {
signOut({ callbackUrl: "/logout" });
};
console.log("showFileUpload :", showFileUpload);
return (
<>
<main className="" id="main-content" role="main">
+14 -3
View File
@@ -161,9 +161,20 @@ const RenderFileUpload = (field) => {
return (
<div>
<Dropzone
onDrop={(filesToUpload, e) =>
field.input.onChange(filesToUpload)
}
// onDrop={(filesToUpload, e) =>
// field.input.onChange(filesToUpload)
// }
onDrop={(filesToUpload, e) => {
const renamedAcceptedFiles = filesToUpload.map(
(file) =>
new File([file], `${file.name}_${+new Date()}`, {
type: file.type,
})
);
field.input.onChange(renamedAcceptedFiles);
console.log(renamedAcceptedFiles);
}}
>
{({ getRootProps, getInputProps }) => (
<div className="govuk-grid-row">
+5
View File
@@ -176,6 +176,11 @@ export default function BuildField(props) {
<FileUploadField
name={props.datafieldname}
label={props.label}
ticketnumber={
props.props.props.props.appealType.caseReference
.ticketnumber
}
documentTypeCode={props.documentTypeCode}
/>
</div>
);
+11
View File
@@ -58,6 +58,11 @@ export default function BuildRow(props) {
doc
);
var documentTypeCode = xpath.select(
"//@ishareDocumentCode",
doc
);
var hint = xpath.select("//label/@hint", doc);
var dateStart = xpath.select("//@dateStart", doc);
var dateEnd = xpath.select("//@dateEnd", doc);
@@ -87,6 +92,10 @@ export default function BuildRow(props) {
!_.isEmpty(requiredDocumentLabel) &&
requiredDocumentLabel[0].value;
documentTypeCode =
!_.isEmpty(documentTypeCode) &&
documentTypeCode[0].value;
dateStart = !_.isEmpty(dateStart) && dateStart[0].value;
dateEnd = !_.isEmpty(dateEnd) && dateEnd[0].value;
@@ -110,6 +119,7 @@ export default function BuildRow(props) {
props.props.props.formData.pickListData
}
mandatoryFieldsData={mandatoryFieldsData}
documentTypeCode={documentTypeCode}
/>
);
} else {
@@ -146,6 +156,7 @@ export default function BuildRow(props) {
documentList={
props.props.appealType.documentList
}
documentTypeCode={documentTypeCode}
/>
);
// } else {