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

nambah fitur edit alamat

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