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