emoji checker on text and multiline
This commit is contained in:
+4
-1
@@ -141,4 +141,7 @@ APPLICATIONINSIGHTS_CONNECTIONSTRING = InstrumentationKey=7a06e24a-793c-47bc-898
|
||||
NEXT_PUBLIC_APP_INSIGHT = InstrumentationKey=7370f0f9-834d-4c7a-b3c4-9951fcad5ad2;IngestionEndpoint=https://ukwest-0.in.applicationinsights.azure.com/;LiveEndpoint=https://ukwest.livediagnostics.monitor.azure.com/;ApplicationId=04362cb7-6dfc-469e-8274-12243e8be851
|
||||
|
||||
// Prod Connection string
|
||||
//NEXT_PUBLIC_APP_INSIGHT = InstrumentationKey=61f358c2-8075-4164-b897-17bc6dd31fee;IngestionEndpoint=https://ukwest-0.in.applicationinsights.azure.com/;LiveEndpoint=https://ukwest.livediagnostics.monitor.azure.com/;ApplicationId=0c297349-396b-4dc6-8b56-85f5c680adc6
|
||||
//NEXT_PUBLIC_APP_INSIGHT = InstrumentationKey=61f358c2-8075-4164-b897-17bc6dd31fee;IngestionEndpoint=https://ukwest-0.in.applicationinsights.azure.com/;LiveEndpoint=https://ukwest.livediagnostics.monitor.azure.com/;ApplicationId=0c297349-396b-4dc6-8b56-85f5c680adc6
|
||||
|
||||
|
||||
HIDEERRORLOGS = false
|
||||
@@ -94,8 +94,28 @@ export function Textfield(props) {
|
||||
maxFieldLength,
|
||||
hint,
|
||||
} = props;
|
||||
const required = (value) =>
|
||||
value ? undefined : t("newappeal:is-required-label");
|
||||
// const required = (value) =>
|
||||
// value ? undefined : t("newappeal:is-required-label");
|
||||
|
||||
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(
|
||||
@@ -271,7 +291,25 @@ export function MultiLinefield(props) {
|
||||
maxFieldLength,
|
||||
hint,
|
||||
} = props;
|
||||
const required = (value) => (value ? undefined : "Is required");
|
||||
|
||||
const required = (value) => {
|
||||
let errors;
|
||||
|
||||
// Check for the required field
|
||||
if (!value) {
|
||||
errors = "This field is required";
|
||||
} 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;
|
||||
};
|
||||
|
||||
var showIfHasParentShowValue =
|
||||
parentField != false &&
|
||||
@@ -2004,6 +2042,20 @@ const RenderSubFields = ({ fields }) => {
|
||||
|
||||
let subTitle = fields.name.split("pinswg_")[1];
|
||||
|
||||
const checkValue = (value) => {
|
||||
let errors;
|
||||
|
||||
// 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;
|
||||
};
|
||||
|
||||
return (
|
||||
<ul>
|
||||
<div>
|
||||
@@ -2019,6 +2071,7 @@ const RenderSubFields = ({ fields }) => {
|
||||
name={`${member}.${fields.name}`}
|
||||
type="text"
|
||||
component={RenderTextfield}
|
||||
validate={[checkValue]}
|
||||
label={
|
||||
subTitle == "owners"
|
||||
? "Owners name"
|
||||
@@ -2085,6 +2138,7 @@ export const FieldArrayForm = (props) => {
|
||||
|
||||
parentFieldShowOnValue;
|
||||
const { handleSubmit, pristine, reset, submitting } = props;
|
||||
|
||||
return (
|
||||
<>
|
||||
{" "}
|
||||
|
||||
@@ -65,6 +65,45 @@ const TopThree = (props) => {
|
||||
return dateB - dateA;
|
||||
});
|
||||
|
||||
// check start
|
||||
|
||||
function sortByISODate(arr, dateKey) {
|
||||
return arr.sort((a, b) => new Date(b[dateKey]) - new Date(a[dateKey]));
|
||||
}
|
||||
|
||||
function sortByField(arr, field, ascending = true) {
|
||||
return arr.sort((a, b) => {
|
||||
if (a[field] < b[field]) return ascending ? -1 : 1;
|
||||
if (a[field] > b[field]) return ascending ? 1 : -1;
|
||||
return 0; // Equal
|
||||
});
|
||||
}
|
||||
|
||||
//let showTopThreeArr = showTopThree.value;
|
||||
let showTopThreeArrDets = showDetails;
|
||||
|
||||
showTopThreeArr = sortByField(showTopThreeArr, "ticketnumber");
|
||||
//console.log("showTopThreeArr:", showTopThreeArr);
|
||||
showTopThreeArrDets = sortByField(showTopThreeArrDets, "pinswg_name");
|
||||
//console.log("showTopThreeArrDets:", showTopThreeArrDets);
|
||||
|
||||
showTopThreeArrDets = showTopThreeArrDets.flatMap((item) => item.value);
|
||||
|
||||
let mergedArray = showTopThreeArr.map((item1) => {
|
||||
let item2 = showTopThreeArrDets.find(
|
||||
(item) => item.pinswg_name === item1.ticketnumber
|
||||
);
|
||||
return { ...item1, ...item2 };
|
||||
});
|
||||
|
||||
console.log(mergedArray);
|
||||
|
||||
showTopThreeArr = mergedArray;
|
||||
|
||||
showTopThreeArr = sortByISODate(showTopThreeArr, "createdon");
|
||||
|
||||
// check end
|
||||
|
||||
const raisedDate = (datePart) => {
|
||||
var dateObj = new Date(datePart);
|
||||
return dateObj.toLocaleString();
|
||||
@@ -130,7 +169,7 @@ const TopThree = (props) => {
|
||||
}
|
||||
};
|
||||
|
||||
let topThreeOnlyArr = showTopThreeArr.slice(0, 3);
|
||||
let topThreeOnlyArr = showTopThreeArr; //.slice(0, 3);
|
||||
Object.keys(topThreeOnlyArr).map((key, index) => {
|
||||
topthreeRow.push(
|
||||
<div className="cardModuleItem" key={index}>
|
||||
@@ -249,34 +288,28 @@ const TopThree = (props) => {
|
||||
{/* {topThreeType != "awaitingSubmission" ? ( */}
|
||||
<div className="carModuleAddress">
|
||||
<b>{t("myportal:case-address")}:</b>{" "}
|
||||
{_.isEmpty(showDetails)
|
||||
{_.isEmpty(showTopThreeArr[key])
|
||||
? t("myportal:case-address-not-entered")
|
||||
: _.isEmpty(showDetails[index])
|
||||
: _.isEmpty(showTopThreeArr[key])
|
||||
? t("myportal:case-address-not-entered")
|
||||
: _.isEmpty(showDetails[index].value[0])
|
||||
: _.isEmpty(showTopThreeArr[key])
|
||||
? t("myportal:case-address-not-entered")
|
||||
: _.isEmpty(
|
||||
showDetails[index].value[0]
|
||||
.pinswg_siteaddressline1
|
||||
showTopThreeArr[key].pinswg_siteaddressline1
|
||||
)
|
||||
? t("myportal:case-address-not-entered")
|
||||
: showDetails[index].value[0]
|
||||
.pinswg_siteaddressline1 +
|
||||
: showTopThreeArr[key].pinswg_siteaddressline1 +
|
||||
(!_.isEmpty(
|
||||
showDetails[index].value[0]
|
||||
.pinswg_siteaddressline2
|
||||
showTopThreeArr[key].pinswg_siteaddressline2
|
||||
)
|
||||
? ", " +
|
||||
showDetails[index].value[0]
|
||||
.pinswg_siteaddressline2
|
||||
showTopThreeArr[key].pinswg_siteaddressline2
|
||||
: "") +
|
||||
(!_.isEmpty(
|
||||
showDetails[index].value[0]
|
||||
.pinswg_siteaddresstown
|
||||
showTopThreeArr[key].pinswg_siteaddresstown
|
||||
)
|
||||
? ", " +
|
||||
showDetails[index].value[0]
|
||||
.pinswg_siteaddresstown
|
||||
showTopThreeArr[key].pinswg_siteaddresstown
|
||||
: "")}
|
||||
</div>
|
||||
{showTopThreeArr[key].pinswg_appellantagent != null && (
|
||||
@@ -285,12 +318,14 @@ const TopThree = (props) => {
|
||||
846040000 && (
|
||||
<b>{t("myportal:raised-by-label")}: </b>
|
||||
)}
|
||||
|
||||
{showTopThreeArr[key].pinswg_appellantagent !=
|
||||
846040000 &&
|
||||
(showTopThreeArr[key].pinswg_agentcompanyname !=
|
||||
null &&
|
||||
showTopThreeArr[key]
|
||||
.pinswg_agentcompanyname + ", ") +
|
||||
null
|
||||
? showTopThreeArr[key]
|
||||
.pinswg_agentcompanyname + ", "
|
||||
: "") +
|
||||
showTopThreeArr[key].pinswg_agentfirstname +
|
||||
" " +
|
||||
showTopThreeArr[key].pinswg_agentlastname}
|
||||
|
||||
@@ -178,7 +178,22 @@ const RenderRadio = ({
|
||||
...custom
|
||||
}) => {
|
||||
let { t } = useTranslation();
|
||||
const required = (value) => (value ? undefined : "Required");
|
||||
const required = (value) => {
|
||||
// Check for the required field
|
||||
if (!value) {
|
||||
errors = "This field is required";
|
||||
}
|
||||
|
||||
// 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;
|
||||
};
|
||||
return (
|
||||
<>
|
||||
<div
|
||||
@@ -301,7 +316,24 @@ function Radiofield(props) {
|
||||
} = props;
|
||||
|
||||
const router = useRouter();
|
||||
const required = (value) => (value ? undefined : "Required");
|
||||
const required = (value) => {
|
||||
let errors = {};
|
||||
|
||||
// Check for the required field
|
||||
if (!value) {
|
||||
errors = "This field is required";
|
||||
}
|
||||
|
||||
// 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;
|
||||
};
|
||||
//console.log(props.options);
|
||||
|
||||
const fieldOptions = props.options
|
||||
@@ -385,7 +417,24 @@ const RenderCheckBox = ({
|
||||
...custom
|
||||
}) => {
|
||||
let { t } = useTranslation();
|
||||
const required = (value) => (value ? undefined : "Required");
|
||||
const required = (value) => {
|
||||
let errors = {};
|
||||
|
||||
// Check for the required field
|
||||
if (!value) {
|
||||
errors = "This field is required";
|
||||
}
|
||||
|
||||
// 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;
|
||||
};
|
||||
|
||||
return (
|
||||
<>
|
||||
@@ -455,7 +504,24 @@ let AboutYou = (props) => {
|
||||
const contactPref =
|
||||
router.locale == "cy" ? ["Ebost", "Post"] : ["Email", "Post"];
|
||||
|
||||
const required = (value) => (value ? undefined : "Is required");
|
||||
const required = (value) => {
|
||||
let errors = {};
|
||||
|
||||
// Check for the required field
|
||||
if (!value) {
|
||||
errors = "This field is required";
|
||||
}
|
||||
|
||||
// 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 emailRegex =
|
||||
/(?:[a-z0-9!#$%&'*+\/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&'*+\/=?^_`{|}~-]+)*|"(?:[\x01-\x08\x0b\x0c\x0e-\x1f\x21\x23-\x5b\x5d-\x7f]|\\[\x01-\x09\x0b\x0c\x0e-\x7f])*")@(?:(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?|\[(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?|[a-z0-9-]*[a-z0-9]:(?:[\x01-\x08\x0b\x0c\x0e-\x1f\x21-\x5a\x53-\x7f]|\\[\x01-\x09\x0b\x0c\x0e-\x7f])+)\])/gi;
|
||||
|
||||
|
||||
@@ -68,7 +68,7 @@
|
||||
</row>
|
||||
<row>
|
||||
<labels>
|
||||
<label description="What date was your application decided on by the LPA?" />
|
||||
<label description="What date was your application decided on by the LPA?" hint="newappeal:new-appeal-dateoflpadecision-hint" />
|
||||
</labels>
|
||||
<control id="pinswg_dateoflpadecision" parentField="pinswg_caseworkreason" parentFieldShowOnValue="846040000" classid="{5B773807-9FB2-42db-97C3-7A91EFF8ADFF}" datafieldname="pinswg_dateoflpadecision" dateStart="-6m" dateEnd="0" disabled="false" />
|
||||
</row>
|
||||
|
||||
@@ -60,7 +60,8 @@
|
||||
"new-appeal-introduction-warning-bullet-one": "gyflwyno eich apêl o fewn 6 mis o ddyddiad hysbysiad o benderfyniad yr Awdurdod Cynllunio Lleol",
|
||||
"new-appeal-introduction-warning-bullet-two": "darparu'r holl ddogfennau ategol hanfodol o fewn y cyfnod apelio",
|
||||
"new-appeal-development-description-hint": "Nodwch fanylion y datblygiad arfaethedig o'r ffurflen gais cynllunio. Os cafodd y cais ei ddiwygio tra oedd gyda’r ACLl, nodwch fanylion y cynllun diwygiedig ac amgaewch gopi o gytundeb yr ACLl i’r newid.",
|
||||
"new-appeal-dateofapplication-hint": "Dyma ddyddiad y ffurflen gais wreiddiol ",
|
||||
"new-appeal-dateofapplication-hint": "Dyma’r dyddiad y gwnaethoch gyflwyno’r cais gwreiddiol i’r awdurdod cynllunio lleol. Nid yw'r ffurflen hon yn gallu prosesu apeliadau gyda dyddiadau ymgeisio sy'n hŷn na phum mlynedd. Os gwnaed eich cais fwy na phum mlynedd yn ôl yna cysylltwch â'r swyddfa am gymorth.",
|
||||
"new-appeal-dateoflpadecision-hint": "Dyma’r dyddiad y cyhoeddodd yr ACLl ei benderfyniad ar eich cais. Sylwch, nid dyma'r dyddiad y cawsoch y penderfyniad, yn hytrach y dyddiad a ysgrifennwyd ar y penderfyniad. Ni all y ffurflen hon brosesu apeliadau sydd â dyddiad penderfynu sy'n hŷn na 6 mis. Os cyhoeddwyd eich penderfyniad fwy na 6 mis yn ôl yna efallai eich bod wedi rhedeg allan o amser i apelio. Cysylltwch â'r swyddfa am gymorth.",
|
||||
"new-appeal-ownership-hint": "Mae angen i ni wybod pwy sy'n berchen ar safle'r apêl neu ran ohono, a bod pob perchennog yn gwybod eich bod wedi gwneud apêl. Defnyddiwch y nodiadau canllaw i gwblhau'r adran hon.",
|
||||
"new-appeal-ownership-option-NA": "Amherthnasol",
|
||||
"new-appeal-ownership-option-A": "Tystysgrif A - (ar gyfer unig berchnogion safle'r apêl). Tystiaf, ar y diwrnod 21 diwrnod cyn dyddiad yr apêl hon, nad oedd neb heblaw’r apelydd yn berchennog (gweler y daflen arweiniad am ddiffiniad) unrhyw ran o’r tir y mae’r apêl yn ymwneud ag ef.",
|
||||
|
||||
@@ -59,7 +59,8 @@
|
||||
"new-appeal-introduction-warning-bullet-one": "submit your appeal within 6 months of the date of the Local Planning Authority's decision notice",
|
||||
"new-appeal-introduction-warning-bullet-two": "provide all essential supporting documents within the appeal period",
|
||||
"new-appeal-development-description-hint": "Enter details of the proposed development from the planning application form. If the application was revised while it was with the LPA enter details of the revised scheme and enclose a copy of the LPA’s agreement to the change.",
|
||||
"new-appeal-dateofapplication-hint": "This is the date of the original application form",
|
||||
"new-appeal-dateofapplication-hint": "This is the date that you submitted the original application to the local planning authority. This form is not able to process appeals with application dates older than five years. If your application was made more than five years ago then please contact the office for help.",
|
||||
"new-appeal-dateoflpadecision-hint": "This is the date that the LPA issued their decision on your application. Please note, this is not the date you received the decision, rather the date written on the decision. This form in not able to process appeals with a decision date older than 6 months. If your decision was issued more than 6 months ago then you may have run out of time to appeal. Please contact the office for help.",
|
||||
"new-appeal-ownership-hint": "We need to know who owns the appeal site or part of it, and that all owners know you have made an appeal. Use the guidance notes to complete this section.",
|
||||
"new-appeal-ownership-option-NA": "Not applicable",
|
||||
"new-appeal-ownership-option-A": "Certificate A - (for sole owners of the appeal site). I certify that, on the day 21 days before the date of this appeal, nobody except the appellant, was the owner (see the guidance leaflet for a definition) of any part of the land to which the appeal relates",
|
||||
|
||||
Reference in New Issue
Block a user