Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
A
anawork-mobile-v2
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
dungtnguyen
anawork-mobile-v2
Commits
6a8e5bdb
Commit
6a8e5bdb
authored
Oct 13, 2024
by
dungtnguyen
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
change user info
parent
49289102
Changes
20
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
20 changed files
with
397 additions
and
571 deletions
+397
-571
app-release-final.apk
android/app/release/app-release-final.apk
+0
-0
app-release.dm
android/app/release/baselineProfiles/0/app-release.dm
+0
-0
app-release.dm
android/app/release/baselineProfiles/1/app-release.dm
+0
-0
output-metadata.json
android/app/release/output-metadata.json
+37
-0
authAPI.js
src/api/authAPI.js
+1
-1
onLeaveApi.js
src/api/onLeaveApi.js
+1
-1
profileAPI.js
src/api/profileAPI.js
+4
-0
index.js
src/config/index.js
+5
-1
authSlice.js
src/screens/authentication/authSlice.js
+19
-0
LoginContainer.js
src/screens/authentication/login/LoginContainer.js
+2
-3
ConfirmDateContainer.js
src/screens/confirm_date/ConfirmDateContainer.js
+5
-0
OnLeaveContainer.js
src/screens/onleave/OnLeaveContainer.js
+6
-0
onLeaveSlice.js
src/screens/onleave/onLeaveSlice.js
+1
-1
style.js
src/screens/onleave/style.js
+2
-2
ProfileContainer.js
src/screens/profile/ProfileContainer.js
+80
-284
profilePropsProvider.js
src/screens/profile/profilePropsProvider.js
+6
-67
profileSlice.js
src/screens/profile/profileSlice.js
+36
-0
ProfileMainView.js
src/screens/profile/template/ProfileMainView.js
+19
-175
DetailInformation.js
src/screens/profile/template/components/DetailInformation.js
+86
-18
PersonalInformation.js
...creens/profile/template/components/PersonalInformation.js
+87
-18
No files found.
android/app/release/app-release-final.apk
0 → 100644
View file @
6a8e5bdb
File added
android/app/release/baselineProfiles/0/app-release.dm
0 → 100644
View file @
6a8e5bdb
File added
android/app/release/baselineProfiles/1/app-release.dm
0 → 100644
View file @
6a8e5bdb
File added
android/app/release/output-metadata.json
0 → 100644
View file @
6a8e5bdb
{
"version"
:
3
,
"artifactType"
:
{
"type"
:
"APK"
,
"kind"
:
"Directory"
},
"applicationId"
:
"com.anawork_mobile"
,
"variantName"
:
"release"
,
"elements"
:
[
{
"type"
:
"SINGLE"
,
"filters"
:
[],
"attributes"
:
[],
"versionCode"
:
1
,
"versionName"
:
"1.0"
,
"outputFile"
:
"app-release.apk"
}
],
"elementType"
:
"File"
,
"baselineProfiles"
:
[
{
"minApi"
:
28
,
"maxApi"
:
30
,
"baselineProfiles"
:
[
"baselineProfiles/1/app-release.dm"
]
},
{
"minApi"
:
31
,
"maxApi"
:
2147483647
,
"baselineProfiles"
:
[
"baselineProfiles/0/app-release.dm"
]
}
],
"minSdkVersionForDexing"
:
23
}
\ No newline at end of file
src/api/authAPI.js
View file @
6a8e5bdb
...
@@ -14,7 +14,7 @@ const authAPI = {
...
@@ -14,7 +14,7 @@ const authAPI = {
`authenticate/authenticate?username=
${
username
}
&password=
${
password
}
`
,
`authenticate/authenticate?username=
${
username
}
&password=
${
password
}
`
,
),
),
requestLogout
:
(
{
token
})
=>
axiosClient
.
post
(
'authenticate/logout'
,
{
token
}
),
requestLogout
:
(
)
=>
axiosClient
.
post
(
'authenticate/logout'
),
requestGetMyInfo
:
()
=>
axiosClient
.
get
(
'authenticate/getMyInfo'
),
requestGetMyInfo
:
()
=>
axiosClient
.
get
(
'authenticate/getMyInfo'
),
requestGetCompanyLogo
:
()
=>
axiosClient
.
get
(
'companyInfo'
),
requestGetCompanyLogo
:
()
=>
axiosClient
.
get
(
'companyInfo'
),
...
...
src/
network/
api/onLeaveApi.js
→
src/api/onLeaveApi.js
View file @
6a8e5bdb
import
axiosClient
from
'../axios'
;
import
axiosClient
from
'../
network/
axios'
;
export
default
{
export
default
{
requestGetLeavesDay
:
({
filter
,
sort
,
page
,
pageSize
})
=>
requestGetLeavesDay
:
({
filter
,
sort
,
page
,
pageSize
})
=>
axiosClient
.
get
(
axiosClient
.
get
(
...
...
src/api/profileAPI.js
0 → 100644
View file @
6a8e5bdb
import
axiosClient
from
'../network/axios'
;
export
default
{
requestChangeUserInfo
:
({
id
,
body
})
=>
axiosClient
.
put
(
`users/
${
id
}
`
,
body
),
};
src/config/index.js
View file @
6a8e5bdb
...
@@ -2,7 +2,10 @@ const storageKey = {
...
@@ -2,7 +2,10 @@ const storageKey = {
AUTH
:
'auth'
,
AUTH
:
'auth'
,
LANGUAGE
:
'language'
,
LANGUAGE
:
'language'
,
};
};
const
profileField
=
{
PERSONAL_INFO
:
'Personal Information'
,
DETAIL_INFO
:
'Detail Information'
,
};
export
default
{
export
default
{
apiEndpoint
:
'https://gateway.dev.meu-solutions.com/staginganawork/api/'
,
apiEndpoint
:
'https://gateway.dev.meu-solutions.com/staginganawork/api/'
,
//apiEndpoint: 'https://gateway.dev.meu-solutions.com/techport/api/',
//apiEndpoint: 'https://gateway.dev.meu-solutions.com/techport/api/',
...
@@ -11,4 +14,5 @@ export default {
...
@@ -11,4 +14,5 @@ export default {
ONE_SIGNAL_KEY
:
'6f4f8bd1-9b43-4067-8175-c0052140e891'
,
ONE_SIGNAL_KEY
:
'6f4f8bd1-9b43-4067-8175-c0052140e891'
,
axiosTimeout
:
10000
,
axiosTimeout
:
10000
,
storageKey
,
storageKey
,
profileField
,
};
};
src/screens/authentication/authSlice.js
View file @
6a8e5bdb
...
@@ -52,6 +52,19 @@ export const getCompanyInfo = createAsyncThunk(
...
@@ -52,6 +52,19 @@ export const getCompanyInfo = createAsyncThunk(
});
});
},
},
);
);
export
const
logout
=
createAsyncThunk
(
'auth/logout'
,
async
(
data
,
thunkAPI
)
=>
{
return
serviceRequest
({
dispatch
:
thunkAPI
.
dispatch
,
serviceMethod
:
authAPI
.
requestLogout
,
payload
:
data
,
options
:
{
skipLoader
:
false
,
},
});
},
);
const
authSlice
=
createSlice
({
const
authSlice
=
createSlice
({
name
:
'auth'
,
name
:
'auth'
,
initialState
:
initialState
,
initialState
:
initialState
,
...
@@ -71,6 +84,12 @@ const authSlice = createSlice({
...
@@ -71,6 +84,12 @@ const authSlice = createSlice({
state
.
userInfo
=
user
;
state
.
userInfo
=
user
;
}
}
});
});
builder
.
addCase
(
logout
.
fulfilled
,
(
state
,
action
)
=>
{
const
{
success
}
=
Utils
.
getValues
(
action
,
'payload'
,
false
);
if
(
success
)
{
Utils
.
removeData
(
config
.
storageKey
.
AUTH
);
}
});
},
},
});
});
...
...
src/screens/authentication/login/LoginContainer.js
View file @
6a8e5bdb
/* eslint-disable prettier/prettier */
import
React
,
{
useState
}
from
'react'
;
import
React
,
{
useState
}
from
'react'
;
import
RootNavigation
from
'../../../navigation/RootNavigation'
;
import
RootNavigation
from
'../../../navigation/RootNavigation'
;
import
LoginScreen
from
'./LoginScreen'
;
import
LoginScreen
from
'./LoginScreen'
;
...
@@ -7,11 +6,10 @@ import {useTranslation} from 'react-i18next';
...
@@ -7,11 +6,10 @@ import {useTranslation} from 'react-i18next';
import
OneSignal
from
'react-native-onesignal'
;
import
OneSignal
from
'react-native-onesignal'
;
import
{
useDispatch
,
useSelector
}
from
'react-redux'
;
import
{
useDispatch
,
useSelector
}
from
'react-redux'
;
import
{
loaderSelector
}
from
'../../../app/selectors'
;
import
{
loaderSelector
}
from
'../../../app/selectors'
;
import
{
getMyInfo
}
from
'../../../store/actions/CommonAction'
;
import
Utils
from
'../../../utils'
;
import
Utils
from
'../../../utils'
;
import
{
APP_NAVIGATE_SCREEN
}
from
'../../../utils/constant'
;
import
{
APP_NAVIGATE_SCREEN
}
from
'../../../utils/constant'
;
import
{
ToastMessage
}
from
'../../../utils/MessageUtil'
;
import
{
ToastMessage
}
from
'../../../utils/MessageUtil'
;
import
{
authenticate
}
from
'../authSlice'
;
import
{
authenticate
,
getMyInfo
}
from
'../authSlice'
;
const
LoginContainer
=
props
=>
{
const
LoginContainer
=
props
=>
{
// console.log("props: ", props)
// console.log("props: ", props)
const
dispatch
=
useDispatch
();
const
dispatch
=
useDispatch
();
...
@@ -66,6 +64,7 @@ const LoginContainer = props => {
...
@@ -66,6 +64,7 @@ const LoginContainer = props => {
}),
}),
).
then
(
response
=>
{
).
then
(
response
=>
{
const
{
success
}
=
Utils
.
getValues
(
response
,
'payload'
,
false
);
const
{
success
}
=
Utils
.
getValues
(
response
,
'payload'
,
false
);
dispatch
(
getMyInfo
());
if
(
success
)
{
if
(
success
)
{
ToastMessage
({
ToastMessage
({
title
:
'Hệ thống'
,
title
:
'Hệ thống'
,
...
...
src/screens/confirm_date/ConfirmDateContainer.js
View file @
6a8e5bdb
...
@@ -380,6 +380,11 @@ const ConfirmDateContainer = props => {
...
@@ -380,6 +380,11 @@ const ConfirmDateContainer = props => {
};
};
const
handleSubmitConfirmWorkingDayRequest
=
()
=>
{
const
handleSubmitConfirmWorkingDayRequest
=
()
=>
{
if
(
directManagersList
?.
length
===
0
)
{
if
(
directManagersList
?.
length
===
0
)
{
ToastMessage
({
title
:
'Hệ thống'
,
message
:
'Bạn đã là cấp trên không thể gửi yêu cầu !!!'
,
type
:
'error'
,
});
return
false
;
return
false
;
}
}
const
isSelectedManager
=
directManagersList
.
filter
(
item
=>
item
.
isChecked
);
const
isSelectedManager
=
directManagersList
.
filter
(
item
=>
item
.
isChecked
);
...
...
src/screens/onleave/OnLeaveContainer.js
View file @
6a8e5bdb
...
@@ -334,6 +334,12 @@ const OnLeaveContainer = props => {
...
@@ -334,6 +334,12 @@ const OnLeaveContainer = props => {
};
};
const
handleSubmitLeaveRequest
=
()
=>
{
const
handleSubmitLeaveRequest
=
()
=>
{
if
(
directManagersList
?.
length
===
0
)
{
if
(
directManagersList
?.
length
===
0
)
{
ToastMessage
({
title
:
'Hệ thống'
,
message
:
'Bạn đã là cấp trên không thể gửi yêu cầu !!!'
,
type
:
'info'
,
timeVisible
:
5000
,
});
return
false
;
return
false
;
}
}
const
isSelectedManager
=
directManagersList
.
filter
(
item
=>
item
.
isChecked
);
const
isSelectedManager
=
directManagersList
.
filter
(
item
=>
item
.
isChecked
);
...
...
src/screens/onleave/onLeaveSlice.js
View file @
6a8e5bdb
...
@@ -2,7 +2,7 @@ import {createAsyncThunk, createSlice} from '@reduxjs/toolkit';
...
@@ -2,7 +2,7 @@ import {createAsyncThunk, createSlice} from '@reduxjs/toolkit';
import
serviceRequest
from
'../../app/serviceRequest'
;
import
serviceRequest
from
'../../app/serviceRequest'
;
import
onLeaveApi
from
'../../
network/
api/onLeaveApi'
;
import
onLeaveApi
from
'../../api/onLeaveApi'
;
import
Utils
from
'../../utils'
;
import
Utils
from
'../../utils'
;
const
initialHome
=
{
const
initialHome
=
{
...
...
src/screens/onleave/style.js
View file @
6a8e5bdb
...
@@ -428,9 +428,9 @@ export const leavesModalStyles = StyleSheet.create({
...
@@ -428,9 +428,9 @@ export const leavesModalStyles = StyleSheet.create({
shadowOpacity
:
0.25
,
shadowOpacity
:
0.25
,
shadowRadius
:
4
,
shadowRadius
:
4
,
elevation
:
5
,
elevation
:
5
,
marginTop
:
80
,
marginTop
:
100
,
height
:
windowHeight
,
width
:
'100%'
,
width
:
'100%'
,
height
:
windowHeight
,
},
},
button
:
{
button
:
{
...
...
src/screens/profile/ProfileContainer.js
View file @
6a8e5bdb
This diff is collapsed.
Click to expand it.
src/screens/profile/profilePropsProvider.js
View file @
6a8e5bdb
...
@@ -2,86 +2,24 @@ export default function profilePropsProvider(props) {
...
@@ -2,86 +2,24 @@ export default function profilePropsProvider(props) {
const
{
const
{
userInfo
,
userInfo
,
isEditField
,
isEditField
,
btnAvailable
,
infoUser
,
avatar
,
avatar
,
visibleMenu
,
visibleMenu
,
isSlideShow
,
dateTimePicker
,
contactUser
,
showAlert
,
modalVisible
,
userInputContact
,
setAvatar
,
setInfoUser
,
navigateMain
,
setEditField
,
setBtnAvailable
,
onSaveInfo
,
onDeniedAvatar
,
onDeniedAvatar
,
onConfirmAvatar
,
onConfirmAvatar
,
showMenu
,
showMenu
,
openGallery
,
openGallery
,
showFullScreen
,
hideFullScreen
,
hideMenu
,
hideMenu
,
hideDateTimePicker
,
setDateTimePicker
,
onSubmitChangeContactUser
,
setContactUser
,
onChangeDropDownContactUser
,
onChangeInputContactUser
,
onPressDeleteItem
,
onPressAddItem
,
onConfirmDeleteAlert
,
onCancelAlert
,
setUserInputContact
,
onSubmitCreateNew
,
setModalVisible
,
navigateToLogout
,
navigateToLogout
,
onChangeCoverAvatar
,
onChangeCoverAvatar
,
onEditUserInfo
,
editUserInfo
,
onSubmitChangeInfo
,
}
=
props
;
}
=
props
;
return
{
return
{
userInfo
,
userInfo
,
isEditField
,
btnAvailable
,
infoUser
,
avatar
,
visibleMenu
,
isSlideShow
,
dateTimePicker
,
contactUser
,
showAlert
,
modalVisible
,
userInputContact
,
setAvatar
,
setInfoUser
,
navigateMain
,
setEditField
,
setBtnAvailable
,
onSaveInfo
,
onDeniedAvatar
,
onConfirmAvatar
,
showMenu
,
openGallery
,
showFullScreen
,
hideFullScreen
,
hideMenu
,
hideDateTimePicker
,
setDateTimePicker
,
onSubmitChangeContactUser
,
setContactUser
,
onChangeDropDownContactUser
,
onChangeInputContactUser
,
onPressDeleteItem
,
onPressAddItem
,
onConfirmDeleteAlert
,
onCancelAlert
,
setUserInputContact
,
onSubmitCreateNew
,
setModalVisible
,
navigateToLogout
,
navigateToLogout
,
onChangeCoverAvatar
,
onEditUserInfo
,
editUserInfo
,
introduceUserProps
:
{
introduceUserProps
:
{
userInfo
,
userInfo
,
isEditField
,
isEditField
,
...
@@ -94,5 +32,6 @@ export default function profilePropsProvider(props) {
...
@@ -94,5 +32,6 @@ export default function profilePropsProvider(props) {
openGallery
,
openGallery
,
onChangeCoverAvatar
,
onChangeCoverAvatar
,
},
},
onSubmitChangeInfo
,
};
};
}
}
src/screens/profile/profileSlice.js
View file @
6a8e5bdb
import
{
createAsyncThunk
,
createSlice
}
from
'@reduxjs/toolkit'
;
import
serviceRequest
from
'../../app/serviceRequest'
;
import
Utils
from
'../../utils'
;
import
profileAPI
from
'../../api/profileAPI'
;
const
initialState
=
{};
export
const
changeUserInfo
=
createAsyncThunk
(
'profile/changeUserInfo'
,
async
(
data
,
thunkAPI
)
=>
{
return
serviceRequest
({
dispatch
:
thunkAPI
.
dispatch
,
serviceMethod
:
profileAPI
.
requestChangeUserInfo
,
payload
:
data
,
options
:
{
skipLoader
:
false
,
},
});
},
);
const
profileSlice
=
createSlice
({
name
:
'profile'
,
initialState
:
initialState
,
reducers
:
{},
extraReducers
:
builder
=>
{
builder
.
addCase
(
changeUserInfo
.
fulfilled
,
(
state
,
action
)
=>
{
const
{
success
}
=
Utils
.
getValues
(
action
,
'payload'
,
false
);
});
},
});
const
{
reducer
}
=
profileSlice
;
export
default
reducer
;
src/screens/profile/template/ProfileMainView.js
View file @
6a8e5bdb
import
Moment
from
'moment'
;
import
React
from
'react'
;
import
React
from
'react'
;
import
{
import
{
SafeAreaView
,
ScrollView
,
View
}
from
'react-native'
;
Animated
,
Image
,
ImageBackground
,
Modal
,
SafeAreaView
,
ScrollView
,
TextInput
,
TouchableOpacity
,
View
,
}
from
'react-native'
;
import
Alert
from
'react-native-awesome-alerts'
;
import
{
GestureHandlerRootView
,
Swipeable
}
from
'react-native-gesture-handler'
;
import
{
Menu
,
MenuItem
}
from
'react-native-material-menu'
;
import
DateTimePickerModal
from
'react-native-modal-datetime-picker'
;
import
SelectDropdown
from
'react-native-select-dropdown'
;
import
Swiper
from
'react-native-swiper'
;
import
AppText
from
'../../../components/AppText'
;
import
ButtonComponent
from
'../../../components/ButtonComponent'
;
import
ButtonComponent
from
'../../../components/ButtonComponent'
;
import
TextInputComponent
from
'../../../components/TextInputComponent'
;
import
{
IMAGES
}
from
'../../../values/images'
;
import
{
IMAGES
,
IcNotificationList
,
IconProfile
,
IconSocial
,
}
from
'../../../values/images'
;
import
{
default
as
string
,
default
as
strings
}
from
'../../../values/string'
;
import
styles
from
'../style'
;
import
styles
from
'../style'
;
import
colors
from
'../../../values/colors'
;
import
DetailInformation
from
'./components/DetailInformation'
;
import
config
from
'../../../config'
;
import
IntroduceUser
from
'./components/IntroduceUser'
;
import
GeneralInformation
from
'./components/GeneralInformation'
;
import
GeneralInformation
from
'./components/GeneralInformation'
;
import
IntroduceUser
from
'./components/IntroduceUser'
;
import
PersonalInformation
from
'./components/PersonalInformation'
;
import
PersonalInformation
from
'./components/PersonalInformation'
;
import
DetailInformation
from
'./components/DetailInformation'
;
const
Socials
=
[
'FACEBOOK'
,
'EMAIL'
,
'SKYPE'
,
'LINKEDIN'
,
'TWITTER'
,
'INSTAGRAM'
,
'WHATSAPP'
,
'VIPER'
,
'SNAPCHAT'
,
'TELEGRAM'
,
'APPLE'
,
'YOUTUBE'
,
'PINTEREST'
,
];
const
gender
=
[
'Nam'
,
'Nữ'
];
const
ProfileMainView
=
({
const
ProfileMainView
=
({
userInfo
,
userInfo
,
contactUser
,
btnAvailable
,
isEditField
,
navigateMain
,
setEditField
,
setBtnAvailable
,
infoUser
,
setInfoUser
,
onSaveInfo
,
avatar
=
[],
onDeniedAvatar
,
onConfirmAvatar
,
showMenu
,
hideMenu
,
visibleMenu
,
openGallery
,
isSlideShow
,
showFullScreen
,
hideFullScreen
,
dateTimePicker
,
hideDateTimePicker
,
setDateTimePicker
,
showAlert
,
onSubmitChangeContactUser
,
onChangeDropDownContactUser
,
onChangeInputContactUser
,
onPressDeleteItem
,
onPressAddItem
,
onCancelAlert
,
modalVisible
,
setModalVisible
,
setUserInputContact
,
userInputContact
,
onSubmitCreateNew
,
onConfirmDeleteAlert
,
navigateToLogout
,
navigateToLogout
,
onChangeCoverAvatar
,
introduceUserProps
,
introduceUserProps
,
onEditUserInfo
,
editUserInfo
,
onSubmitChangeInfo
,
})
=>
{
})
=>
{
return
(
return
(
<
SafeAreaView
style
=
{
styles
.
container
}
>
<
SafeAreaView
style
=
{
styles
.
container
}
>
...
@@ -100,9 +24,19 @@ const ProfileMainView = ({
...
@@ -100,9 +24,19 @@ const ProfileMainView = ({
{
/* General information */
}
{
/* General information */
}
<
GeneralInformation
userInfo
=
{
userInfo
}
/
>
<
GeneralInformation
userInfo
=
{
userInfo
}
/
>
{
/* personal information */
}
{
/* personal information */
}
<
PersonalInformation
userInfo
=
{
userInfo
}
/
>
<
PersonalInformation
userInfo
=
{
userInfo
}
onEditUserInfo
=
{
onEditUserInfo
}
editUserInfo
=
{
editUserInfo
}
handleSubmitChangeInfo
=
{
onSubmitChangeInfo
}
/
>
{
/* detail information */
}
{
/* detail information */
}
<
DetailInformation
userInfo
=
{
userInfo
}
/
>
<
DetailInformation
userInfo
=
{
userInfo
}
onEditUserInfo
=
{
onEditUserInfo
}
editUserInfo
=
{
editUserInfo
}
handleSubmitChangeInfo
=
{
onSubmitChangeInfo
}
/
>
{
/* Logout Btn */
}
{
/* Logout Btn */
}
<
View
<
View
style
=
{{
style
=
{{
...
@@ -118,96 +52,6 @@ const ProfileMainView = ({
...
@@ -118,96 +52,6 @@ const ProfileMainView = ({
onPress
=
{
navigateToLogout
}
onPress
=
{
navigateToLogout
}
/
>
/
>
<
/View
>
<
/View
>
{
/* <View style={styles.centeredView}>
<Modal
animationType="slide"
transparent={true}
visible={modalVisible}
onRequestClose={() => {
Alert.alert('Modal has been closed.');
setModalVisible(!modalVisible);
}}>
<View style={styles.centeredView}>
<View style={styles.modalView}>
<View style={{flexDirection: 'row'}}>
<View style={{flex: 1}}>
<SelectDropdown
data={Socials}
dropdownIconPosition={'right'}
defaultButtonText={'Loại liên hệ'}
buttonStyle={styles.dropdown1BtnStyle}
onSelect={(selectedItem, item_index) =>
setUserInputContact(prev => ({
...prev,
type: selectedItem,
}))
}
dropdownStyle={styles.dropdown1DropdownStyle}
rowStyle={styles.dropdown1RowStyle}
rowTextStyle={styles.dropdown1RowTxtStyle}
buttonTextStyle={styles.dropdown1BtnTxtStyle}
renderDropdownIcon={isOpened => {
return (
<Image
source={
isOpened ? IMAGES.IcUpArrow : IMAGES.IcDownArrow
}
style={{width: 20, height: 20}}
/>
);
}}
/>
{userInputContact.type.length <= 0 && (
<AppText style={{fontSize: 12, color: 'red'}}>
{' '}
Vui lòng chọn liên hệ
</AppText>
)}
</View>
<View style={{flex: 1}}>
<TextInput
style={{borderBottomWidth: 0.2}}
placeholder={'Nhập F'}
keyboardType={'email-address'}
autoCapitalize="none"
value={userInputContact.text}
onChangeText={text =>
setUserInputContact(prev => ({
...prev,
text: text,
}))
}
/>
{userInputContact.text.length <= 0 && (
<AppText style={{fontSize: 12, color: 'red'}}>
{' '}
Vui lòng nhập liên hệ
</AppText>
)}
</View>
</View>
<View style={{flexDirection: 'row', marginTop: 20}}>
<ButtonComponent
text={'Đóng'}
textStyle={styles.textStyle}
style={[
styles.button,
styles.buttonClose,
{marginRight: 15},
]}
onPress={() => setModalVisible(!modalVisible)}
/>
<ButtonComponent
text={'Thêm mới'}
textStyle={styles.textStyle}
style={[styles.button, styles.buttonClose]}
onPress={onSubmitCreateNew}
/>
</View>
</View>
</View>
</Modal>
</View> */
}
<
/ScrollView
>
<
/ScrollView
>
<
/SafeAreaView
>
<
/SafeAreaView
>
);
);
...
...
src/screens/profile/template/components/DetailInformation.js
View file @
6a8e5bdb
...
@@ -6,9 +6,14 @@ import string from '../../../../values/string';
...
@@ -6,9 +6,14 @@ import string from '../../../../values/string';
import
styles
from
'../../style'
;
import
styles
from
'../../style'
;
import
commonStyles
from
'../../../../styles/commonStyles'
;
import
commonStyles
from
'../../../../styles/commonStyles'
;
import
moment
from
'moment'
;
import
moment
from
'moment'
;
import
config
from
'../../../../config'
;
import
{
Formik
}
from
'formik'
;
import
TextInputComponent
from
'../../../../components/TextInputComponent'
;
import
ButtonComponent
from
'../../../../components/ButtonComponent'
;
import
colors
from
'../../../../values/colors'
;
const
DetailInformation
=
React
.
memo
(
const
DetailInformation
=
React
.
memo
(
({
userInfo
})
=>
{
({
userInfo
,
editUserInfo
,
onEditUserInfo
,
handleSubmitChangeInfo
})
=>
{
const
personalInfo
=
[
const
personalInfo
=
[
{
{
name
:
'Số CMND'
,
name
:
'Số CMND'
,
...
@@ -74,7 +79,7 @@ const DetailInformation = React.memo(
...
@@ -74,7 +79,7 @@ const DetailInformation = React.memo(
name
:
'Địa chỉ liên hệ'
,
name
:
'Địa chỉ liên hệ'
,
value
:
userInfo
?.
address
||
''
,
value
:
userInfo
?.
address
||
''
,
icon
:
IMAGES
.
IcLocationGray
,
icon
:
IMAGES
.
IcLocationGray
,
width
:
'
5
0%'
,
width
:
'
10
0%'
,
},
},
{
{
name
:
'Địa chỉ thường trú'
,
name
:
'Địa chỉ thường trú'
,
...
@@ -90,13 +95,21 @@ const DetailInformation = React.memo(
...
@@ -90,13 +95,21 @@ const DetailInformation = React.memo(
{
string
.
PERSONAL_INFORMATION
}
{
string
.
PERSONAL_INFORMATION
}
<
/AppText
>
<
/AppText
>
<
View
>
<
View
>
<
TouchableOpacity
>
{
!
editUserInfo
?.
detailInfo
?
(
<
TouchableOpacity
onPress
=
{()
=>
onEditUserInfo
(
config
.
profileField
.
DETAIL_INFO
)}
>
<
Image
source
=
{
IMAGES
.
IcEdit
}
style
=
{{
height
:
30
,
width
:
30
}}
/
>
<
Image
source
=
{
IMAGES
.
IcEdit
}
style
=
{{
height
:
30
,
width
:
30
}}
/
>
<
/TouchableOpacity
>
<
/TouchableOpacity
>
)
:
(
<
TouchableOpacity
onPress
=
{()
=>
onEditUserInfo
()}
>
<
Image
source
=
{
IMAGES
.
IcReject
}
/
>
<
/TouchableOpacity
>
)}
<
/View
>
<
/View
>
<
/View
>
<
/View
>
<
View
style
=
{[
commonStyles
.
row
,
{
flexWrap
:
'wrap'
}]}
>
<
View
style
=
{[
commonStyles
.
row
,
{
flexWrap
:
'wrap'
}]}
>
{
personalInfo
.
map
(
item
=>
(
{
!
editUserInfo
?.
detailInfo
?
(
personalInfo
.
map
(
item
=>
(
<
View
<
View
key
=
{
item
.
name
}
key
=
{
item
.
name
}
style
=
{[
styles
.
infoView
,
{
width
:
item
.
width
}]}
>
style
=
{[
styles
.
infoView
,
{
width
:
item
.
width
}]}
>
...
@@ -106,14 +119,69 @@ const DetailInformation = React.memo(
...
@@ -106,14 +119,69 @@ const DetailInformation = React.memo(
<
AppText
isSubText
>
{
item
?.
value
}
<
/AppText
>
<
AppText
isSubText
>
{
item
?.
value
}
<
/AppText
>
<
/View
>
<
/View
>
<
/View
>
<
/View
>
))}
))
)
:
(
<
Formik
initialValues
=
{{
id_card_number
:
userInfo
?.
id_card_number
||
''
,
id_card_issue_date
:
userInfo
?.
id_card_issue_date
||
''
,
id_card_issue_palce
:
userInfo
?.
id_card_issue_palce
||
''
,
birthday
:
userInfo
?.
birthday
?
'Nam'
:
'Nữ'
,
domicile
:
userInfo
?.
domicile
||
''
,
birthplace
:
userInfo
?.
birthplace
||
''
,
religion
:
userInfo
?.
religion
||
''
,
ethnic
:
userInfo
?.
ethnic
||
''
,
personal_tax_code
:
userInfo
?.
personal_tax_code
||
''
,
nationality
:
userInfo
?.
personal_tax_code
||
''
,
address
:
userInfo
?.
address
||
''
,
permanent_address
:
userInfo
?.
permanent_address
||
''
,
}}
onSubmit
=
{
values
=>
handleSubmitChangeInfo
(
values
)}
>
{({
handleChange
,
handleBlur
,
handleSubmit
,
values
})
=>
(
<
View
style
=
{[
commonStyles
.
row
,
{
flexWrap
:
'wrap'
}]}
>
{
personalInfo
.
map
((
item
,
index
)
=>
{
return
(
<
View
key
=
{
item
.
name
}
style
=
{{
width
:
item
.
width
,
paddingHorizontal
:
5
,
}}
>
<
TextInputComponent
value
=
{
Object
.
values
(
values
)[
index
]}
label
=
{
item
.
name
}
placeholder
=
{
`Vui lòng nhập
${
item
.
name
}
của bạn`
}
styleAreaInput
=
{{
backgroundColor
:
colors
.
white
,
width
:
'100%'
,
}}
autoCompleteType
=
{
'postal-address'
}
keyboardType
=
{
'email'
}
onChangeText
=
{
handleChange
(
Object
.
keys
(
values
)[
index
],
)}
/
>
<
/View
>
);
})}
<
ButtonComponent
style
=
{[
styles
.
btnSubmit
]}
text
=
{
'Đồng ý'
}
textStyle
=
{{
color
:
colors
.
white
}}
onPress
=
{
handleSubmit
}
/
>
<
/View
>
)}
<
/Formik
>
)}
<
/View
>
<
/View
>
<
/View
>
<
/View
>
);
);
},
},
function
(
prevProps
,
nextProps
)
{
//
function (prevProps, nextProps) {
return
prevProps
.
userInfo
===
nextProps
.
userInfo
;
//
return prevProps.userInfo === nextProps.userInfo;
},
//
},
);
);
export
default
memo
(
DetailInformation
);
export
default
memo
(
DetailInformation
);
src/screens/profile/template/components/PersonalInformation.js
View file @
6a8e5bdb
import
{
Formik
}
from
'formik'
;
import
React
,
{
memo
}
from
'react'
;
import
React
,
{
memo
}
from
'react'
;
import
{
Image
,
TouchableOpacity
,
View
}
from
'react-native'
;
import
{
Image
,
TouchableOpacity
,
View
}
from
'react-native'
;
import
AppText
from
'../../../../components/AppText'
;
import
AppText
from
'../../../../components/AppText'
;
import
ButtonComponent
from
'../../../../components/ButtonComponent'
;
import
TextInputComponent
from
'../../../../components/TextInputComponent'
;
import
config
from
'../../../../config'
;
import
commonStyles
from
'../../../../styles/commonStyles'
;
import
{
IMAGES
}
from
'../../../../values/images'
;
import
{
IMAGES
}
from
'../../../../values/images'
;
import
string
from
'../../../../values/string'
;
import
string
from
'../../../../values/string'
;
import
styles
from
'../../style'
;
import
styles
from
'../../style'
;
import
co
mmonStyles
from
'../../../../styles/commonStyle
s'
;
import
co
lors
from
'../../../../values/color
s'
;
const
PersonalInformation
=
React
.
memo
(
const
PersonalInformation
=
React
.
memo
(
({
userInfo
})
=>
{
({
userInfo
,
onEditUserInfo
,
editUserInfo
,
handleSubmitChangeInfo
})
=>
{
const
personalInfo
=
[
const
personalInfo
=
[
{
{
name
:
'Họ'
,
name
:
'Họ'
,
...
@@ -53,13 +58,23 @@ const PersonalInformation = React.memo(
...
@@ -53,13 +58,23 @@ const PersonalInformation = React.memo(
{
string
.
PERSONAL_INFORMATION
}
{
string
.
PERSONAL_INFORMATION
}
<
/AppText
>
<
/AppText
>
<
View
>
<
View
>
<
TouchableOpacity
>
{
!
editUserInfo
?.
personalInfo
?
(
<
TouchableOpacity
onPress
=
{()
=>
onEditUserInfo
(
config
.
profileField
.
PERSONAL_INFO
)
}
>
<
Image
source
=
{
IMAGES
.
IcEdit
}
style
=
{{
height
:
30
,
width
:
30
}}
/
>
<
Image
source
=
{
IMAGES
.
IcEdit
}
style
=
{{
height
:
30
,
width
:
30
}}
/
>
<
/TouchableOpacity
>
<
/TouchableOpacity
>
)
:
(
<
TouchableOpacity
onPress
=
{()
=>
onEditUserInfo
()}
>
<
Image
source
=
{
IMAGES
.
IcReject
}
/
>
<
/TouchableOpacity
>
)}
<
/View
>
<
/View
>
<
/View
>
<
/View
>
<
View
style
=
{[
commonStyles
.
row
,
{
flexWrap
:
'wrap'
}]}
>
<
View
style
=
{[
commonStyles
.
row
,
{
flexWrap
:
'wrap'
}]}
>
{
personalInfo
.
map
(
item
=>
(
{
!
editUserInfo
?.
personalInfo
?
(
personalInfo
.
map
(
item
=>
(
<
View
<
View
key
=
{
item
.
name
}
key
=
{
item
.
name
}
style
=
{[
styles
.
infoView
,
{
width
:
item
.
width
}]}
>
style
=
{[
styles
.
infoView
,
{
width
:
item
.
width
}]}
>
...
@@ -69,14 +84,68 @@ const PersonalInformation = React.memo(
...
@@ -69,14 +84,68 @@ const PersonalInformation = React.memo(
<
AppText
isSubText
>
{
item
?.
value
}
<
/AppText
>
<
AppText
isSubText
>
{
item
?.
value
}
<
/AppText
>
<
/View
>
<
/View
>
<
/View
>
<
/View
>
))}
))
)
:
(
<
Formik
initialValues
=
{{
first_name
:
userInfo
?.
first_name
||
''
,
middle_name
:
userInfo
?.
middle_name
||
''
,
last_name
:
userInfo
?.
last_name
||
''
,
gender
:
userInfo
?.
gender
?
'Nam'
:
'Nữ'
,
cell_phone
:
userInfo
?.
cell_phone
||
''
,
}}
onSubmit
=
{
values
=>
handleSubmitChangeInfo
(
values
)}
>
{({
handleChange
,
handleBlur
,
handleSubmit
,
values
})
=>
(
<
View
style
=
{[
commonStyles
.
row
,
{
flexWrap
:
'wrap'
}]}
>
{
personalInfo
.
map
((
item
,
index
)
=>
{
if
(
index
===
personalInfo
.
length
-
1
)
{
return
null
;
}
return
(
<
View
key
=
{
item
.
name
}
style
=
{{
width
:
item
.
width
,
paddingHorizontal
:
5
,
}}
>
<
TextInputComponent
value
=
{
Object
.
values
(
values
)[
index
]}
label
=
{
item
.
name
}
placeholder
=
{
`Vui lòng nhập
${
item
.
name
}
của bạn`
}
styleAreaInput
=
{{
backgroundColor
:
colors
.
white
,
width
:
'100%'
,
}}
autoCompleteType
=
{
'postal-address'
}
keyboardType
=
{
'email'
}
onChangeText
=
{
handleChange
(
Object
.
keys
(
values
)[
index
],
)}
/
>
<
/View
>
);
})}
<
ButtonComponent
style
=
{[
styles
.
btnSubmit
]}
text
=
{
'Đồng ý'
}
textStyle
=
{{
color
:
colors
.
white
}}
onPress
=
{
handleSubmit
}
/
>
<
/View
>
)}
<
/Formik
>
)}
<
/View
>
<
/View
>
<
/View
>
<
/View
>
);
);
},
},
function
(
prevProps
,
nextProps
)
{
// function (prevProps, nextProps) {
return
prevProps
.
userInfo
===
nextProps
.
userInfo
;
// return (
},
// prevProps.userInfo === nextProps.userInfo ||
// prevProps.editUserInfo === nextProps.editUserInfo ||
// prevProps.onEditUserInfo() === nextProps.onEditUserInfo()
// );
// },
);
);
export
default
memo
(
PersonalInformation
);
export
default
memo
(
PersonalInformation
);
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment