Commit 7201e137 authored by Wahyu Adjie Prasetyo's avatar Wahyu Adjie Prasetyo

set note

parent 77065de3
......@@ -83,13 +83,8 @@ const globalState = {
voucher: [],
value_voucher: '',
home_address:'',
outlet_detailadress: '',
in_payment: false,
redeem_code :'',
balance_redeem :'',
point_redeem:''
home_address: '',
outlet_detailadress: ''
}
......@@ -285,16 +280,6 @@ const rootReducer = (state = globalState, action) => {
}
}
case ActionType.SET_REEDEM: {
return {
...state,
in_payment: action.data.in_payment,
redeem_code :action.data.redeem_code,
balance_redeem : action.data.balance_redeem,
point_redeem:action.data.point_redeem
}
}
case ActionType.SET_CHANGE_SHOP: {
return {
...state
......@@ -638,7 +623,6 @@ const rootReducer = (state = globalState, action) => {
}
}
case ActionType.CHANGE_QUANTITY: {
const item = action.data.item;
const new_quantity = action.data.new_quantity;
......@@ -709,6 +693,25 @@ const rootReducer = (state = globalState, action) => {
}
case ActionType.SET_EDIT_NOTE: {
const item = action.data.item;
// const new_quantity = action.data.new_quantity;
// let total = 0
let list_item = []
let edit_qty = list_item.find(item => item.id == item.note)
console.log("INI APA YA : " + edit_qty)
// list_menu.push()
// return {
// ...state,
// order_item: list_item,
// }
}
default:
return state;
}
......
......@@ -13,7 +13,7 @@ class Item extends React.Component {
this.state = {
value: 0,
modalVisible: false,
description: ''
note: ''
}
}
handleChangeQuantity = (item, qty) => {
......@@ -43,10 +43,21 @@ class Item extends React.Component {
})
}
handleEdit() {
const edit_note = {
note: this.state.note
handleEdit = (item) =>{
const order_item = {
id: item.id,
code: item.code,
name: item.name,
description: item.description,
note: this.state.note,
image: item.image,
price: parseInt(item.price),
}
this.props.setNotes({ item: order_item })
this.setState({
modalVisible: false
})
}
render() {
......@@ -68,19 +79,25 @@ class Item extends React.Component {
<View style={{ margin: 10 }}>
<TextInput
style={styles.textInput}
onChangeText={(description) => this.setState({ description })}
onChangeText={(note) => this.setState({ note })}
value={this.state.description}
textAlign='center'
/>
</View>
<TouchableOpacity onPress={() => this.setState({ modalVisible: false })}>
<View style={{flexDirection:'row'}}>
<TouchableOpacity style={{margin:5}} onPress={() => this.handleEdit(item) }>
<View style={styles.button}>
<Text style={{ color: 'white', fontWeight: 'bold', fontSize: 16 }}>CONFIRM</Text>
</View>
</TouchableOpacity>
<TouchableOpacity style={{margin:5}} onPress={() => this.setState({ modalVisible: false })}>
<View style={styles.button}>
<Text style={{ color: 'white', fontWeight: 'bold', fontSize: 16 }}>CANCEL</Text>
</View>
</TouchableOpacity>
</View>
</View>
</View>
</Modal>
<ScrollView ref={view => this._scrollView = view}>
{item.code == 'CATEGORY' ? (
......@@ -243,6 +260,12 @@ const mapDispatchToProps = (dispacth) => {
new_quantity: params.quantity
}
}),
setNotes: (params) => dispacth({
type: ActionType.SET_EDIT_NOTE,
data: {
item: params.item,
}
}),
}
}
const mapStateToProps = (state) => {
......
......@@ -8,7 +8,6 @@ import { Entypo, Ionicons, MaterialCommunityIcons, MaterialIcons, AntDesign, Fon
import ActionType from '../redux/globalActionType';
import Spinner from 'react-native-loading-spinner-overlay';
import PinRequest from './PinRequest'
import ActionType from '../redux/globalActionType';
class UseBalance extends React.Component {
......
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