Remove dead and debug-only code from elements index
This commit is contained in:
@@ -1,5 +1,3 @@
|
||||
import axios from "axios";
|
||||
|
||||
import _ from "lodash";
|
||||
import useTranslation from "next-translate/useTranslation";
|
||||
import { useRouter } from "next/router";
|
||||
@@ -7,13 +5,9 @@ import React, { useEffect } from "react";
|
||||
import "react-datepicker/dist/react-datepicker.css";
|
||||
import { Field } from "redux-form";
|
||||
import fieldLookup from "../../data/crmfieldlookuptranslations.json";
|
||||
import pickListLookup from "../../data/picklistLookups.json";
|
||||
|
||||
import { setFileCount } from "../../store/appealType/action";
|
||||
|
||||
import "react-quill-new/dist/quill.snow.css";
|
||||
|
||||
import { useStore as store, useSelector } from "react-redux";
|
||||
import { validateField } from "./validationUtils"; // Import the validation function
|
||||
import { getFieldTranslation } from "./helpers/translationHelpers";
|
||||
import { RenderRichMultiline } from "./fields/renderRichMultiline";
|
||||
@@ -75,33 +69,6 @@ export function Textfield(props) {
|
||||
hint
|
||||
} = props;
|
||||
|
||||
const required = (value) => {
|
||||
let errors;
|
||||
|
||||
// Check for the required field
|
||||
if (!value) {
|
||||
errors = t("newappeal:is-required-label");
|
||||
} else {
|
||||
// Check for emojis using a regular expression
|
||||
const emojiRegex =
|
||||
/[\u{1F600}-\u{1F64F}\u{1F300}-\u{1F5FF}\u{1F680}-\u{1F6FF}\u{1F700}-\u{1F77F}\u{1F780}-\u{1F7FF}\u{1F800}-\u{1F8FF}\u{1F900}-\u{1F9FF}\u{1FA00}-\u{1FA6F}\u{1FA70}-\u{1FAFF}\u{2600}-\u{26FF}\u{2700}-\u{27BF}\u{2300}-\u{23FF}\u{2B50}\u{1F004}-\u{1F0CF}\u{1F0A0}-\u{1F0A5}\u{1F170}-\u{1F251}]/gu;
|
||||
|
||||
if (emojiRegex.test(value)) {
|
||||
errors = "Emojis are not allowed";
|
||||
}
|
||||
}
|
||||
|
||||
return errors;
|
||||
};
|
||||
|
||||
const postcode = (value) =>
|
||||
value &&
|
||||
!/^([A-Z][A-HJ-Y]?[0-9][A-Z0-9]? ?[0-9][A-Z]{2}|GIR ?0A{2})$/i.test(
|
||||
value
|
||||
)
|
||||
? t("newappeal:invalid-postcode-label")
|
||||
: undefined;
|
||||
|
||||
let { t } = useTranslation();
|
||||
|
||||
if (name == "pinswg_name") {
|
||||
@@ -238,25 +205,6 @@ export function MultiLinefield(props) {
|
||||
hint
|
||||
} = props;
|
||||
|
||||
const required = (value) => {
|
||||
let errors;
|
||||
|
||||
// Check for the required field
|
||||
if (!value) {
|
||||
errors = t("newappeal:is-required-label");
|
||||
} else {
|
||||
// Check for emojis using a regular expression
|
||||
const emojiRegex =
|
||||
/[\u{1F600}-\u{1F64F}\u{1F300}-\u{1F5FF}\u{1F680}-\u{1F6FF}\u{1F700}-\u{1F77F}\u{1F780}-\u{1F7FF}\u{1F800}-\u{1F8FF}\u{1F900}-\u{1F9FF}\u{1FA00}-\u{1FA6F}\u{1FA70}-\u{1FAFF}\u{2600}-\u{26FF}\u{2700}-\u{27BF}\u{2300}-\u{23FF}\u{2B50}\u{1F004}-\u{1F0CF}\u{1F0A0}-\u{1F0A5}\u{1F170}-\u{1F251}]/gu;
|
||||
|
||||
if (emojiRegex.test(value)) {
|
||||
errors = t("newappeal:emojis-not-allowed-label");
|
||||
}
|
||||
}
|
||||
|
||||
return errors;
|
||||
};
|
||||
|
||||
var showIfHasParentShowValue = isVisibleByInclusion({
|
||||
parentField,
|
||||
form,
|
||||
@@ -365,9 +313,6 @@ export function RichMultiLinefield(props) {
|
||||
validation,
|
||||
maxFieldLength
|
||||
} = props;
|
||||
const required = (value) =>
|
||||
value ? undefined : t("newappeal:is-required-label");
|
||||
|
||||
var showIfHasParentShowValue = isVisibleByInclusion({
|
||||
parentField,
|
||||
form,
|
||||
@@ -475,7 +420,6 @@ export function DateFieldPicker(props) {
|
||||
let dateStart = props.dateStart;
|
||||
let dateEnd = props.dateEnd;
|
||||
let { t } = useTranslation();
|
||||
const required = (value) => (value ? undefined : "Required");
|
||||
var showIfHasParentShowValue = isVisibleByEquality({
|
||||
parentField,
|
||||
form,
|
||||
@@ -651,7 +595,6 @@ export function YesNofield(props) {
|
||||
} = props;
|
||||
const yesNo = router.locale == "cy" ? ["Ydw", "Na"] : ["Yes", "No"];
|
||||
const required = (value) => (value ? undefined : "Required");
|
||||
|
||||
var showIfHasParentShowValue = isVisibleByInclusion({
|
||||
parentField,
|
||||
form,
|
||||
@@ -718,7 +661,6 @@ export function Radiofield(props) {
|
||||
} = props;
|
||||
|
||||
const router = useRouter();
|
||||
const required = (value) => (value ? undefined : "Required");
|
||||
// console.log(props.options);
|
||||
let { t } = useTranslation();
|
||||
|
||||
@@ -803,8 +745,7 @@ export function Radiofield(props) {
|
||||
export function CheckBoxfield(props) {
|
||||
const router = useRouter();
|
||||
|
||||
console.log(props);
|
||||
const required = (value) => (value ? undefined : "Required");
|
||||
let { t } = useTranslation();
|
||||
const fieldOptions =
|
||||
router.locale == "cy" ? ["Ydw", "Na", "2323"] : ["Yes", "No", "23232"];
|
||||
return (
|
||||
@@ -955,21 +896,6 @@ export function DecimalField(props) {
|
||||
|
||||
let { t } = useTranslation();
|
||||
|
||||
const required = (value) =>
|
||||
value ? undefined : t("newappeal:is-required-label");
|
||||
|
||||
const isNumber = (value) => {
|
||||
const regex = /^\d*\.?\d{0,1}$/;
|
||||
return regex.test(value)
|
||||
? undefined
|
||||
: t("newappeal:invalid-number-label");
|
||||
};
|
||||
|
||||
const maxLength = (max) => (value) =>
|
||||
value && value.length > max
|
||||
? `Must be ${max} characters or less`
|
||||
: undefined;
|
||||
|
||||
//parentFieldShowOnValue
|
||||
var showIfHasParentShowValue = isVisibleByInclusion({
|
||||
parentField,
|
||||
@@ -983,10 +909,6 @@ export function DecimalField(props) {
|
||||
|
||||
//console.log("parentField:", parentField, showIfHasParentShowValue);
|
||||
|
||||
const normalizeDecimal = (value) => {
|
||||
return value ? parseFloat(value) : value;
|
||||
};
|
||||
|
||||
const validateDecimal = (value) => {
|
||||
if (!value) return t("newappeal:is-required-label");
|
||||
|
||||
@@ -1059,8 +981,6 @@ export function DecimalField(props) {
|
||||
);
|
||||
}
|
||||
|
||||
const RenderCaseID = {};
|
||||
|
||||
export function ReadOnlyfield(props) {
|
||||
const { name, label, value } = props;
|
||||
//console.log(props.value.refno);
|
||||
@@ -1098,13 +1018,6 @@ export const FieldsTranslations = (label) => {
|
||||
};
|
||||
|
||||
export function FileUploadField(props) {
|
||||
const uploadCount =
|
||||
typeof props.uploadCount === "number" ? props.uploadCount : 0;
|
||||
const setFileCount =
|
||||
typeof props.setFileCount === "function"
|
||||
? props.setFileCount
|
||||
: () => {};
|
||||
|
||||
return (
|
||||
<>
|
||||
<h2 className="govuk-heading-s">
|
||||
|
||||
Reference in New Issue
Block a user