- enabled codice fiscale always;
- updated cf validation;
This commit is contained in:
@@ -4,6 +4,7 @@ import CodiceFiscale from 'codice-fiscale-js';
|
|||||||
|
|
||||||
export const isPIVA = (v) => {
|
export const isPIVA = (v) => {
|
||||||
const regexp = new RegExp(/^[0-9]{11}$/);
|
const regexp = new RegExp(/^[0-9]{11}$/);
|
||||||
|
//console.log('isPIVA', !isEmpty(match(regexp, String(v))))
|
||||||
return !isEmpty(match(regexp, String(v)));
|
return !isEmpty(match(regexp, String(v)));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -11,6 +12,7 @@ export const isPIVA = (v) => {
|
|||||||
export const isCodiceFiscale = (v) => {
|
export const isCodiceFiscale = (v) => {
|
||||||
//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')
|
//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 !isEmpty(match(regexp, v));
|
||||||
|
//console.log('isCodiceFiscale', CodiceFiscale.check(v))
|
||||||
return CodiceFiscale.check(v);
|
return CodiceFiscale.check(v);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -19,7 +19,7 @@ import BlockingOverlay from '../../components/BlockingOverlay';
|
|||||||
import CompanyService from '../../service/company-service';
|
import CompanyService from '../../service/company-service';
|
||||||
|
|
||||||
// tools
|
// tools
|
||||||
import { isPIVA, isEmail, isEmailPEC } from '../../helpers/validators';
|
import { isPIVA, isEmail, isEmailPEC, isCodiceFiscale } from '../../helpers/validators';
|
||||||
import set404FromErrorResponse from '../../helpers/set404FromErrorResponse';
|
import set404FromErrorResponse from '../../helpers/set404FromErrorResponse';
|
||||||
|
|
||||||
//const APP_EVALUATION_FLOW_ID = process.env.REACT_APP_EVALUATION_FLOW_ID;
|
//const APP_EVALUATION_FLOW_ID = process.env.REACT_APP_EVALUATION_FLOW_ID;
|
||||||
@@ -218,12 +218,16 @@ const AddCompany = () => {
|
|||||||
|
|
||||||
<FormField
|
<FormField
|
||||||
type="textinput"
|
type="textinput"
|
||||||
disabled
|
|
||||||
fieldName="codiceFiscale"
|
fieldName="codiceFiscale"
|
||||||
label={__('Codice fiscale', 'gepafin')}
|
label={__('Codice fiscale', 'gepafin')}
|
||||||
control={control}
|
control={control}
|
||||||
errors={errors}
|
errors={errors}
|
||||||
config={{ required: __('È obbligatorio', 'gepafin') }}
|
config={{
|
||||||
|
required: __('È obbligatorio', 'gepafin'),
|
||||||
|
validate: {
|
||||||
|
validCF: (value) => isCodiceFiscale(value) || isPIVA(value)
|
||||||
|
}
|
||||||
|
}}
|
||||||
/>
|
/>
|
||||||
{/*{APP_EVALUATION_FLOW_ID === '1'
|
{/*{APP_EVALUATION_FLOW_ID === '1'
|
||||||
? <FormField
|
? <FormField
|
||||||
|
|||||||
Reference in New Issue
Block a user