removed logging and redundant imports

This commit is contained in:
2022-06-23 13:40:30 +01:00
parent d55aedfa65
commit 047fcb8142
4 changed files with 90 additions and 84 deletions
+81 -24
View File
@@ -599,7 +599,6 @@ const RenderYesNo = ({
: delete docListObj[
"documentCheckList_" + id
];
console.log(docListObj);
custom.setDocumentsList(docListObj);
}
}}
@@ -623,27 +622,70 @@ export function YesNofield(props) {
const router = useRouter();
let { t } = useTranslation();
const { name, label, inline, validation } = props;
const {
name,
label,
inline,
form,
formProps,
validation,
parentFieldShowOnValue,
parentField,
} = props;
const yesNo = router.locale == "cy" ? ["Ydw", "Na"] : ["Yes", "No"];
const required = (value) => (value ? undefined : "Required");
var showIfHasParentShowValue =
parentField != false &&
!_.isEmpty(formProps[form]) &&
_.has(formProps[form].values, parentField) &&
parentFieldShowOnValue.indexOf(
formProps[form].values[parentField].toString()
) > -1;
(showIfHasParentShowValue == parentField) != false &&
showIfHasParentShowValue;
return (
<Field
name={props.name}
datafieldname={props.name}
label={props.label}
options={yesNo}
id={props.name}
className={"govuk-radios__input"}
validate={eval(validation)}
errorMsg={t("newappeal:select-an-option-label")}
component={RenderYesNo}
inline={_.has(props, "inline") ? props.inline : "true"}
requiredDocumentLabel={props.requiredDocumentLabel}
requiredDocumentValue={props.requiredDocumentValue}
setDocumentsList={props.setDocumentsList}
documentList={props.documentList}
/>
<>
{parentField != false ? (
showIfHasParentShowValue && (
<Field
name={props.name}
datafieldname={props.name}
label={props.label}
options={yesNo}
id={props.name}
className={"govuk-radios__input"}
validate={eval(validation)}
errorMsg={t("newappeal:select-an-option-label")}
component={RenderYesNo}
inline={_.has(props, "inline") ? props.inline : "true"}
requiredDocumentLabel={props.requiredDocumentLabel}
requiredDocumentValue={props.requiredDocumentValue}
setDocumentsList={props.setDocumentsList}
documentList={props.documentList}
/>
)
) : (
<Field
name={props.name}
datafieldname={props.name}
label={props.label}
options={yesNo}
id={props.name}
className={"govuk-radios__input"}
validate={eval(validation)}
errorMsg={t("newappeal:select-an-option-label")}
component={RenderYesNo}
inline={_.has(props, "inline") ? props.inline : "true"}
requiredDocumentLabel={props.requiredDocumentLabel}
requiredDocumentValue={props.requiredDocumentValue}
setDocumentsList={props.setDocumentsList}
documentList={props.documentList}
/>
)}
</>
);
}
@@ -792,12 +834,6 @@ export function Radiofield(props) {
(showIfHasParentShowValue == parentField) != false &&
showIfHasParentShowValue;
// console.log(
// datafieldname,
// showIfHasParentShowValue,
// formProps[form].values[parentField]
// );
return (
<>
{parentField != false ? (
@@ -1209,6 +1245,7 @@ export function FileUploadField(props) {
errorMsg="Is required"
ticketnumber={props.ticketnumber}
documentTypeCode={props.documentTypeCode}
hint={props.hint}
/>
</>
);
@@ -1340,6 +1377,7 @@ const rejectStyle = {
const RenderFileUpload = (field) => {
const files = field.input.value;
let { t } = useTranslation();
const style = useMemo(
() => ({
...baseStyle,
@@ -1435,6 +1473,22 @@ const RenderFileUpload = (field) => {
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";
}
@@ -1465,6 +1519,9 @@ const RenderFileUpload = (field) => {
>
{({ getRootProps, getInputProps }) => (
<>
{field.hint != false && (
<div className="govuk-hint">{t(field.hint)}</div>
)}
<div className="govuk-form-group"></div>
<section className="container">
<div {...getRootProps({ style })}>
+8 -54
View File
@@ -1,25 +1,17 @@
import { signOut } from "next-auth/react";
import useTranslation from "next-translate/useTranslation";
import Link from "next/link";
import { useRouter } from "next/router";
import { useContext } from "react";
import useTranslation from "next-translate/useTranslation";
import { destroyCookie } from "nookies";
import TimeOut from "../components/timeout";
import AwaitingSubmission from "./myportal/awaitingsubmission";
import Dns from "./myportal/dns";
import MakeNewAppeal from "./myportal/makenewappeal";
import MyCases from "./myportal/mycases";
import SearchCases from "./myportal/searchcases";
import AwaitingSubmission from "./myportal/awaitingsubmission";
import MyRepresentations from "./myportal/myrepresentations";
import WatchedCases from "./myportal/watchedcases";
import YourAccount from "./myportal/youraccount";
import { parseCookies, setCookie, destroyCookie } from "nookies";
import Dns from "./myportal/dns";
import IdleTimer from "react-idle-timer";
import TimeoutModal from "./timeout/timeoutmodal";
import { useState } from "react";
import TimeOut from "../components/timeout";
import SearchCases from "./myportal/searchcases";
import UploadFile from "./myportal/uploadFile";
import { useSession, signIn, signOut } from "next-auth/react";
import WatchedCases from "./myportal/watchedcases";
const MyPortal = (props) => {
const { showFileUpload } = props;
@@ -28,33 +20,6 @@ const MyPortal = (props) => {
const router = useRouter();
const { locale } = router;
// const [showModal, setShowModal] = useState(false);
// const inactiveTimeOut = 1200; // in seconds
// const reminderTimeout = 60; // in seconds
// let idleTimer = null;
// let logoutTimer = null;
// let onIdle = () => {
// togglePopup();
// logoutTimer = setTimeout(() => {
// handleLogout();
// }, 1000 * reminderTimeout * 1);
// };
// let togglePopup = () => {
// showModal == true ? setShowModal(false) : setShowModal(true);
// };
// let handleStayLoggedIn = () => {
// if (logoutTimer) {
// clearTimeout(logoutTimer);
// logoutTimer = null;
// }
// idleTimer.reset();
// togglePopup();
// };
const handleLogout = () => {
console.log("////////////", "\n", "logout", "\n", "//////////");
destroyCookie({}, "pinsUser"),
@@ -63,7 +28,6 @@ const MyPortal = (props) => {
signOut({ callbackUrl: "/logout" });
};
console.log("showFileUpload :", showFileUpload);
return (
<>
<main className="" id="main-content" role="main">
@@ -160,16 +124,6 @@ const MyPortal = (props) => {
</div>
</div>
</main>
{/* <IdleTimer
ref={(ref) => {
idleTimer = ref;
}}
element={document}
stopOnIdle={true}
onActive={console.log(" bbis active", idleTimer)}
onIdle={onIdle}
timeout={1000 * inactiveTimeOut * 1}
/> */}
<TimeOut ggLogout={props.ggLogout} />
</>
);
+1 -5
View File
@@ -1,4 +1,5 @@
import _ from "lodash";
import { getSession, useSession } from "next-auth/react";
import useTranslation from "next-translate/useTranslation";
import Head from "next/head";
import { useRouter } from "next/router";
@@ -37,9 +38,6 @@ import {
setWatchedCases,
setWatchedCasesDetails,
} from "../../store/watchedCases/action";
import { setCookie } from "nookies";
import { getSession, useSession, signIn, signOut } from "next-auth/react";
const Home = (props) => {
const {
@@ -61,8 +59,6 @@ const Home = (props) => {
const { data: session } = useSession();
console.log("eeee", process.env.SHOWFILEUPLOAD);
return (
<div>
<Head>
-1
View File
@@ -65,7 +65,6 @@ export const setFormComplete = (formComplete) => (dispatch) => {
};
export const setDocumentsList = (documentList) => (dispatch) => {
console.log("here", documentList);
return dispatch({
type: appealTypeDataActionTypes.SETDOCUMENTLIST,
documentList: documentList,