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

set note

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