239 lines
12 KiB
JavaScript
239 lines
12 KiB
JavaScript
import Link from "next/link";
|
|
import { connect } from "react-redux";
|
|
import { useRouter } from "next/router";
|
|
import useTranslation from "next-translate/useTranslation";
|
|
import { Field, reduxForm, reset } from "redux-form";
|
|
import React, { useCallback, useEffect, useMemo, useState } from "react";
|
|
|
|
import {
|
|
RenderPickList,
|
|
RenderTextfield,
|
|
RenderRadioList,
|
|
RenderMultiline,
|
|
RenderFileUpload,
|
|
} from "./representationElements";
|
|
import { useDropzone } from "react-dropzone";
|
|
// import {
|
|
// setRepresentationCapacity,
|
|
// setRepresentationSubmit,
|
|
// } from "../../../store/currentView/action";
|
|
|
|
const RepAppellant = (props) => {
|
|
let { t } = useTranslation();
|
|
|
|
const router = useRouter();
|
|
const { locale } = router;
|
|
const {
|
|
formObj,
|
|
appellantApplicantRepresentationArr,
|
|
setRepresentationCapacity,
|
|
setRepresentationSubmit,
|
|
currentView,
|
|
} = props;
|
|
const { acceptedFiles, getRootProps, getInputProps } = useDropzone();
|
|
|
|
// console.log(props);
|
|
|
|
return (
|
|
<div id="rep-appellant">
|
|
<div className="govuk-grid-column-full">
|
|
<div className="govuk-grid-row">
|
|
<div className="govuk-form-group">
|
|
<h2 className="govuk-heading-m ">
|
|
Representation for an Appellant
|
|
</h2>
|
|
<label
|
|
className="govuk-label govuk-body-m"
|
|
htmlFor="representationType"
|
|
>
|
|
What kind of representation are you making?
|
|
</label>
|
|
<Field
|
|
name="representationType"
|
|
component={RenderPickList}
|
|
datafieldname="representationType"
|
|
optionsArr={appellantApplicantRepresentationArr}
|
|
/>
|
|
</div>
|
|
</div>
|
|
{/* <div className="govuk-grid-row">
|
|
<div className="govuk-form-group">
|
|
<Field
|
|
className="govuk-input govuk-!-width-three-quarters"
|
|
id="representationDescription"
|
|
name="representationDescription"
|
|
value="email"
|
|
data-aria-controls="representationDescription"
|
|
type="text"
|
|
component={RenderTextfield}
|
|
label="Description of representation"
|
|
/>
|
|
</div>
|
|
</div> */}
|
|
<div className="govuk-grid-row">
|
|
<div className="govuk-form-group">
|
|
<p className="govuk-body">
|
|
You can enter your comments in the space provided or
|
|
attach a separate document.
|
|
</p>
|
|
<fieldset
|
|
className="govuk-fieldset"
|
|
aria-describedby="commentBox-hint"
|
|
>
|
|
<div id="commentBox-hint" className="govuk-hint">
|
|
My comments are set out in:*
|
|
</div>
|
|
<div
|
|
className="govuk-checkboxes"
|
|
data-module="govuk-checkboxes"
|
|
>
|
|
<div className="govuk-checkboxes__item">
|
|
<Field
|
|
className="govuk-checkboxes__input"
|
|
id="commentBox"
|
|
name="commentBox"
|
|
value="email"
|
|
data-aria-controls="commentBox"
|
|
type="checkbox"
|
|
component={RenderTextfield}
|
|
/>
|
|
<label
|
|
className="govuk-label govuk-checkboxes__label"
|
|
htmlFor="commentBox"
|
|
>
|
|
the box below{" "}
|
|
</label>
|
|
</div>
|
|
<div
|
|
className={
|
|
_.isEmpty(formObj["representationForm"])
|
|
? "govuk-checkboxes__conditional govuk-checkboxes__conditional--hidden rr"
|
|
: _.isEmpty(
|
|
formObj["representationForm"]
|
|
.values
|
|
)
|
|
? "govuk-checkboxes__conditional govuk-checkboxes__conditional--hidden q11 "
|
|
: _.isEmpty(
|
|
formObj["representationForm"]
|
|
.values.commentBox
|
|
)
|
|
? formObj["representationForm"]
|
|
.values.commentBox == false
|
|
? "govuk-checkboxes__conditional govuk-checkboxes__conditional--hidden www"
|
|
: "govuk-checkboxes__conditional"
|
|
: "govuk-checkboxes__conditional govuk-checkboxes__conditional--hidden wwwaqqqq"
|
|
}
|
|
id="conditional-commentBox"
|
|
>
|
|
<div className="govuk-form-group">
|
|
<Field
|
|
name="representationComments"
|
|
id="representationComments"
|
|
component={RenderMultiline}
|
|
type="text"
|
|
rows="5"
|
|
className="govuk-textarea govuk-input--width-30"
|
|
aria-describedby={
|
|
props.name + "-hint"
|
|
}
|
|
/>
|
|
</div>
|
|
</div>
|
|
<div className="govuk-checkboxes__item">
|
|
<Field
|
|
className="govuk-checkboxes__input"
|
|
id="documentBox"
|
|
name="documentBox"
|
|
data-aria-controls="documentBox"
|
|
type="checkbox"
|
|
component={RenderTextfield}
|
|
/>
|
|
<label
|
|
className="govuk-label govuk-checkboxes__label"
|
|
htmlFor="documentBox"
|
|
>
|
|
separate documents
|
|
</label>
|
|
</div>
|
|
<div
|
|
className={
|
|
_.isEmpty(formObj["representationForm"])
|
|
? "govuk-checkboxes__conditional govuk-checkboxes__conditional--hidden rr"
|
|
: _.isEmpty(
|
|
formObj["representationForm"]
|
|
.values
|
|
)
|
|
? "govuk-checkboxes__conditional govuk-checkboxes__conditional--hidden www"
|
|
: _.isEmpty(
|
|
formObj["representationForm"]
|
|
.values.documentBox
|
|
)
|
|
? formObj["representationForm"]
|
|
.values.documentBox == false
|
|
? "govuk-checkboxes__conditional govuk-checkboxes__conditional--hidden www"
|
|
: "govuk-checkboxes__conditional"
|
|
: "govuk-checkboxes__conditional govuk-checkboxes__conditional--hidden"
|
|
}
|
|
id="conditional-documentBox"
|
|
>
|
|
<h2 className="govuk-heading-s">
|
|
{props.label}{" "}
|
|
</h2>
|
|
<Field
|
|
name="repsFiles"
|
|
id="repsFiles"
|
|
component={RenderFileUpload}
|
|
className="govuk-input govuk-input--width-20"
|
|
//validate={[required]}
|
|
label={props.label}
|
|
errorMsg="Is required"
|
|
ticketnumber={props.caseReference}
|
|
documentTypeCode={
|
|
props.documentTypeCode
|
|
}
|
|
hint={props.hint}
|
|
fileList={props.fileList}
|
|
setFilesForAppeal={
|
|
props.setFilesForAppeal
|
|
}
|
|
containerID={props.containerID}
|
|
/>
|
|
</div>
|
|
</div>
|
|
</fieldset>
|
|
</div>{" "}
|
|
</div>
|
|
<div className="govuk-grid-row">
|
|
<div className="govuk-button-group">
|
|
<button
|
|
type="submit"
|
|
className="govuk-button"
|
|
data-module="govuk-button"
|
|
>
|
|
Continue
|
|
</button>
|
|
{/* <a
|
|
onClick={() => {
|
|
setRepresentationSubmit(true);
|
|
}}
|
|
className="govuk-button"
|
|
>
|
|
Continue ww
|
|
</a> */}
|
|
<a
|
|
onClick={() => {
|
|
setRepresentationCapacity();
|
|
}}
|
|
className="govuk-link"
|
|
>
|
|
Back
|
|
</a>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
);
|
|
};
|
|
|
|
export default RepAppellant;
|