From 60ed53736f954b4ea7f4eb43ddb79dc4c7bbd2ba Mon Sep 17 00:00:00 2001 From: Tiago Granelli Ribeiro Date: Wed, 24 Nov 2021 09:14:33 -0300 Subject: [PATCH 1/2] Add verification if the user's document is filled 1- Added a check to block the field only when the document field is filled 2- Added an "active" property to not lock the field while the user is editing it --- react/ProfileField.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/react/ProfileField.js b/react/ProfileField.js index f1d8e393..d2d6ea2b 100644 --- a/react/ProfileField.js +++ b/react/ProfileField.js @@ -20,7 +20,7 @@ class ProfileField extends Component { const error = data.touched ? applyValidation(field, value) : null const maskedValue = applyMask(field, value) - onFieldUpdate({ [field.name]: { ...data, value: maskedValue, error } }) + onFieldUpdate({ [field.name]: { ...data, value: maskedValue, error, active: true }}) } handleBlur = () => { @@ -37,8 +37,8 @@ class ProfileField extends Component { render() { const { field, data, options, Input, userProfile, blockDocument } = this.props - if(blockDocument && field.name === 'document' && userProfile['document'].value !== null){ - field.disabled = true + if(blockDocument && field.name === 'document' && userProfile.document.value.length >= 14 && !userProfile.document.hasOwnProperty('active')) { + field.disabled = true } return ( Date: Wed, 24 Nov 2021 11:35:08 -0300 Subject: [PATCH 2/2] Update CHANGELOG.md Add verification if the user's document is filled with the blockDocument property --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 0107360b..2dfa95d4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,7 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/) and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html). ## [Unreleased] +- Add verification if the user's document is filled with the blockDocument property ## [2.15.0] - 2021-11-04