Merged PR 926: hide reps button & add rich text for reps
hide reps button & add rich text for reps Related work items: #7943
This commit is contained in:
@@ -1073,6 +1073,12 @@ export const patchCase = async (incidentid) => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
export const getCase = (incidentID) => {
|
export const getCase = (incidentID) => {
|
||||||
|
// console.log(
|
||||||
|
// "////////////// ------" +
|
||||||
|
// BASE_URL +
|
||||||
|
// "/api/endpoint/getcase_api?incidentID=" +
|
||||||
|
// incidentID
|
||||||
|
// );
|
||||||
return axios
|
return axios
|
||||||
.get(BASE_URL + "/api/endpoint/getcase_api?incidentID=" + incidentID)
|
.get(BASE_URL + "/api/endpoint/getcase_api?incidentID=" + incidentID)
|
||||||
.then((res) => {
|
.then((res) => {
|
||||||
|
|||||||
@@ -36,6 +36,7 @@ const Case = (props) => {
|
|||||||
searchString={props.searchString}
|
searchString={props.searchString}
|
||||||
incidentid={props.incidentid}
|
incidentid={props.incidentid}
|
||||||
showMap={props.showMap}
|
showMap={props.showMap}
|
||||||
|
showLoginCheck={props.showLoginCheck}
|
||||||
/>
|
/>
|
||||||
<Documents
|
<Documents
|
||||||
incidentid={props.incidentid}
|
incidentid={props.incidentid}
|
||||||
|
|||||||
@@ -128,6 +128,7 @@ let MakeRepresentation = (props) => {
|
|||||||
onHandleSubmit={onHandleSubmit}
|
onHandleSubmit={onHandleSubmit}
|
||||||
currentView={currentView}
|
currentView={currentView}
|
||||||
setSubmitBack={setSubmitBack}
|
setSubmitBack={setSubmitBack}
|
||||||
|
props={props}
|
||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
break;
|
break;
|
||||||
@@ -144,6 +145,7 @@ let MakeRepresentation = (props) => {
|
|||||||
onHandleSubmit={onHandleSubmit}
|
onHandleSubmit={onHandleSubmit}
|
||||||
currentView={currentView}
|
currentView={currentView}
|
||||||
setSubmitBack={setSubmitBack}
|
setSubmitBack={setSubmitBack}
|
||||||
|
props={props}
|
||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
break;
|
break;
|
||||||
@@ -160,6 +162,7 @@ let MakeRepresentation = (props) => {
|
|||||||
onHandleSubmit={onHandleSubmit}
|
onHandleSubmit={onHandleSubmit}
|
||||||
currentView={currentView}
|
currentView={currentView}
|
||||||
setSubmitBack={setSubmitBack}
|
setSubmitBack={setSubmitBack}
|
||||||
|
props={props}
|
||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
break;
|
break;
|
||||||
@@ -176,6 +179,7 @@ let MakeRepresentation = (props) => {
|
|||||||
onHandleSubmit={onHandleSubmit}
|
onHandleSubmit={onHandleSubmit}
|
||||||
currentView={currentView}
|
currentView={currentView}
|
||||||
setSubmitBack={setSubmitBack}
|
setSubmitBack={setSubmitBack}
|
||||||
|
props={props}
|
||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
break;
|
break;
|
||||||
@@ -204,16 +208,18 @@ let MakeRepresentation = (props) => {
|
|||||||
setRepresentationSubmit={setRepresentationSubmit}
|
setRepresentationSubmit={setRepresentationSubmit}
|
||||||
currentView={currentView}
|
currentView={currentView}
|
||||||
setSubmitBack={setSubmitBack}
|
setSubmitBack={setSubmitBack}
|
||||||
|
props={props}
|
||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
const onHandleSubmit = (values) => {
|
const onHandleSubmit = (values) => {
|
||||||
console.log(
|
// console.log(
|
||||||
values.representationCapacity,
|
// values,
|
||||||
currentView.representationCapacity
|
// values.representationCapacity,
|
||||||
);
|
// currentView.representationCapacity
|
||||||
|
// );
|
||||||
|
|
||||||
// console.log(_.isEmpty(currentView.representationCapacity));
|
// console.log(_.isEmpty(currentView.representationCapacity));
|
||||||
// console.log(
|
// console.log(
|
||||||
@@ -228,15 +234,22 @@ let MakeRepresentation = (props) => {
|
|||||||
.replace(/(\band|[\s\-\+\(\)\,\&])/g, "")
|
.replace(/(\band|[\s\-\+\(\)\,\&])/g, "")
|
||||||
.toLowerCase()
|
.toLowerCase()
|
||||||
)
|
)
|
||||||
: setRepresentationSubmit(true);
|
: setRepresentationSubmit("true");
|
||||||
|
|
||||||
|
window.alert(`You submitted:\n\n${JSON.stringify(values, null, 2)}`);
|
||||||
};
|
};
|
||||||
|
|
||||||
const repForm = props.props.form;
|
const repForm = props.props.form;
|
||||||
|
|
||||||
|
// console.log(
|
||||||
|
// "waht is representationSubmit:",
|
||||||
|
// currentView.representationSubmit
|
||||||
|
// );
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div>
|
<div>
|
||||||
<form onSubmit={handleSubmit(onHandleSubmit)}>
|
<form onSubmit={handleSubmit(onHandleSubmit)}>
|
||||||
{representationSubmit == true ? (
|
{currentView.representationSubmit == "true" ? (
|
||||||
<RepCompleteSubmit
|
<RepCompleteSubmit
|
||||||
formObj={formObj}
|
formObj={formObj}
|
||||||
capacityOptionsArr={capacityOptionsArr}
|
capacityOptionsArr={capacityOptionsArr}
|
||||||
@@ -253,13 +266,22 @@ let MakeRepresentation = (props) => {
|
|||||||
) : (
|
) : (
|
||||||
<>
|
<>
|
||||||
{!session ? (
|
{!session ? (
|
||||||
<button
|
<>
|
||||||
className="govuk-button withChevron govuk-button-cta"
|
<div>
|
||||||
type="button"
|
<p className="govuk-body">
|
||||||
onClick={() => signIn("email")}
|
Some text in here to explain about
|
||||||
>
|
raising a representation and why logging
|
||||||
Sign in to raise representation
|
in
|
||||||
</button>
|
</p>
|
||||||
|
</div>
|
||||||
|
<button
|
||||||
|
className="govuk-button withChevron govuk-button-cta"
|
||||||
|
type="button"
|
||||||
|
onClick={() => signIn("email")}
|
||||||
|
>
|
||||||
|
Sign in to raise representation
|
||||||
|
</button>
|
||||||
|
</>
|
||||||
) : (
|
) : (
|
||||||
<>
|
<>
|
||||||
<h1 className="govuk-heading-l">
|
<h1 className="govuk-heading-l">
|
||||||
|
|||||||
@@ -3,17 +3,20 @@ import { connect } from "react-redux";
|
|||||||
import { useRouter } from "next/router";
|
import { useRouter } from "next/router";
|
||||||
import useTranslation from "next-translate/useTranslation";
|
import useTranslation from "next-translate/useTranslation";
|
||||||
import { Field, reduxForm, reset } from "redux-form";
|
import { Field, reduxForm, reset } from "redux-form";
|
||||||
|
import React, { useCallback, useEffect, useMemo, useState } from "react";
|
||||||
|
|
||||||
import {
|
import {
|
||||||
RenderPickList,
|
RenderPickList,
|
||||||
RenderTextfield,
|
RenderTextfield,
|
||||||
RenderRadioList,
|
RenderRadioList,
|
||||||
RenderMultiline,
|
RenderMultiline,
|
||||||
|
RenderFileUpload,
|
||||||
} from "./representationElements";
|
} from "./representationElements";
|
||||||
import { useDropzone } from "react-dropzone";
|
import { useDropzone } from "react-dropzone";
|
||||||
import {
|
// import {
|
||||||
setRepresentationCapacity,
|
// setRepresentationCapacity,
|
||||||
setRepresentationSubmit,
|
// setRepresentationSubmit,
|
||||||
} from "../../../store/currentView/action";
|
// } from "../../../store/currentView/action";
|
||||||
|
|
||||||
const RepAppellant = (props) => {
|
const RepAppellant = (props) => {
|
||||||
let { t } = useTranslation();
|
let { t } = useTranslation();
|
||||||
@@ -28,11 +31,8 @@ const RepAppellant = (props) => {
|
|||||||
currentView,
|
currentView,
|
||||||
} = props;
|
} = props;
|
||||||
const { acceptedFiles, getRootProps, getInputProps } = useDropzone();
|
const { acceptedFiles, getRootProps, getInputProps } = useDropzone();
|
||||||
const files = acceptedFiles.map((file) => (
|
|
||||||
<li key={file.path}>
|
// console.log(props);
|
||||||
{file.path} - {file.size} bytes
|
|
||||||
</li>
|
|
||||||
));
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div id="rep-appellant">
|
<div id="rep-appellant">
|
||||||
@@ -141,7 +141,6 @@ const RepAppellant = (props) => {
|
|||||||
className="govuk-checkboxes__input"
|
className="govuk-checkboxes__input"
|
||||||
id="documentBox"
|
id="documentBox"
|
||||||
name="documentBox"
|
name="documentBox"
|
||||||
value="email"
|
|
||||||
data-aria-controls="documentBox"
|
data-aria-controls="documentBox"
|
||||||
type="checkbox"
|
type="checkbox"
|
||||||
component={RenderTextfield}
|
component={RenderTextfield}
|
||||||
@@ -174,25 +173,28 @@ const RepAppellant = (props) => {
|
|||||||
}
|
}
|
||||||
id="conditional-documentBox"
|
id="conditional-documentBox"
|
||||||
>
|
>
|
||||||
<div className="govuk-form-group">
|
<h2 className="govuk-heading-s">
|
||||||
<section className="container">
|
{props.label}{" "}
|
||||||
<div
|
</h2>
|
||||||
{...getRootProps({
|
<Field
|
||||||
className: "dropzone",
|
name="repsFiles"
|
||||||
})}
|
id="repsFiles"
|
||||||
>
|
component={RenderFileUpload}
|
||||||
<input {...getInputProps()} />
|
className="govuk-input govuk-input--width-20"
|
||||||
<p>
|
//validate={[required]}
|
||||||
Drag and drop files here or
|
label={props.label}
|
||||||
click to select files
|
errorMsg="Is required"
|
||||||
</p>
|
ticketnumber={props.caseReference}
|
||||||
</div>
|
documentTypeCode={
|
||||||
<aside>
|
props.documentTypeCode
|
||||||
<h4>Files</h4>
|
}
|
||||||
<ul>{files}</ul>
|
hint={props.hint}
|
||||||
</aside>
|
fileList={props.fileList}
|
||||||
</section>
|
setFilesForAppeal={
|
||||||
</div>
|
props.setFilesForAppeal
|
||||||
|
}
|
||||||
|
containerID={props.containerID}
|
||||||
|
/>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</fieldset>
|
</fieldset>
|
||||||
@@ -208,13 +210,13 @@ const RepAppellant = (props) => {
|
|||||||
Continue
|
Continue
|
||||||
</button>
|
</button>
|
||||||
{/* <a
|
{/* <a
|
||||||
onClick={() => {
|
onClick={() => {
|
||||||
setRepresentationSubmit(false);
|
setRepresentationSubmit(true);
|
||||||
}}
|
}}
|
||||||
className="govuk-button"
|
className="govuk-button"
|
||||||
>
|
>
|
||||||
Continue
|
Continue ww
|
||||||
</a> */}
|
</a> */}
|
||||||
<a
|
<a
|
||||||
onClick={() => {
|
onClick={() => {
|
||||||
setRepresentationCapacity();
|
setRepresentationCapacity();
|
||||||
|
|||||||
@@ -39,10 +39,10 @@ const RepComplete = (props) => {
|
|||||||
return (
|
return (
|
||||||
<div id="rep-appellant">
|
<div id="rep-appellant">
|
||||||
<div className="govuk-grid-column-full">
|
<div className="govuk-grid-column-full">
|
||||||
<div className="govuk-grid-row">
|
<div className="govuk-grid-row govuk-body">
|
||||||
<h2 className="govuk-heading-m ">
|
<h1 className="govuk-heading-m ">
|
||||||
Submission of Representation
|
Submission of Representation
|
||||||
</h2>
|
</h1>
|
||||||
<p>
|
<p>
|
||||||
Thank you for submitting your representation(s) using
|
Thank you for submitting your representation(s) using
|
||||||
the Appeals Casework Portal.
|
the Appeals Casework Portal.
|
||||||
|
|||||||
@@ -45,8 +45,8 @@ const RepCompleteSubmit = (props) => {
|
|||||||
) : (
|
) : (
|
||||||
<div id="rep-appellant">
|
<div id="rep-appellant">
|
||||||
<div className="govuk-grid-column-full">
|
<div className="govuk-grid-column-full">
|
||||||
<div className="govuk-grid-row">
|
<div className="govuk-grid-row govuk-body">
|
||||||
<h2 className="govuk-heading-m ">Submit</h2>
|
<h1 className="govuk-heading-m ">Submit</h1>
|
||||||
<p>
|
<p>
|
||||||
The gathering and subsequent processing of the
|
The gathering and subsequent processing of the
|
||||||
personal data supplied by you in this form, is
|
personal data supplied by you in this form, is
|
||||||
|
|||||||
@@ -1,6 +1,13 @@
|
|||||||
import { Field, reduxForm } from "redux-form";
|
import { Field, Fields, reduxForm } from "redux-form";
|
||||||
import router from "next/router";
|
import router from "next/router";
|
||||||
import React, { useState } from "react";
|
import React, { useState, useMemo } from "react";
|
||||||
|
import useTranslation from "next-translate/useTranslation";
|
||||||
|
import jsonpath from "jsonpath";
|
||||||
|
import Dropzone, { useDropzone } from "react-dropzone";
|
||||||
|
|
||||||
|
import dynamic from "next/dynamic";
|
||||||
|
const ReactQuill = dynamic(() => import("react-quill"), { ssr: false });
|
||||||
|
import "react-quill/dist/quill.snow.css";
|
||||||
|
|
||||||
export const RenderRadioList = ({
|
export const RenderRadioList = ({
|
||||||
datafieldname,
|
datafieldname,
|
||||||
@@ -149,14 +156,40 @@ export const RenderMultiline = ({
|
|||||||
meta: { touched, error },
|
meta: { touched, error },
|
||||||
...custom
|
...custom
|
||||||
}) => {
|
}) => {
|
||||||
|
const [editValue, setEditValue] = useState(
|
||||||
|
input.value != null ? input.value : ""
|
||||||
|
);
|
||||||
|
|
||||||
|
const changeEdit = (valStr) => {
|
||||||
|
setEditValue(valStr);
|
||||||
|
input.onChange(valStr);
|
||||||
|
};
|
||||||
|
|
||||||
|
var modules = {
|
||||||
|
toolbar: [
|
||||||
|
[{ "header": [1, 2, false] }],
|
||||||
|
["bold", "italic", "underline", "blockquote"],
|
||||||
|
[{ "list": "ordered" }, { "list": "bullet" }],
|
||||||
|
["clean"],
|
||||||
|
],
|
||||||
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
|
<ReactQuill
|
||||||
|
modules={modules}
|
||||||
|
theme="snow"
|
||||||
|
value={editValue}
|
||||||
|
onChange={changeEdit}
|
||||||
|
/>
|
||||||
<textarea
|
<textarea
|
||||||
{...input}
|
{...input}
|
||||||
id={id}
|
id={id}
|
||||||
name={name}
|
name={name}
|
||||||
rows={rows}
|
rows={rows}
|
||||||
className={className}
|
className={className}
|
||||||
|
value={editValue}
|
||||||
|
style={{ display: "none" }}
|
||||||
></textarea>
|
></textarea>
|
||||||
</>
|
</>
|
||||||
);
|
);
|
||||||
@@ -192,3 +225,339 @@ export function MultiLinefield(props) {
|
|||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const baseStyle = {
|
||||||
|
display: "flex",
|
||||||
|
flexDirection: "column",
|
||||||
|
alignItems: "center",
|
||||||
|
padding: "20px",
|
||||||
|
borderWidth: 2,
|
||||||
|
borderRadius: 2,
|
||||||
|
borderColor: "#eeeeee",
|
||||||
|
borderStyle: "dashed",
|
||||||
|
backgroundColor: "#fafafa",
|
||||||
|
color: "#bdbdbd",
|
||||||
|
transition: "border .3s ease-in-out",
|
||||||
|
};
|
||||||
|
|
||||||
|
const activeStyle = {
|
||||||
|
borderColor: "#2196f3",
|
||||||
|
};
|
||||||
|
|
||||||
|
const acceptStyle = {
|
||||||
|
borderColor: "#00e676",
|
||||||
|
};
|
||||||
|
|
||||||
|
const rejectStyle = {
|
||||||
|
borderColor: "#ff1744",
|
||||||
|
};
|
||||||
|
|
||||||
|
export const RenderFileUpload = (field) => {
|
||||||
|
const files = field.input.value;
|
||||||
|
let { t } = useTranslation();
|
||||||
|
|
||||||
|
const style = useMemo(
|
||||||
|
() => ({
|
||||||
|
...baseStyle,
|
||||||
|
// ...(isDragActive ? activeStyle : {}),
|
||||||
|
// ...(isDragAccept ? acceptStyle : {}),
|
||||||
|
// ...(isDragReject ? rejectStyle : {}),
|
||||||
|
}),
|
||||||
|
[]
|
||||||
|
// [isDragActive, isDragReject, isDragAccept]
|
||||||
|
);
|
||||||
|
const [filesList, setFilesList] = useState([]);
|
||||||
|
|
||||||
|
const thumbs = filesList.map((file) => (
|
||||||
|
<div key={file.name} className="govuk-!-margin-bottom-5 fileThumb">
|
||||||
|
<img src={file.preview} alt={file.name} width="50" /> -{" "}
|
||||||
|
<span className="govuk-body">
|
||||||
|
{file.name} ({file.size / 1024}kb)
|
||||||
|
</span>
|
||||||
|
</div>
|
||||||
|
));
|
||||||
|
|
||||||
|
function bytesToSize(bytes) {
|
||||||
|
var sizes = ["Bytes", "KB", "MB", "GB", "TB"];
|
||||||
|
if (bytes == 0) return "0 Byte";
|
||||||
|
var i = parseInt(Math.floor(Math.log(bytes) / Math.log(1024)));
|
||||||
|
return Math.round(bytes / Math.pow(1024, i), 2) + " " + sizes[i];
|
||||||
|
}
|
||||||
|
|
||||||
|
const getThumbnailIcon = (fileObj, fileType) => {
|
||||||
|
switch (fileType) {
|
||||||
|
case "text/html":
|
||||||
|
return "/assets/images/documenttypes/html.png";
|
||||||
|
break;
|
||||||
|
case "text/plain":
|
||||||
|
return "/assets/images/documenttypes/txt.png";
|
||||||
|
break;
|
||||||
|
case "application/msword":
|
||||||
|
return "/assets/images/documenttypes/doc.png";
|
||||||
|
break;
|
||||||
|
case "application/pdf":
|
||||||
|
return "/assets/images/documenttypes/pdf.png";
|
||||||
|
break;
|
||||||
|
case "application/vnd.openxmlformats-officedocument.wordprocessingml.document":
|
||||||
|
return "/assets/images/documenttypes/docx.png";
|
||||||
|
break;
|
||||||
|
case "text/csv":
|
||||||
|
return "/assets/images/documenttypes/csv.png";
|
||||||
|
break;
|
||||||
|
case "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet":
|
||||||
|
return "/assets/images/documenttypes/xlsx.png";
|
||||||
|
break;
|
||||||
|
|
||||||
|
case "application/zip":
|
||||||
|
return "/assets/images/documenttypes/zip.png";
|
||||||
|
break;
|
||||||
|
case "image/jpeg":
|
||||||
|
case "image/png":
|
||||||
|
return URL.createObjectURL(fileObj);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
return "/assets/images/documenttypes/txt.png";
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
const getThumbnailIconByExtension = (blobName) => {
|
||||||
|
let fileType = blobName.slice(blobName.lastIndexOf(".") + 1);
|
||||||
|
|
||||||
|
switch (fileType) {
|
||||||
|
case "html":
|
||||||
|
return "/assets/images/documenttypes/html.png";
|
||||||
|
break;
|
||||||
|
case "txt":
|
||||||
|
return "/assets/images/documenttypes/txt.png";
|
||||||
|
break;
|
||||||
|
case "doc":
|
||||||
|
return "/assets/images/documenttypes/doc.png";
|
||||||
|
break;
|
||||||
|
case "pdf":
|
||||||
|
return "/assets/images/documenttypes/pdf.png";
|
||||||
|
break;
|
||||||
|
case "docx":
|
||||||
|
return "/assets/images/documenttypes/docx.png";
|
||||||
|
break;
|
||||||
|
case "csv":
|
||||||
|
return "/assets/images/documenttypes/csv.png";
|
||||||
|
break;
|
||||||
|
case "xlsx":
|
||||||
|
return "/assets/images/documenttypes/xlsx.png";
|
||||||
|
break;
|
||||||
|
|
||||||
|
case "zip":
|
||||||
|
return "/assets/images/documenttypes/zip.png";
|
||||||
|
break;
|
||||||
|
case "jpeg":
|
||||||
|
case "jpg":
|
||||||
|
return "/assets/images/documenttypes/jpg.png";
|
||||||
|
case "png":
|
||||||
|
return "/assets/images/documenttypes/png.png";
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
return "/assets/images/documenttypes/txt.png";
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
const getDocumentType = (docCode) => {
|
||||||
|
switch (docCode) {
|
||||||
|
case "000001":
|
||||||
|
return "000001";
|
||||||
|
break;
|
||||||
|
case "000002":
|
||||||
|
return "000002";
|
||||||
|
break;
|
||||||
|
case "000003":
|
||||||
|
return "000003";
|
||||||
|
break;
|
||||||
|
case "000004":
|
||||||
|
return "000004";
|
||||||
|
break;
|
||||||
|
case "000005":
|
||||||
|
return "000005";
|
||||||
|
break;
|
||||||
|
case "000006":
|
||||||
|
return "000006";
|
||||||
|
break;
|
||||||
|
case "000007":
|
||||||
|
return "000007";
|
||||||
|
break;
|
||||||
|
case "000008":
|
||||||
|
return "000008";
|
||||||
|
break;
|
||||||
|
case "000009":
|
||||||
|
return "000009";
|
||||||
|
break;
|
||||||
|
case "000010":
|
||||||
|
return "000010";
|
||||||
|
break;
|
||||||
|
case "000011":
|
||||||
|
return "000011";
|
||||||
|
break;
|
||||||
|
case "000012":
|
||||||
|
return "000012";
|
||||||
|
break;
|
||||||
|
case "000013":
|
||||||
|
return "000013";
|
||||||
|
break;
|
||||||
|
case "000014":
|
||||||
|
return "000014";
|
||||||
|
break;
|
||||||
|
case "000015":
|
||||||
|
return "000015";
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
return "000000";
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
const filelistObj = field.fileList || {};
|
||||||
|
|
||||||
|
const blobList = jsonpath.query(
|
||||||
|
filelistObj,
|
||||||
|
"$..[?(@.documentType=='" + field.documentTypeCode + "')]"
|
||||||
|
);
|
||||||
|
|
||||||
|
const deleteThisBlob = async (
|
||||||
|
containerName,
|
||||||
|
blobName,
|
||||||
|
deleteblobhash,
|
||||||
|
getblobshash,
|
||||||
|
casefolderID
|
||||||
|
) => {
|
||||||
|
//console.log(containerName, blobName, deleteblobhash);
|
||||||
|
deleteBlob(containerName, blobName, deleteblobhash, casefolderID)
|
||||||
|
.then((data) => data)
|
||||||
|
.then(() => {
|
||||||
|
getFilesFromBlobHashed(
|
||||||
|
containerName,
|
||||||
|
getblobshash,
|
||||||
|
casefolderID
|
||||||
|
).then((newfilelist) => field.setFilesForAppeal(newfilelist));
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
return (
|
||||||
|
<>
|
||||||
|
<Dropzone
|
||||||
|
accept="application/pdf,application/msword,application/vnd.openxmlformats-officedocument.wordprocessingml.document,image/tiff,image/jpeg,application/zip"
|
||||||
|
onDrop={(filesToUpload, e) => {
|
||||||
|
const renamedAcceptedFiles = filesToUpload.map(
|
||||||
|
(file) =>
|
||||||
|
new File(
|
||||||
|
[file],
|
||||||
|
`${getDocumentType(field.documentTypeCode)}_${
|
||||||
|
file.name
|
||||||
|
}`,
|
||||||
|
{
|
||||||
|
type: file.type,
|
||||||
|
}
|
||||||
|
)
|
||||||
|
);
|
||||||
|
field.input.onChange(renamedAcceptedFiles);
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
{({ getRootProps, getInputProps }) => (
|
||||||
|
<>
|
||||||
|
{/* {field.hint != false && (
|
||||||
|
<div className="govuk-hint">ss{t(field.hint)}</div>
|
||||||
|
)}
|
||||||
|
<div className="govuk-form-group"></div> */}
|
||||||
|
<section className="container">
|
||||||
|
<div {...getRootProps({ style })}>
|
||||||
|
{" "}
|
||||||
|
<input id={field.id} {...getInputProps()} />
|
||||||
|
<div>
|
||||||
|
{t(
|
||||||
|
"newappeal:new-appeal-fileupload-drop-label"
|
||||||
|
)}
|
||||||
|
</div>
|
||||||
|
<em>
|
||||||
|
(
|
||||||
|
{t(
|
||||||
|
"newappeal:new-appeal-fileupload-file-list-label"
|
||||||
|
)}
|
||||||
|
)
|
||||||
|
</em>
|
||||||
|
</div>
|
||||||
|
<aside>{thumbs}</aside>
|
||||||
|
</section>
|
||||||
|
</>
|
||||||
|
)}
|
||||||
|
</Dropzone>
|
||||||
|
{field.meta.touched && field.meta.error && (
|
||||||
|
<span className="error">{field.meta.error}</span>
|
||||||
|
)}
|
||||||
|
{files && Array.isArray(files) && (
|
||||||
|
<ul>
|
||||||
|
{files.map((file, i) => (
|
||||||
|
<div
|
||||||
|
key={file.name}
|
||||||
|
className="govuk-!-margin-bottom-5 fileThumb"
|
||||||
|
>
|
||||||
|
<img
|
||||||
|
src={getThumbnailIcon(file, file.type)}
|
||||||
|
alt={file.name}
|
||||||
|
width="50"
|
||||||
|
/>
|
||||||
|
<span className="govuk-body govuk-!-font-size-14 govuk-!-padding-left-5">
|
||||||
|
{file.name} ({bytesToSize(file.size)})
|
||||||
|
</span>
|
||||||
|
</div>
|
||||||
|
))}
|
||||||
|
</ul>
|
||||||
|
)}
|
||||||
|
{blobList.map((blob, i) => (
|
||||||
|
<div
|
||||||
|
key={blob.name + "_" + i}
|
||||||
|
className="govuk-!-margin-bottom-5 fileThumb govuk-!-margin-top-5"
|
||||||
|
>
|
||||||
|
<div className="">
|
||||||
|
<span
|
||||||
|
className="govuk-summary-list__actionLink watched_link govuk-!-margin-right-5 govuk-!-text-align-left"
|
||||||
|
onClick={() => {
|
||||||
|
deleteThisBlob(
|
||||||
|
field.containerID,
|
||||||
|
blob.name,
|
||||||
|
blob.hasheddeletepath,
|
||||||
|
blob.hashgetblobs,
|
||||||
|
field.ticketnumber
|
||||||
|
);
|
||||||
|
}}
|
||||||
|
title="Remove this file"
|
||||||
|
>
|
||||||
|
−
|
||||||
|
</span>
|
||||||
|
</div>
|
||||||
|
<img
|
||||||
|
src={getThumbnailIconByExtension(blob.name)}
|
||||||
|
alt={blob.name}
|
||||||
|
width="50"
|
||||||
|
/>
|
||||||
|
|
||||||
|
<Link
|
||||||
|
key={i}
|
||||||
|
scroll={false}
|
||||||
|
href={
|
||||||
|
"/api/file/downloadblob?container=" +
|
||||||
|
field.containerID +
|
||||||
|
"&casefolderID=" +
|
||||||
|
field.ticketnumber +
|
||||||
|
"&blobname=" +
|
||||||
|
blob.name +
|
||||||
|
blob.hashedfilepath
|
||||||
|
}
|
||||||
|
>
|
||||||
|
<a className="govuk-body govuk-!-font-size-14 govuk-!-padding-left-5 govuk-link">
|
||||||
|
{blob.name} ({bytesToSize(blob.contentLength)})
|
||||||
|
</a>
|
||||||
|
</Link>
|
||||||
|
</div>
|
||||||
|
))}{" "}
|
||||||
|
</>
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|||||||
@@ -294,7 +294,14 @@ const RepInterestedPartyPerson = (props) => {
|
|||||||
</div>
|
</div>
|
||||||
<div className="govuk-grid-row">
|
<div className="govuk-grid-row">
|
||||||
<div className="govuk-button-group">
|
<div className="govuk-button-group">
|
||||||
<Link href="/representation">
|
<button
|
||||||
|
type="submit"
|
||||||
|
className="govuk-button"
|
||||||
|
data-module="govuk-button"
|
||||||
|
>
|
||||||
|
Continue
|
||||||
|
</button>
|
||||||
|
{/* <Link href="/representation">
|
||||||
<a
|
<a
|
||||||
onClick={() => {
|
onClick={() => {
|
||||||
setRepresentationSubmit(true);
|
setRepresentationSubmit(true);
|
||||||
@@ -303,7 +310,7 @@ const RepInterestedPartyPerson = (props) => {
|
|||||||
>
|
>
|
||||||
Continue
|
Continue
|
||||||
</a>
|
</a>
|
||||||
</Link>
|
</Link> */}
|
||||||
<a
|
<a
|
||||||
onClick={() => {
|
onClick={() => {
|
||||||
setRepresentationCapacity();
|
setRepresentationCapacity();
|
||||||
|
|||||||
@@ -202,7 +202,14 @@ const RepLandOwner = (props) => {
|
|||||||
</div>
|
</div>
|
||||||
<div className="govuk-grid-row">
|
<div className="govuk-grid-row">
|
||||||
<div className="govuk-button-group">
|
<div className="govuk-button-group">
|
||||||
<Link href="/representation">
|
<button
|
||||||
|
type="submit"
|
||||||
|
className="govuk-button"
|
||||||
|
data-module="govuk-button"
|
||||||
|
>
|
||||||
|
Continue
|
||||||
|
</button>
|
||||||
|
{/* <Link href="/representation">
|
||||||
<a
|
<a
|
||||||
onClick={() => {
|
onClick={() => {
|
||||||
setRepresentationSubmit(true);
|
setRepresentationSubmit(true);
|
||||||
@@ -211,7 +218,7 @@ const RepLandOwner = (props) => {
|
|||||||
>
|
>
|
||||||
Continue
|
Continue
|
||||||
</a>
|
</a>
|
||||||
</Link>
|
</Link> */}
|
||||||
<a
|
<a
|
||||||
onClick={() => {
|
onClick={() => {
|
||||||
setRepresentationCapacity();
|
setRepresentationCapacity();
|
||||||
|
|||||||
@@ -65,6 +65,9 @@ const CaseSummary = (props) => {
|
|||||||
showMap,
|
showMap,
|
||||||
} = props;
|
} = props;
|
||||||
|
|
||||||
|
const { data: session, status } = useSession();
|
||||||
|
//console.log("session status:", status, session);
|
||||||
|
|
||||||
const noRepresentationLink = ["/dnsdetails", "/dns/[developmentName]"];
|
const noRepresentationLink = ["/dnsdetails", "/dns/[developmentName]"];
|
||||||
|
|
||||||
let setCaseQueryObj = props[currentType];
|
let setCaseQueryObj = props[currentType];
|
||||||
@@ -276,8 +279,12 @@ const CaseSummary = (props) => {
|
|||||||
<div className="govuk-grid-row">
|
<div className="govuk-grid-row">
|
||||||
<div className="govuk-grid-column-full">
|
<div className="govuk-grid-column-full">
|
||||||
<div className="govuk-button-group">
|
<div className="govuk-button-group">
|
||||||
{noRepresentationLink.includes(router.pathname) ==
|
{props.currentView.caseReference.showreps ==
|
||||||
true ? (
|
"false" ? (
|
||||||
|
""
|
||||||
|
) : noRepresentationLink.includes(
|
||||||
|
router.pathname
|
||||||
|
) == true ? (
|
||||||
""
|
""
|
||||||
) : (
|
) : (
|
||||||
<Link href="/myportal/representation">
|
<Link href="/myportal/representation">
|
||||||
@@ -706,8 +713,6 @@ const CaseSummary = (props) => {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
const { data: session, status } = useSession();
|
|
||||||
//console.log("session status:", status, session);
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
{showDetailsBlock}
|
{showDetailsBlock}
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ import { useContext } from "react";
|
|||||||
import useTranslation from "next-translate/useTranslation";
|
import useTranslation from "next-translate/useTranslation";
|
||||||
import Summary from "./case/representation";
|
import Summary from "./case/representation";
|
||||||
|
|
||||||
const CaseSummary = (props) => {
|
const CaseRepresentation = (props) => {
|
||||||
let { t } = useTranslation();
|
let { t } = useTranslation();
|
||||||
|
|
||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
@@ -35,4 +35,4 @@ const CaseSummary = (props) => {
|
|||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
export default CaseSummary;
|
export default CaseRepresentation;
|
||||||
|
|||||||
@@ -547,11 +547,11 @@ const DNSSearchResults = (props) => {
|
|||||||
}}
|
}}
|
||||||
title="Stop watching this case"
|
title="Stop watching this case"
|
||||||
>
|
>
|
||||||
−
|
<span className="eye"></span>
|
||||||
</span>
|
</span>
|
||||||
) : (
|
) : (
|
||||||
<span
|
<span
|
||||||
className="govuk-summary-list__actionLink"
|
className="govuk-summary-list__actionLink watchLink"
|
||||||
onClick={() => {
|
onClick={() => {
|
||||||
selectWatchedCase(
|
selectWatchedCase(
|
||||||
cookies.pinsUser,
|
cookies.pinsUser,
|
||||||
@@ -565,7 +565,7 @@ const DNSSearchResults = (props) => {
|
|||||||
}}
|
}}
|
||||||
title="Watch this case"
|
title="Watch this case"
|
||||||
>
|
>
|
||||||
+
|
<span className="eye"></span>
|
||||||
</span>
|
</span>
|
||||||
)}
|
)}
|
||||||
</dd>
|
</dd>
|
||||||
|
|||||||
@@ -306,6 +306,8 @@ const SearchResults = (props) => {
|
|||||||
item.incidentid,
|
item.incidentid,
|
||||||
"appealType":
|
"appealType":
|
||||||
item.pinswg_appealcasetype,
|
item.pinswg_appealcasetype,
|
||||||
|
"showreps":
|
||||||
|
props.showLoginCheck,
|
||||||
});
|
});
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
|
|||||||
@@ -51,7 +51,7 @@ export default function Search(props) {
|
|||||||
myportal={myportal}
|
myportal={myportal}
|
||||||
watchedCases={watchedCases}
|
watchedCases={watchedCases}
|
||||||
isLinkedCase={isLinkedCase}
|
isLinkedCase={isLinkedCase}
|
||||||
showLoginCheck
|
showLoginCheck={showLoginCheck}
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -66,6 +66,7 @@
|
|||||||
"react-idle-timer": "^4.6.4",
|
"react-idle-timer": "^4.6.4",
|
||||||
"react-leaflet": "^3.2.5",
|
"react-leaflet": "^3.2.5",
|
||||||
"react-loading-overlay": "^1.0.1",
|
"react-loading-overlay": "^1.0.1",
|
||||||
|
"react-quill": "^2.0.0",
|
||||||
"react-redux": "^7.2.6",
|
"react-redux": "^7.2.6",
|
||||||
"react-xml-parser": "^1.1.8",
|
"react-xml-parser": "^1.1.8",
|
||||||
"redux-form": "^8.3.8",
|
"redux-form": "^8.3.8",
|
||||||
|
|||||||
@@ -24,7 +24,12 @@ const hashAPIPath = (queryPath) => {
|
|||||||
export default async function ApiProxy(req, res) {
|
export default async function ApiProxy(req, res) {
|
||||||
var incidentID = req.query.incidentID;
|
var incidentID = req.query.incidentID;
|
||||||
var token = await getToken();
|
var token = await getToken();
|
||||||
var queryUrl = "incidents(" + incidentID + ")?$select=ticketnumber,title";
|
var queryUrl =
|
||||||
|
"incidents(" +
|
||||||
|
incidentID +
|
||||||
|
")?$select=ticketnumber,title,pinswg_appealcasetype";
|
||||||
|
|
||||||
|
//console.log(WEBAPI_URL + queryUrl + hashAPIPath(queryUrl));
|
||||||
|
|
||||||
return axios
|
return axios
|
||||||
.get(
|
.get(
|
||||||
|
|||||||
@@ -26,6 +26,8 @@ export default async function ApiProxy(req, res) {
|
|||||||
loggedInUserId +
|
loggedInUserId +
|
||||||
"&$count=true&$orderby=createdon desc";
|
"&$count=true&$orderby=createdon desc";
|
||||||
|
|
||||||
|
//console.log(WEBAPI_URL + queryUrl + hashAPIPath(queryUrl));
|
||||||
|
|
||||||
return axios
|
return axios
|
||||||
.get(
|
.get(
|
||||||
WEBAPI_URL + queryUrl + hashAPIPath(queryUrl),
|
WEBAPI_URL + queryUrl + hashAPIPath(queryUrl),
|
||||||
|
|||||||
@@ -23,7 +23,7 @@ export default async function ApiProxy(req, res) {
|
|||||||
var caseReference = req.query.caseReference.split("'").join("''");
|
var caseReference = req.query.caseReference.split("'").join("''");
|
||||||
var token = await getToken();
|
var token = await getToken();
|
||||||
|
|
||||||
//console.log("the case:", caseReference);
|
//console.log("the case:", req.query, caseReference);
|
||||||
|
|
||||||
var queryUrl =
|
var queryUrl =
|
||||||
appealType +
|
appealType +
|
||||||
@@ -33,7 +33,7 @@ export default async function ApiProxy(req, res) {
|
|||||||
|
|
||||||
queryUrl = queryUrl + getSelectQuery(appealType);
|
queryUrl = queryUrl + getSelectQuery(appealType);
|
||||||
|
|
||||||
//console.log("test:", queryUrl);
|
//console.log("test:", WEBAPI_URL + queryUrl + hashAPIPath(queryUrl));
|
||||||
|
|
||||||
return axios
|
return axios
|
||||||
.get(
|
.get(
|
||||||
|
|||||||
+4
-2
@@ -8,7 +8,7 @@ import CookieBanner from "../../components/cookieBanner";
|
|||||||
import Footer from "../../components/footer";
|
import Footer from "../../components/footer";
|
||||||
import Header from "../../components/header";
|
import Header from "../../components/header";
|
||||||
|
|
||||||
const Home = (props) => {
|
const CaseHome = (props) => {
|
||||||
const { footerLinks, pages } = props;
|
const { footerLinks, pages } = props;
|
||||||
let { t, lang } = useTranslation();
|
let { t, lang } = useTranslation();
|
||||||
|
|
||||||
@@ -66,6 +66,7 @@ const Home = (props) => {
|
|||||||
representationsObj={
|
representationsObj={
|
||||||
props.searchResultsObj.representationsObj
|
props.searchResultsObj.representationsObj
|
||||||
}
|
}
|
||||||
|
showLoginCheck={props.showLoginCheck}
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
<Footer footerLinks={footerLinks} />
|
<Footer footerLinks={footerLinks} />
|
||||||
@@ -88,7 +89,8 @@ const mapStateToProps = (state) => {
|
|||||||
watchedCases: state.watchedCases,
|
watchedCases: state.watchedCases,
|
||||||
myRepresentations: state.myRepresentations,
|
myRepresentations: state.myRepresentations,
|
||||||
awaitingSubmission: state.awaitingSubmission,
|
awaitingSubmission: state.awaitingSubmission,
|
||||||
|
showLoginCheck: process.env.SHOWLOGIN || false,
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
export default connect(mapStateToProps)(Home);
|
export default connect(mapStateToProps)(CaseHome);
|
||||||
|
|||||||
+17
-1
@@ -12,6 +12,8 @@ import {
|
|||||||
getPersonalAccount,
|
getPersonalAccount,
|
||||||
getPortalModuleDetails,
|
getPortalModuleDetails,
|
||||||
getWatchedCases,
|
getWatchedCases,
|
||||||
|
consoleLogger,
|
||||||
|
getCase,
|
||||||
} from "../../actions";
|
} from "../../actions";
|
||||||
import { createContainer } from "../../actions/azurestorage";
|
import { createContainer } from "../../actions/azurestorage";
|
||||||
import { getProviderConfig } from "../../actions/govgateway";
|
import { getProviderConfig } from "../../actions/govgateway";
|
||||||
@@ -255,9 +257,23 @@ export const getServerSideProps = wrapper.getServerSideProps(
|
|||||||
);
|
);
|
||||||
|
|
||||||
const getDetails = (resultsObj, detailsType) => {
|
const getDetails = (resultsObj, detailsType) => {
|
||||||
//console.log(detailsType);
|
|
||||||
let detailsArr = [];
|
let detailsArr = [];
|
||||||
resultsObj = resultsObj.value;
|
resultsObj = resultsObj.value;
|
||||||
|
|
||||||
|
if (detailsType == "myRepresentations") {
|
||||||
|
const repsObj = resultsObj.map((searchDetail, index) => {
|
||||||
|
detailsArr.push(
|
||||||
|
getCase(searchDetail["_pinswg_case_value"]).then((data) => {
|
||||||
|
return getPortalModuleDetails(
|
||||||
|
getFormCollectionByID(data.pinswg_appealcasetype)
|
||||||
|
.LogicalCollectionName,
|
||||||
|
data.ticketnumber
|
||||||
|
);
|
||||||
|
})
|
||||||
|
);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
const detailsObj = resultsObj.map((searchDetail, index) => {
|
const detailsObj = resultsObj.map((searchDetail, index) => {
|
||||||
if (searchDetail.pinswg_appealcasetype == null) {
|
if (searchDetail.pinswg_appealcasetype == null) {
|
||||||
console.log(
|
console.log(
|
||||||
|
|||||||
@@ -18,7 +18,7 @@ import { wrapper } from "../store/store";
|
|||||||
import _ from "lodash";
|
import _ from "lodash";
|
||||||
|
|
||||||
const Home = (props) => {
|
const Home = (props) => {
|
||||||
const { footerLinks, pages, isLinkedCase } = props;
|
const { footerLinks, pages, isLinkedCase, showLoginCheck } = props;
|
||||||
let { t, lang } = useTranslation();
|
let { t, lang } = useTranslation();
|
||||||
|
|
||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
@@ -106,7 +106,7 @@ const Home = (props) => {
|
|||||||
searchString={props.search.searchString}
|
searchString={props.search.searchString}
|
||||||
searchResultsObj={props.searchResultsObj}
|
searchResultsObj={props.searchResultsObj}
|
||||||
isLinkedCase={isLinkedCase}
|
isLinkedCase={isLinkedCase}
|
||||||
showLoginCheck
|
showLoginCheck={showLoginCheck}
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
<Footer footerLinks={footerLinks} />
|
<Footer footerLinks={footerLinks} />
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ const currentViewInitialState = {
|
|||||||
currentView: {},
|
currentView: {},
|
||||||
caseReference: {},
|
caseReference: {},
|
||||||
representationCapacity: {},
|
representationCapacity: {},
|
||||||
representationSubmit: null,
|
representationSubmit: "",
|
||||||
representationSubmitConfirmation: {},
|
representationSubmitConfirmation: {},
|
||||||
linkedCaseReferences: {},
|
linkedCaseReferences: {},
|
||||||
currentPage: 1,
|
currentPage: 1,
|
||||||
@@ -33,6 +33,11 @@ export default function reducer(state = currentViewInitialState, action) {
|
|||||||
...state,
|
...state,
|
||||||
representationCapacity: action.representationCapacity,
|
representationCapacity: action.representationCapacity,
|
||||||
};
|
};
|
||||||
|
case currentViewActionTypes.SETREPRESENTATIONSUBMIT:
|
||||||
|
return {
|
||||||
|
...state,
|
||||||
|
representationSubmit: action.representationSubmit,
|
||||||
|
};
|
||||||
case currentViewActionTypes.SETREPRESENTATIONSUBMITCONFIRMATION:
|
case currentViewActionTypes.SETREPRESENTATIONSUBMITCONFIRMATION:
|
||||||
return {
|
return {
|
||||||
...state,
|
...state,
|
||||||
|
|||||||
Reference in New Issue
Block a user