Commit 265e5f7e authored by Wahyu Adjie Prasetyo's avatar Wahyu Adjie Prasetyo

name label redux

parent f63a7d59
......@@ -38,7 +38,8 @@ const ActionType = {
SET_TRANS_ID:'SET_TRANS_ID',
CHANGE_TO_CHART:'CHANGE_TO_CHART',
SET_VOUCHER:'SET_VOUCHER',
SET_EDIT_NOTE:'SET_EDIT_NOTE'
SET_EDIT_NOTE:'SET_EDIT_NOTE',
SET_HOME_ADDRESS:'SET_HOME_ADDRESS'
}
export default ActionType;
\ No newline at end of file
......@@ -82,7 +82,8 @@ const globalState = {
long: '',
voucher: [],
value_voucher: ''
value_voucher: '',
home_address:''
}
......@@ -286,7 +287,8 @@ const rootReducer = (state = globalState, action) => {
return {
...state,
address: action.data.address,
addressId: action.data.addressId
addressId: action.data.addressId,
home_address: action.data.home_address
}
}
case ActionType.SET_TRANS_ID: {
......
......@@ -9,6 +9,7 @@ import { connect } from 'react-redux';
import Axios from 'axios';
import Spinner from 'react-native-loading-spinner-overlay';
import { MaterialCommunityIcons, Ionicons } from '@expo/vector-icons';
import ActionType from '../redux/globalActionType';
class AddreesDetail extends React.Component {
......@@ -134,6 +135,7 @@ class AddreesDetail extends React.Component {
this.setState({
spinner: false,
})
this.props.navigation.goBack()
this.props.route.params.onChangeAddress({ example: 'wakwaw' })
......@@ -221,7 +223,7 @@ class AddreesDetail extends React.Component {
</View>
<View style={styles.field_name_addrees}>
<Text style={{ fontFamily: 'Gotham-Black', color: "#ccb46c",textAlign:'center',fontSize:18 }}>Nama</Text>
<Text style={{ fontFamily: 'Gotham-Black', color: "#ccb46c",textAlign:'center',fontSize:18 }}>Label</Text>
<TextInput style={{ height: 40, borderWidth: 1, padding: 5, flex: 1, margin: 10, borderRadius: 10, borderColor: 'grey' }} onChangeText={(name) => this.setState({ name })} />
</View>
......@@ -236,7 +238,7 @@ class AddreesDetail extends React.Component {
<View style={{ margin: 50, justifyContent: 'center' }}>
<TouchableOpacity onPress={() => this.saveAddress()}>
<View style={{ height: 40, borderRadius: 10, backgroundColor: '#CFB368', justifyContent: 'center' }}>
<Text style={{ fontFamily: 'Gotham-Black', color: 'white', fontSize: 16, textAlign: 'center' }}>+ Tambah Alamat</Text>
<Text style={{ fontFamily: 'Gotham-Black', color: 'white', fontSize: 16, textAlign: 'center' }}> Tambah Alamat</Text>
</View>
</TouchableOpacity>
</View>
......@@ -312,6 +314,7 @@ const mapStateToProps = (state) => {
}
}
export default connect(mapStateToProps)(AddreesDetail)
// <TextInput style={{ height: 40, borderWidth: 1, padding: 5, margin: 10,borderRadius:5 }} onChangeText={(address) => this.setState({ address })} />
\ No newline at end of file
......@@ -12,6 +12,7 @@ class DeliveryAddrees extends React.Component {
constructor(props) {
super(props)
this.state = {
address_name: [],
data: [],
data_before_search: [],
search: '',
......@@ -49,6 +50,14 @@ class DeliveryAddrees extends React.Component {
data: address,
data_before_search: dataAlamat,
})
let data_alamat = []
this.state.data.map(item => {
let b = item.name
data_alamat.push(b)
})
}).catch(error => {
let response = error.response.data;
Alert.alert(
......@@ -132,14 +141,20 @@ class DeliveryAddrees extends React.Component {
}
onSave(address, id) {
onSave(address, id, description) {
console.log("INI ALAMAT : " + address )
console.log("INI id : " + id )
console.log("INI description : " + description )
let setDataAddress = {
address: address,
addressId: id
addressId: id,
home_address: ''
}
this.props.setAddress(setDataAddress);
let params = {
session_id: this.props.session_id,
address_id: id,
......@@ -221,7 +236,7 @@ class DeliveryAddrees extends React.Component {
/>
</View>
<View>
<Text style={{textAlign:'center', color: '#ccb46c', fontFamily: 'Gotham-Light' ,marginRight:20}}>PILIH</Text>
<Text style={{ textAlign: 'center', color: '#ccb46c', fontFamily: 'Gotham-Light', marginRight: 20 }}>PILIH</Text>
</View>
</View>
......@@ -243,7 +258,7 @@ class DeliveryAddrees extends React.Component {
return (
<View style={styles.container}>
<View style={{ height: 45, borderRadius: 10, borderColor: '#ccb46c', borderWidth: 1, flexDirection: 'row', marginTop: 15, marginLeft: 20, marginRight: 20 }}>
<View style={{ flex: 1,top:5 }}>
<View style={{ flex: 1, top: 5 }}>
<MaterialCommunityIcons name="map-marker" size={32} color="#ccb46c" />
</View>
<View style={{ flex: 6 }}>
......@@ -337,7 +352,8 @@ const mapDispatchToProps = (dispacth) => {
data: {
address: setDataAddress.address,
addressId: setDataAddress.addressId
addressId: setDataAddress.addressId,
home_address: setDataAddress.home_address
}
}),
......
......@@ -45,7 +45,7 @@ class ShoppingCart extends React.Component {
componentDidMount() {
// console.log(this.props.voucher)
console.log(this.props.home_address)
// console.log('INI VALUE : ' + this.props.value_voucher)
if (!this.props.type_pickup) {
this.getRate()
......@@ -451,6 +451,7 @@ class ShoppingCart extends React.Component {
<View style={{ margin: 5, padding: 10 }}>
<Text style={{ textAlign: 'center', fontFamily: 'Gotham-Black', fontSize: 12, color: 'grey' }}>OUR DRIVER WILL DELIVER YOUR ORDER TO</Text>
<Text style={{ textAlign: 'center', fontSize: 12, top: 5, fontFamily: 'Gotham-Light', color: 'grey' }}>{this.props.address}</Text>
<Text style={{ textAlign: 'center', fontSize: 12, top: 5, fontFamily: 'Gotham-Light', color: 'grey' }}>{this.props.home_address}</Text>
</View>
)
}
......@@ -983,6 +984,7 @@ const mapDispatchToProps = (dispacth) => {
const mapStateToProps = (state) => {
return {
home_address: state.home_address,
type_pickup: state.type_pickup,
value_voucher: state.value_voucher,
voucher: state.voucher,
......
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