Commit b4b49f81 authored by didam's avatar didam

didim

parent a314c2c9
...@@ -6,6 +6,7 @@ import SvgAnimatedLinearGradient from 'react-native-svg-animated-linear-gradient ...@@ -6,6 +6,7 @@ import SvgAnimatedLinearGradient from 'react-native-svg-animated-linear-gradient
import Svg, { Circle, Rect } from 'react-native-svg' import Svg, { Circle, Rect } from 'react-native-svg'
import Reactron from 'reactotron-react-native' import Reactron from 'reactotron-react-native'
import Next from 'react-native-vector-icons/MaterialIcons' import Next from 'react-native-vector-icons/MaterialIcons'
import reactotron from 'reactotron-react-native'
export default class Approval extends Component { export default class Approval extends Component {
...@@ -17,7 +18,8 @@ export default class Approval extends Component { ...@@ -17,7 +18,8 @@ export default class Approval extends Component {
{ noKontrak: 'K-2001921', namaWerehouse: 'Branch-1', petugas: 'Dudung Tukimin', tglTerima: '03-03-2020', status: 'Need Approval', brand: 'Honda', type: 'Beat', noPol: 'B 4203 STW' }, { noKontrak: 'K-2001921', namaWerehouse: 'Branch-1', petugas: 'Dudung Tukimin', tglTerima: '03-03-2020', status: 'Need Approval', brand: 'Honda', type: 'Beat', noPol: 'B 4203 STW' },
], ],
listData: [], listData: [],
loading: false loading: false,
longPress: false
} }
} }
...@@ -30,7 +32,7 @@ export default class Approval extends Component { ...@@ -30,7 +32,7 @@ export default class Approval extends Component {
api.create().getListApproval({ api.create().getListApproval({
warehouse_id: 2 warehouse_id: 2
}).then((response) => { }).then((response) => {
console.log(JSON.stringify(response.data)) reactotron.log(response.data)
if (response.data.status == "success") { if (response.data.status == "success") {
let listData = [] let listData = []
response.data.data.map((item, index) => { response.data.data.map((item, index) => {
...@@ -45,6 +47,18 @@ export default class Approval extends Component { ...@@ -45,6 +47,18 @@ export default class Approval extends Component {
}) })
} }
postApproval() {
api.create().postApproval({
contract_id: this.state.arrayContractId
}). then((response) => {
reactotron.log(response)
})
}
handleArrayContract(item) {
}
render() { render() {
return ( return (
<Container style={{ flex: 1 }}> <Container style={{ flex: 1 }}>
...@@ -52,9 +66,14 @@ export default class Approval extends Component { ...@@ -52,9 +66,14 @@ export default class Approval extends Component {
{this.state.listData.map((item, index) => { {this.state.listData.map((item, index) => {
return ( return (
<View key={index} style={{ paddingHorizontal: 7 }}> <View key={index} style={{ paddingHorizontal: 7 }}>
<View style={{flexDirection: 'row'}}>
{this.state.longPress && (
<View>
</View>
)}
{!this.state.loading && ( {!this.state.loading && (
<TouchableOpacity style={{ marginTop: 10, borderRadius: 20 }} onLongPress={() => alert('takeit')} onPress={() => this.props.navigation.navigate('MenuApproval', { data: item })}> <TouchableOpacity style={{ marginTop: 10, borderRadius: 20 }} onLongPress={() => this.handleArrayContract(item.contract_id)} delayLongPress={100} onPress={() => this.state.longPress? this.handleArrayContract(item.contract_id) : this.props.navigation.navigate('MenuApproval', { data: item })}>
<View style={{ height: 60, backgroundColor: '#e4b300', justifyContent: 'space-between', paddingHorizontal: 20, flexDirection: 'row', borderTopRightRadius: 10, borderTopLeftRadius: 10 }}> <View style={{ height: 60, backgroundColor: '#e4b300', justifyContent: 'space-between', paddingHorizontal: 20, flexDirection: 'row', borderTopRightRadius: 10, borderTopLeftRadius: 10 }}>
<View style={{ justifyContent: 'center' }}> <View style={{ justifyContent: 'center' }}>
<Text style={{ color: 'white', fontSize: 16, fontWeight: '700' }}>{item.contract_number}</Text> <Text style={{ color: 'white', fontSize: 16, fontWeight: '700' }}>{item.contract_number}</Text>
...@@ -76,6 +95,8 @@ export default class Approval extends Component { ...@@ -76,6 +95,8 @@ export default class Approval extends Component {
</View> </View>
</TouchableOpacity> </TouchableOpacity>
)} )}
</View>
{this.state.loading && ( {this.state.loading && (
<SvgAnimatedLinearGradient <SvgAnimatedLinearGradient
height={140} height={140}
......
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