Commit f05fa621 authored by Wahyu Adjie Prasetyo's avatar Wahyu Adjie Prasetyo

nambah fitur edit alamat

parent 7cd27c8d
...@@ -51,6 +51,7 @@ const ActionType = { ...@@ -51,6 +51,7 @@ const ActionType = {
SET_ACCOUNT_NUMBER:'SET_ACCOUNT_NUMBER', SET_ACCOUNT_NUMBER:'SET_ACCOUNT_NUMBER',
SET_MEMBER:'SET_MEMBER', SET_MEMBER:'SET_MEMBER',
SET_INBOX:'SET_INBOX', SET_INBOX:'SET_INBOX',
SET_EDIT_ADDRESS: 'SET_EDIT_ADDRESS'
} }
export default ActionType; export default ActionType;
\ No newline at end of file
...@@ -100,7 +100,8 @@ const globalState = { ...@@ -100,7 +100,8 @@ const globalState = {
old_balance_claimed: true, old_balance_claimed: true,
set_inbox :'', set_inbox :'',
email_confirm:false email_confirm:false,
edit_address : false,
} }
...@@ -163,6 +164,13 @@ const rootReducer = (state = globalState, action) => { ...@@ -163,6 +164,13 @@ const rootReducer = (state = globalState, action) => {
pointused: action.data.pointused, pointused: action.data.pointused,
} }
} }
case ActionType.SET_EDIT_ADDRESS: {
return {
...state,
edit_address: action.data.edit_address,
}
}
case ActionType.SET_PAGE: { case ActionType.SET_PAGE: {
return { return {
...state, ...state,
......
This diff is collapsed.
...@@ -54,6 +54,7 @@ class DeliveryAddrees extends React.Component { ...@@ -54,6 +54,7 @@ class DeliveryAddrees extends React.Component {
} }
Axios.post(this.props.BASE_URL + 'crm/v2/member/get_address', params).then(res => { Axios.post(this.props.BASE_URL + 'crm/v2/member/get_address', params).then(res => {
const dataAlamat = res.data.data; const dataAlamat = res.data.data;
// console.log("INI DATA :" + JSON.stringify(dataAlamat)) // console.log("INI DATA :" + JSON.stringify(dataAlamat))
let address = [] let address = []
for (let i = 0; i < dataAlamat.length; i++) { for (let i = 0; i < dataAlamat.length; i++) {
...@@ -73,6 +74,8 @@ class DeliveryAddrees extends React.Component { ...@@ -73,6 +74,8 @@ class DeliveryAddrees extends React.Component {
data_alamat.push(b) data_alamat.push(b)
}) })
// console.log(this.state.data)
}).catch(error => { }).catch(error => {
let response = error.response.data; let response = error.response.data;
...@@ -135,7 +138,16 @@ class DeliveryAddrees extends React.Component { ...@@ -135,7 +138,16 @@ class DeliveryAddrees extends React.Component {
} }
addAdreess() { addAdreess() {
this.props.navigation.navigate('Address Detail', { 'data': 'sample', onChangeAddress: this.onChangeAddress }) this.props.navigation.navigate('Address Detail', {data_address : "", 'data': 'sample', onChangeAddress: this.onChangeAddress })
}
EditAdreess(data_address) {
this.props.navigation.navigate('Address Detail', { data_address : data_address,'data': 'sample', onChangeAddress: this.onChangeAddress })
let setDataEditAddress = {
edit_address: true
}
this.props.editAddress(setDataEditAddress);
} }
...@@ -327,8 +339,8 @@ class DeliveryAddrees extends React.Component { ...@@ -327,8 +339,8 @@ class DeliveryAddrees extends React.Component {
uncheckedColor="#ccb46c" uncheckedColor="#ccb46c"
/> />
</View> </View>
<View> <View style={{flex:3}}>
<Text style={{ textAlign: 'center', color: '#ccb46c', fontFamily: 'Gotham-Light', marginRight: 20 }}>{i18n.t('selectaddress')}</Text> <Text style={{ textAlign: 'center', color: '#ccb46c', fontFamily: 'Gotham-Light', marginRight:5 }}>{i18n.t('selectaddress')}</Text>
</View> </View>
</View> </View>
<View style={{ flex: 3, justifyContent: 'center' }}> <View style={{ flex: 3, justifyContent: 'center' }}>
...@@ -339,12 +351,27 @@ class DeliveryAddrees extends React.Component { ...@@ -339,12 +351,27 @@ class DeliveryAddrees extends React.Component {
</View> </View>
</TouchableOpacity> </TouchableOpacity>
</View> </View>
<View style={{ flex: 1}}>
<TouchableOpacity style={{ flexDirection: 'row', justifyContent: "center" }} onPress={() =>this.EditAdreess(item)}>
<View style={{ alignSelf:'flex-end', marginTop: 20 }}>
{/* <EvilIcons name="pencil" size={40} color="#ccb46c" /> */}
</View>
</TouchableOpacity>
</View>
<View style={{ flex: 1 }}>
<TouchableOpacity style={{ flexDirection: 'row', justifyContent: "center" }} onPress={() =>this.EditAdreess(item)}>
<View style={{ alignSelf: "center", marginTop: 20 }}>
<EvilIcons name="pencil" size={40} color="#ccb46c" />
</View>
</TouchableOpacity>
</View>
<View style={{ flex: 1 }}> <View style={{ flex: 1 }}>
<TouchableOpacity style={{ flex: 1, flexDirection: 'row', justifyContent: "center" }} onPress={() => this.handleDeleteAddress(item.id)}> <TouchableOpacity style={{ flex: 1, flexDirection: 'row', justifyContent: "center" }} onPress={() => this.handleDeleteAddress(item.id)}>
<View style={{ alignSelf: "center", marginTop: 20 }}> <View style={{ alignSelf: "center", marginTop: 20 }}>
<EvilIcons name="trash" size={40} color="#ccb46c" /> <EvilIcons name="trash" size={40} color="#ccb46c" />
</View> </View>
</TouchableOpacity> </TouchableOpacity>
</View> </View>
</View> </View>
</View> </View>
...@@ -380,6 +407,7 @@ class DeliveryAddrees extends React.Component { ...@@ -380,6 +407,7 @@ class DeliveryAddrees extends React.Component {
</View> </View>
</TouchableOpacity> </TouchableOpacity>
</View> </View>
<View style={styles.listAddress}> <View style={styles.listAddress}>
{this.state.indicator == true ? ( {this.state.indicator == true ? (
<ActivityIndicator size="large" color="#c9af6d" /> <ActivityIndicator size="large" color="#c9af6d" />
...@@ -495,6 +523,13 @@ const mapDispatchToProps = (dispacth) => { ...@@ -495,6 +523,13 @@ const mapDispatchToProps = (dispacth) => {
} }
}), }),
editAddress: (setDataEditAddress) => dispacth({
type: ActionType.SET_EDIT_ADDRESS,
data: {
edit_address:setDataEditAddress.edit_address
}
}),
setGrab: (setGrabProps) => dispacth({ setGrab: (setGrabProps) => dispacth({
type: ActionType.SET_GRAB, type: ActionType.SET_GRAB,
data: { data: {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment