added save button to save a partial rep before completion
This commit is contained in:
+2
-1
@@ -24,4 +24,5 @@ tmp
|
|||||||
docker
|
docker
|
||||||
dockerfile*
|
dockerfile*
|
||||||
.dockerignore
|
.dockerignore
|
||||||
Makefile
|
Makefile
|
||||||
|
docker*.yml
|
||||||
+1
-1
@@ -614,7 +614,7 @@ export const getLPA = () => {
|
|||||||
return axios
|
return axios
|
||||||
.get(BASE_URL + "/api/endpoint/getlpa_api")
|
.get(BASE_URL + "/api/endpoint/getlpa_api")
|
||||||
.then((res) => {
|
.then((res) => {
|
||||||
//console.log(res.data);
|
console.log(res.data);
|
||||||
return res.data;
|
return res.data;
|
||||||
})
|
})
|
||||||
.catch((error) => {
|
.catch((error) => {
|
||||||
|
|||||||
@@ -48,6 +48,7 @@ let MakeRepresentation = (props) => {
|
|||||||
const { acceptedFiles, getRootProps, getInputProps } = useDropzone();
|
const { acceptedFiles, getRootProps, getInputProps } = useDropzone();
|
||||||
|
|
||||||
const [clearRepForm, setClearRepForm] = useState(false);
|
const [clearRepForm, setClearRepForm] = useState(false);
|
||||||
|
const [savingStatus, setSavingStatus] = useState(false);
|
||||||
const { data: session } = useSession();
|
const { data: session } = useSession();
|
||||||
|
|
||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
@@ -389,6 +390,8 @@ let MakeRepresentation = (props) => {
|
|||||||
) => {
|
) => {
|
||||||
let incidentId = props.appealType.caseReference.incidentid;
|
let incidentId = props.appealType.caseReference.incidentid;
|
||||||
let updateBody = values || {};
|
let updateBody = values || {};
|
||||||
|
const buildFileArray = [];
|
||||||
|
setSavingStatus(useSaveStatus);
|
||||||
|
|
||||||
// "pinswg_name": "2022-11-29-IP-REP_BOND_1",
|
// "pinswg_name": "2022-11-29-IP-REP_BOND_1",
|
||||||
|
|
||||||
@@ -467,15 +470,42 @@ let MakeRepresentation = (props) => {
|
|||||||
"returnLink": "",
|
"returnLink": "",
|
||||||
"linkExpiry": 10 * 60,
|
"linkExpiry": 10 * 60,
|
||||||
};
|
};
|
||||||
props.currentView.representationSubmit == "true" &&
|
props.currentView.representationSubmit == "true"
|
||||||
(sendSavedEmail == true &&
|
? (sendSavedEmail == true &&
|
||||||
sendEmail(templateId, emailAddress, personalisation, reference),
|
sendEmail(
|
||||||
useSaveStatus &&
|
templateId,
|
||||||
router.replace(
|
emailAddress,
|
||||||
router.locale != "en"
|
personalisation,
|
||||||
? router.locale + "/myportal"
|
reference
|
||||||
: "/myportal"
|
),
|
||||||
));
|
useSaveStatus &&
|
||||||
|
router.replace(
|
||||||
|
router.locale != "en"
|
||||||
|
? router.locale + "/myportal"
|
||||||
|
: "/myportal"
|
||||||
|
))
|
||||||
|
: useSaveStatus &&
|
||||||
|
(values.hasOwnProperty("representationDocuments") &&
|
||||||
|
(values.representationDocuments.map((Blob) =>
|
||||||
|
buildFileArray.push({
|
||||||
|
"name": Blob.name,
|
||||||
|
"size": Blob.size,
|
||||||
|
})
|
||||||
|
),
|
||||||
|
Object.assign(values, {
|
||||||
|
"filesList": buildFileArray,
|
||||||
|
})),
|
||||||
|
generateRepPDF(
|
||||||
|
values,
|
||||||
|
props.props.accountDetails.containerID,
|
||||||
|
currentView.caseReference.currentReference
|
||||||
|
),
|
||||||
|
uploadRepresentationFiles(values),
|
||||||
|
router.replace(
|
||||||
|
router.locale != "en"
|
||||||
|
? router.locale + "/myportal"
|
||||||
|
: "/myportal"
|
||||||
|
));
|
||||||
};
|
};
|
||||||
|
|
||||||
const onHandleSubmit = (values) => {
|
const onHandleSubmit = (values) => {
|
||||||
@@ -752,7 +782,61 @@ let MakeRepresentation = (props) => {
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>{" "}
|
||||||
|
{Object.keys(
|
||||||
|
props.props.currentView
|
||||||
|
.representationCapacity
|
||||||
|
).length > 0 &&
|
||||||
|
(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 govuk-button--secondary progress-save "
|
||||||
|
onClick={() => {
|
||||||
|
let valuesObj =
|
||||||
|
props.props.form[
|
||||||
|
props.form
|
||||||
|
].values || {};
|
||||||
|
|
||||||
|
console.log(
|
||||||
|
"valuesobj:",
|
||||||
|
valuesObj
|
||||||
|
);
|
||||||
|
|
||||||
|
delete valuesObj[
|
||||||
|
"_pinswg_appellant_value"
|
||||||
|
];
|
||||||
|
|
||||||
|
console.log(
|
||||||
|
"on save:",
|
||||||
|
valuesObj
|
||||||
|
);
|
||||||
|
updateRepresentation(
|
||||||
|
valuesObj,
|
||||||
|
false,
|
||||||
|
true
|
||||||
|
);
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
{t(
|
||||||
|
"common:save-exit-button"
|
||||||
|
)}
|
||||||
|
</button>
|
||||||
|
))}
|
||||||
{formObj.hasOwnProperty(
|
{formObj.hasOwnProperty(
|
||||||
"representationForm"
|
"representationForm"
|
||||||
) &&
|
) &&
|
||||||
|
|||||||
@@ -537,7 +537,7 @@ const RenderDatePicker = ({
|
|||||||
id={id + "_label"}
|
id={id + "_label"}
|
||||||
htmlFor={id}
|
htmlFor={id}
|
||||||
>
|
>
|
||||||
{FieldsTranslations(label)} ssss
|
{FieldsTranslations(label)}
|
||||||
</label>
|
</label>
|
||||||
</legend>
|
</legend>
|
||||||
{touched && error && (
|
{touched && error && (
|
||||||
|
|||||||
Reference in New Issue
Block a user