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
@@ -2,6 +2,8 @@ import useTranslation from "next-translate/useTranslation";
import { useRouter } from "next/router";
import { connect } from "react-redux";
import { Field, change, reduxForm } from "redux-form";
import { useState } from "react";
import { bytesToSize, getThumbnailIconByExtension } from "../../utils";
import {
FileUploadField,
@@ -26,6 +28,8 @@ const RepAgent = (props) => {
setRepFileName,
} = props;
const { acceptedFiles, getRootProps, getInputProps } = useDropzone();
const [savingStatus, setSavingStatus] = useState(false);
setRepFileName(formObj.representationForm.values);
const files = acceptedFiles.map((file) => (
@@ -98,7 +102,9 @@ const RepAgent = (props) => {
options={["Yes", "No"]}
id="representationOnBehalfOf"
className="govuk-radios__input"
errorMsg={t("newappeal:select-an-option-label")}
errorMsg={t(
"myrepresentations:select-an-option-label"
)}
component={RenderCondtionalRadioList}
validate={[required]}
legend={
@@ -211,7 +217,7 @@ const RepAgent = (props) => {
>
{t("common:continue-button")}
</button>
{router.query.state != "edit" && (
{/* {router.query.state != "edit" && (
<a
onClick={() => {
setRepresentationCapacity();
@@ -225,6 +231,44 @@ const RepAgent = (props) => {
>
{t("common:back-link")}
</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>
)}
</div>
</div>