Commit b310545b authored by William Goszal's avatar William Goszal 🚴

fix transaction history kurang conditional buat claim balance

parent 55e1f394
...@@ -39,7 +39,7 @@ class TransactionHistory extends React.Component { ...@@ -39,7 +39,7 @@ class TransactionHistory extends React.Component {
let params = { let params = {
session_id: this.props.session_id session_id: this.props.session_id
} }
Axios.post(this.props.BASE_URL+'crm/v2/transaction/history', params).then(res => { Axios.post(this.props.BASE_URL + 'crm/v2/transaction/history', params).then(res => {
let data = res.data.transactions let data = res.data.transactions
console.log(data) console.log(data)
data.map((item) => { data.map((item) => {
...@@ -93,6 +93,7 @@ class TransactionHistory extends React.Component { ...@@ -93,6 +93,7 @@ class TransactionHistory extends React.Component {
item.transactions.map((i, k) => ( item.transactions.map((i, k) => (
/** TYPE_CARD_ACTIVATION */
i.type == 1 ? ( i.type == 1 ? (
<View style={{ marginTop: 5 }} key={k}> <View style={{ marginTop: 5 }} key={k}>
<View style={{ flex: 2, height: 120, margin: 5, borderRadius: 5, borderWidth: 1, borderColor: '#838383', flexDirection: 'row' }}> <View style={{ flex: 2, height: 120, margin: 5, borderRadius: 5, borderWidth: 1, borderColor: '#838383', flexDirection: 'row' }}>
...@@ -107,8 +108,9 @@ class TransactionHistory extends React.Component { ...@@ -107,8 +108,9 @@ class TransactionHistory extends React.Component {
</View> </View>
</View> </View>
</View> </View>
) : ) :
/** TYPE_TRANSACTION */
i.type == 2 ? ( i.type == 2 ? (
<TouchableOpacity key={k} onPress={() => this.props.navigation.navigate('Order Detail', { idTrans: i.id })}> <TouchableOpacity key={k} onPress={() => this.props.navigation.navigate('Order Detail', { idTrans: i.id })}>
<View style={{ marginTop: 5 }} key={k}> <View style={{ marginTop: 5 }} key={k}>
...@@ -131,8 +133,9 @@ class TransactionHistory extends React.Component { ...@@ -131,8 +133,9 @@ class TransactionHistory extends React.Component {
</View> </View>
</View> </View>
</TouchableOpacity> </TouchableOpacity>
) : ) :
/** TYPE_TOPUP_CASHBACK */
i.type == 3 ? ( i.type == 3 ? (
<View style={{ marginTop: 5 }} key={k}> <View style={{ marginTop: 5 }} key={k}>
<View style={{ flex: 2, height: 120, margin: 5, borderRadius: 5, borderWidth: 1, borderColor: '#838383', flexDirection: 'row' }}> <View style={{ flex: 2, height: 120, margin: 5, borderRadius: 5, borderWidth: 1, borderColor: '#838383', flexDirection: 'row' }}>
...@@ -147,8 +150,9 @@ class TransactionHistory extends React.Component { ...@@ -147,8 +150,9 @@ class TransactionHistory extends React.Component {
</View> </View>
</View> </View>
</View> </View>
) : ) :
/** TYPE_TRANS_CASHBACK */
i.type == 4 ? ( i.type == 4 ? (
<View style={{ marginTop: 5 }} key={k}> <View style={{ marginTop: 5 }} key={k}>
<View style={{ flex: 2, height: 120, margin: 5, borderRadius: 5, borderWidth: 1, borderColor: '#838383', flexDirection: 'row' }}> <View style={{ flex: 2, height: 120, margin: 5, borderRadius: 5, borderWidth: 1, borderColor: '#838383', flexDirection: 'row' }}>
...@@ -163,8 +167,9 @@ class TransactionHistory extends React.Component { ...@@ -163,8 +167,9 @@ class TransactionHistory extends React.Component {
</View> </View>
</View> </View>
</View> </View>
) : ) :
/** TYPE_TRANSFER_BALANCE */
i.type == 5 ? ( i.type == 5 ? (
<View style={{ marginTop: 5 }} key={k}> <View style={{ marginTop: 5 }} key={k}>
<View style={{ flex: 2, height: 120, margin: 5, borderRadius: 5, borderWidth: 1, borderColor: '#838383', flexDirection: 'row' }}> <View style={{ flex: 2, height: 120, margin: 5, borderRadius: 5, borderWidth: 1, borderColor: '#838383', flexDirection: 'row' }}>
...@@ -179,8 +184,9 @@ class TransactionHistory extends React.Component { ...@@ -179,8 +184,9 @@ class TransactionHistory extends React.Component {
</View> </View>
</View> </View>
</View> </View>
) : ) :
/** TYPE_TRANSFER_RECEIVE */
i.type == 6 ? ( i.type == 6 ? (
<View style={{ marginTop: 5 }} key={k}> <View style={{ marginTop: 5 }} key={k}>
<View style={{ flex: 2, height: 120, margin: 5, borderRadius: 5, borderWidth: 1, borderColor: '#838383', flexDirection: 'row' }}> <View style={{ flex: 2, height: 120, margin: 5, borderRadius: 5, borderWidth: 1, borderColor: '#838383', flexDirection: 'row' }}>
...@@ -195,7 +201,10 @@ class TransactionHistory extends React.Component { ...@@ -195,7 +201,10 @@ class TransactionHistory extends React.Component {
</View> </View>
</View> </View>
</View> </View>
) : ( ) :
/** TYPE_CLAIM_BALANCE */
i.type == 8 ? (
<View style={{ marginTop: 5 }} key={k}> <View style={{ marginTop: 5 }} key={k}>
<View style={{ flex: 2, height: 120, margin: 5, borderRadius: 5, borderWidth: 1, borderColor: '#838383', flexDirection: 'row' }}> <View style={{ flex: 2, height: 120, margin: 5, borderRadius: 5, borderWidth: 1, borderColor: '#838383', flexDirection: 'row' }}>
<View style={{ flex: 1.1, justifyContent: 'center', margin: 10 }}> <View style={{ flex: 1.1, justifyContent: 'center', margin: 10 }}>
...@@ -204,12 +213,29 @@ class TransactionHistory extends React.Component { ...@@ -204,12 +213,29 @@ class TransactionHistory extends React.Component {
</View> </View>
<View style={{ flex: 0.9, justifyContent: 'center', alignItems: 'center', margin: 10, marginLeft: 15, borderLeftWidth: 1, borderColor: '#838383' }}> <View style={{ flex: 0.9, justifyContent: 'center', alignItems: 'center', margin: 10, marginLeft: 15, borderLeftWidth: 1, borderColor: '#838383' }}>
<View> <View>
<NumberFormat decimalScale={0} value={i.point_reduce} renderText={value => <Text style={{ fontSize: 12, fontFamily: 'Gotham-Black', color: '#CFB368' }}>- Rp. {value}</Text>} displayType={'text'} thousandSeparator={true} prefix={''} /> <NumberFormat decimalScale={0} value={i.point_add} renderText={value => <Text style={{ fontSize: 12, fontFamily: 'Gotham-Black', color: '#CFB368' }}>Rp. {value}</Text>} displayType={'text'} thousandSeparator={true} prefix={''} />
</View> </View>
</View> </View>
</View> </View>
</View> </View>
) ) :
/** TYPE_RENEWAL */
(
<View style={{ marginTop: 5 }} key={k}>
<View style={{ flex: 2, height: 120, margin: 5, borderRadius: 5, borderWidth: 1, borderColor: '#838383', flexDirection: 'row' }}>
<View style={{ flex: 1.1, justifyContent: 'center', margin: 10 }}>
<Text style={{ fontFamily: 'Gotham-Black', color: 'grey', fontSize: 12, margin: 2 }}>{i.type_display}</Text>
<Text style={{ fontFamily: 'Gotham-Light', color: 'grey', fontSize: 12, margin: 2 }}>{moment(i.trans_time).format("DD MMMM YYYY, hh:mm A")}</Text>
</View>
<View style={{ flex: 0.9, justifyContent: 'center', alignItems: 'center', margin: 10, marginLeft: 15, borderLeftWidth: 1, borderColor: '#838383' }}>
<View>
<NumberFormat decimalScale={0} value={i.point_reduce} renderText={value => <Text style={{ fontSize: 12, fontFamily: 'Gotham-Black', color: '#CFB368' }}>- Rp. {value}</Text>} displayType={'text'} thousandSeparator={true} prefix={''} />
</View>
</View>
</View>
</View>
)
)) ))
)) ))
) : ( ) : (
...@@ -247,7 +273,7 @@ const styles = StyleSheet.create({ ...@@ -247,7 +273,7 @@ const styles = StyleSheet.create({
const mapStateToProps = (state) => { const mapStateToProps = (state) => {
return { return {
session_id: state.session_id, session_id: state.session_id,
BASE_URL: state.BASE_URL BASE_URL: state.BASE_URL
} }
......
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