apply GEL to reps

This commit is contained in:
2024-10-01 13:51:36 +01:00
parent 589577fb45
commit 062d8e8cb5
15 changed files with 484 additions and 103 deletions
@@ -5,6 +5,8 @@ import { useRouter } from "next/router";
import { useDropzone } from "react-dropzone";
import { connect } from "react-redux";
import { Field, change, formValueSelector, reduxForm } from "redux-form";
import { useState } from "react";
import {
FileUploadField,
RenderMultiline,
@@ -38,6 +40,8 @@ let RepLPA = (props) => {
updateRepresentation,
} = props;
const { acceptedFiles, getRootProps, getInputProps } = useDropzone();
const [savingStatus, setSavingStatus] = useState(false);
const files = acceptedFiles.map((file) => (
<li key={file.path}>
{file.path} - {file.size} bytes
@@ -405,6 +409,51 @@ let RepLPA = (props) => {
Back
</a>
)}
{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 progress-save "
onClick={() => {
let valuesObj =
props.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>
)}
</>
)}{" "}
{(typeof props.representationType != "undefined" ||
@@ -418,7 +467,7 @@ let RepLPA = (props) => {
>
{t("common:continue-button")}
</button>
{router.query.state != "edit" && (
{/* {router.query.state != "edit" && (
<a
onClick={() => {
//setRepresentationCapacity();
@@ -430,8 +479,51 @@ let RepLPA = (props) => {
}}
className="govuk-link"
>
{t("common:back-link")}
{t("common:back-link")}www
</a>
)} */}
{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 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>
)}
</>
)}