|
|
|
@ -33,10 +33,8 @@ class DataUser extends Component {
@@ -33,10 +33,8 @@ class DataUser extends Component {
|
|
|
|
|
}; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
componentDidMount(){ |
|
|
|
|
if(this.props.location.search){ |
|
|
|
|
const {users} = this.props; |
|
|
|
|
|
|
|
|
|
openUserD(location, users){ |
|
|
|
|
if(location.search){ |
|
|
|
|
let params = (new URL(document.location)).searchParams; |
|
|
|
|
let id = params.get('id') |
|
|
|
|
console.log("🚀 ~ file: index.jsx ~ line 42 ~ DataUser ~ componentWillReceiveProps ~ id", id) |
|
|
|
@ -54,23 +52,13 @@ class DataUser extends Component {
@@ -54,23 +52,13 @@ class DataUser extends Component {
|
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
componentDidMount(){ |
|
|
|
|
this.openUserD(this.props.location, this.props.users) |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
componentWillReceiveProps(nextProps) { |
|
|
|
|
if(this.props.location.search != nextProps.location.search){ |
|
|
|
|
const {users} = nextProps; |
|
|
|
|
|
|
|
|
|
let params = (new URL(document.location)).searchParams; |
|
|
|
|
let id = params.get('id') |
|
|
|
|
console.log("🚀 ~ file: index.jsx ~ line 42 ~ DataUser ~ componentWillReceiveProps ~ id", id) |
|
|
|
|
if(id){ |
|
|
|
|
const user = users.find(_i => _i.id == id); |
|
|
|
|
console.log("🚀 ~ file: index.jsx ~ line 44 ~ DataUser ~ componentWillReceiveProps ~ user", user) |
|
|
|
|
if(user){ |
|
|
|
|
this.setState({ |
|
|
|
|
showModal: Boolean(user), |
|
|
|
|
selectedUser: {...user, date_of_birth: moment(user.date_of_birth).isValid() ? moment(user.date_of_birth).format('DD MMMM') : ''}, |
|
|
|
|
}) |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
this.openUserD(nextProps.location, nextProps.users); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
@ -125,16 +113,14 @@ class DataUser extends Component {
@@ -125,16 +113,14 @@ class DataUser extends Component {
|
|
|
|
|
if (user.date_of_birth) { |
|
|
|
|
const date = user.date_of_birth; |
|
|
|
|
user.date_of_birth = moment(date).isValid() ? moment(date).format('DD MMMM') : ''; |
|
|
|
|
user.date_of_birth_mm = moment(date).isValid() ? moment(date).format('M') : ''; |
|
|
|
|
user.date_of_birth_dd = moment(date).isValid() ? moment(date).format('D') : ''; |
|
|
|
|
user.date_of_birth_unix = moment(date).isValid() ? moment(moment(date).format('MM-DD-2000')).toDate() : ''; |
|
|
|
|
} |
|
|
|
|
return { ...user }; |
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if(showUserD){ |
|
|
|
|
tmp_users = orderBy(tmp_users, ['date_of_birth_dd', 'date_of_birth_mm'], ['asc', 'asc']).filter(_i => _i.date_of_birth_mm >= moment().format('M') && _i.date_of_birth_dd >= moment().format('D')) |
|
|
|
|
tmp_users = orderBy(tmp_users, ['date_of_birth_unix'], ['asc']).filter(_i => _i.date_of_birth_unix >= moment(moment().format('MM-DD-2000')).toDate()) |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|