Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Solve Document Field Problems with the blockDocument property (CPF) #135

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
6 changes: 3 additions & 3 deletions react/ProfileField.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 = () => {
Expand All @@ -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 (
<Input
Expand Down