- added registartion page;
- implemented validation helper-functions; - fixed form fields datepicker and datepicker range; - updated routes logic; - fixed FAQ items editing/submission;
This commit is contained in:
5
src/helpers/renderHtmlContent.js
Normal file
5
src/helpers/renderHtmlContent.js
Normal file
@@ -0,0 +1,5 @@
|
||||
import parse from 'html-react-parser';
|
||||
|
||||
const renderHtmlContent = (content) => parse(content);
|
||||
|
||||
export default renderHtmlContent;
|
||||
@@ -1,27 +1,58 @@
|
||||
import validate from 'validate.js';
|
||||
import { match, isEmpty } from 'ramda';
|
||||
import CodiceFiscale from 'codice-fiscale-js';
|
||||
|
||||
export const isPIVA = (v) => {
|
||||
return false;
|
||||
}
|
||||
|
||||
// example: DSDDSD99P23B352G
|
||||
export const isCodiceFiscale = (v) => {
|
||||
return false;
|
||||
//const regexp = new RegExp(/^(?:[A-Z][AEIOU][AEIOUX]|[AEIOU]X{2}|[B-DF-HJ-NP-TV-Z]{2}[A-Z]){2}(?:[\dLMNP-V]{2}(?:[A-EHLMPR-T](?:[04LQ][1-9MNP-V]|[15MR][\dLMNP-V]|[26NS][0-8LMNP-U])|[DHPS][37PT][0L]|[ACELMRT][37PT][01LM]|[AC-EHLMPR-T][26NS][9V])|(?:[02468LNQSU][048LQU]|[13579MPRTV][26NS])B[26NS][9V])(?:[A-MZ][1-9MNP-V][\dLMNP-V]{2}|[A-M][0L](?:[1-9MNP-V][\dLMNP-V]|[0L][1-9MNP-V]))[A-Z]$/, 'i')
|
||||
//return !isEmpty(match(regexp, v));
|
||||
return CodiceFiscale.check(v);
|
||||
}
|
||||
|
||||
export const isCAP = (v) => {
|
||||
return false;
|
||||
const regexp = new RegExp(/^[0-9]{5}$/)
|
||||
return !isEmpty(match(regexp, v));
|
||||
}
|
||||
|
||||
export const isIBAN = (v) => {
|
||||
return false;
|
||||
const regexp = new RegExp(/^((NO)[0-9A-Z]{2}[ ][0-9A-Z]{4}[ ][0-9A-Z]{4}[ ][0-9A-Z]{3}|(NO)[0-9A-Z]{13}|(BE)[0-9A-Z]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0-9A-Z]{4}[ ][0-9A-Z]{1}|(PT)[0-9A-Z]{23}|(IS|TR)[0-9A-Z]{2}[ ][0-9A-Z]{4}[ ][0-9A-Z]{4}[ ][0-9A-Z]{4}[ ][0-9A-Z]{4}[ ][0-9A-Z]{4}[ ][0-9A-Z]{2}|(IS|TR)[0-9A-Z]{24}|(FR|GR|IT|MC|SM)[0-9A-Z]{2}[ ][0-9A-Z]{4}[ ][0-9A-Z]{4}[ ][0-9A-Z]{4}[ ][0-9A-Z]{4}[ ][0-9A-Z]{4}[ ][0-9A-Z]{3}|(FR|GR|IT|MC|SM)[0-9A-Z]{25}|(AL|CY|HU|LB|PL)[0-9A-Z]{2}[ ][0-9A-Z]{4}[ ][0-9A-Z]{4}[ ][0-9A-Z]{4}[ ][0-9A-Z]{4}[ ][0-9A-Z]{4}[ ][0-9A-Z]{4}|(AL|CY|HU|LB|PL)[0-9A-Z]{26}|(MU)[0-9A-Z]{2}[ ][0-9A-Z]{4}[ ][0-9A-Z]{4}[ ][0-9A-Z]{4}[ ][0-9A-Z]{4}[ ][0-9A-Z]{4}[ ][0-9A-Z]{4}[ ][0-9A-Z]{2}|(MU)[0-9A-Z]{28}|(MT)[0-9A-Z]{2}[ ][0-9A-Z]{4}[ ][0-9A-Z]{4}[ ][0-9A-Z]{4}[ ][0-9A-Z]{4}[ ][0-9A-Z]{4}[ ][0-9A-Z]{4}[ ][0-9A-Z]{3}|(MT)[0-9A-Z]{29})$/)
|
||||
return !isEmpty(match(regexp, v));
|
||||
}
|
||||
|
||||
export const isEmail = (v) => {
|
||||
return false;
|
||||
const constraints = {
|
||||
from: {
|
||||
email: true
|
||||
}
|
||||
};
|
||||
const res = validate({from: v}, constraints);
|
||||
return !res;
|
||||
}
|
||||
|
||||
export const isEmailPEC = (v) => {
|
||||
return false;
|
||||
const constraints = {
|
||||
from: {
|
||||
email: true
|
||||
}
|
||||
};
|
||||
const res = validate({from: v}, constraints);
|
||||
return !res;
|
||||
}
|
||||
|
||||
export const isUrl = (v) => {
|
||||
return false;
|
||||
const constraints = {
|
||||
from: {
|
||||
url: true
|
||||
}
|
||||
};
|
||||
const res = validate({from: v}, constraints);
|
||||
return !res;
|
||||
}
|
||||
|
||||
export const isMarcaDaBollo = (v) => {
|
||||
return true;
|
||||
}
|
||||
Reference in New Issue
Block a user