Commit ad6f251c authored by Deni Rinaldi's avatar Deni Rinaldi

list approval

parent 2ebd8fb3
import React, { Component } from 'react'
import { Text, View, ScrollView, TouchableOpacity } from 'react-native'
import { Container } from 'native-base'
import api from '../../../service/api'
import SvgAnimatedLinearGradient from 'react-native-svg-animated-linear-gradient'
import Svg, { Circle, Rect } from 'react-native-svg'
import Reactron from 'reactotron-react-native'
import Next from 'react-native-vector-icons/MaterialIcons'
export default class Appraisal extends Component {
......@@ -11,73 +15,82 @@ export default class Appraisal extends Component {
arrayDummy: [
{ noKontrak: 'K-2001920', namaWerehouse: 'Branch-2', petugas: 'Dadang Tukimin', tglTerima: '03-03-2020', status: 'Draft', brand: 'Honda', type: 'Revo', noPol: 'B 4203 PWK' },
{ 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: [],
loading: false
}
}
componentDidMount() {
this.getListAppraisal()
}
getListAppraisal() {
this.setState({ loading: true })
api.create().getListAppraisal({
warehouse_id: 2
}).then((response) => {
console.log(JSON.stringify(response.data))
if (response.data.status == "success") {
let listData = []
response.data.data.map((item, index) => {
if (item.appraisal_status != 'Rejected') {
listData.push(item)
}
})
this.setState({ listData }, () => {
setTimeout(() => {
this.setState({ loading: false })
}, 500);
})
}
})
}
render() {
return (
<Container style={{ flex: 1 }}>
<ScrollView style={{ paddingHorizontal: 20, backgroundColor: '#F5F5F5', paddingTop: 10 }} showsVerticalScrollIndicator={false} >
{this.state.arrayDummy.map((item, index) => {
{this.state.listData.map((item, index) => {
return (
<View key={index} style={{ paddingHorizontal: 7 }}>
<TouchableOpacity style={{ marginTop: 10, borderRadius: 20 }} onPress={() => this.props.navigation.navigate('MenuAppraisal')}>
{!this.state.loading && (
<TouchableOpacity style={{ marginTop: 10, borderRadius: 20 }} onPress={() => this.props.navigation.navigate('MenuAppraisal', { data: item })}>
<View style={{ height: 60, backgroundColor: '#e4b300', justifyContent: 'space-between', paddingHorizontal: 20, flexDirection: 'row', borderTopRightRadius: 10, borderTopLeftRadius: 10 }}>
<View style={{ justifyContent: 'center' }}>
<Text style={{ color: 'white', fontSize: 16, fontWeight: '700' }}>{item.noKontrak}</Text>
<Text style={{ color: 'white', fontSize: 14 }}>{item.petugas}</Text>
<Text style={{ color: 'white', fontSize: 16, fontWeight: '700' }}>{item.contract_number}</Text>
<Text style={{ color: 'white', fontSize: 14 }}>{item.nasabah_name}</Text>
</View>
<View style={{ justifyContent: 'center' }}>
<Text style={{ color: 'white', fontSize: 14, textAlign: 'center' }}>{item.namaWerehouse}</Text>
<Text style={{ color: 'white', fontSize: 14, textAlign: 'center' }}>{item.warehouse_code}</Text>
</View>
</View>
<View style={{ height: 60, backgroundColor: '#E6E6E6', justifyContent: 'space-between', paddingHorizontal: 20, flexDirection: 'row', borderBottomRightRadius: 10, borderBottomLeftRadius: 10 }}>
<View style={{ justifyContent: 'center' }}>
<Text style={{ color: 'black', fontSize: 14 }}>{item.brand} - {item.type}</Text>
<Text style={{ color: 'black', fontSize: 14 }}>{item.noPol}</Text>
<Text style={{ color: 'black', fontSize: 14 }}>{item.brand} - {item.model}</Text>
<Text style={{ color: 'black', fontSize: 14 }}>{item.police_number}</Text>
</View>
<View style={{ justifyContent: 'center' }}>
<Text style={{ color: 'black', fontSize: 14, textAlign: 'center' }}>{item.status}</Text>
<Text style={{ color: 'black', fontSize: 14 }}>{item.appraisal_status}</Text>
<Text style={{ color: 'black', fontSize: 14 }}>{item.pull_officer}</Text>
</View>
</View>
{/* <View style={{ backgroundColor: '#E6E6E6', borderBottomRightRadius: 10, borderBottomLeftRadius: 10, justifyContent: 'center', paddingHorizontal: 20, paddingVertical: 10, borderTopWidth: .7, borderTopColor: 'black' }}>
</View> */}
</TouchableOpacity>
{/* <TouchableOpacity style={{ width: '100%', backgroundColor: '#FFFFFF', borderRadius: 15, paddingHorizontal: 10, shadowRadius: 80, paddingVertical: 10, marginTop: 10 }} onPress={() => this.props.navigation.navigate('MenuAppraisal')}>
<View style={{ width: 120, height: 20, backgroundColor: 'black', marginLeft: -20, marginTop: 5, borderTopRightRadius: 5, borderBottomRightRadius: 5 }}>
<Text style={{ color: 'white', textAlign: 'center' }}>{item.status}</Text>
</View>
<View style={{
backgroundColor: '#E6E6E6', height: 10, width: 10,
marginLeft: -20,
backgroundColor: 'transparent',
borderStyle: 'solid',
borderTopWidth: 8,
borderRightWidth: 0,
borderBottomWidth: 0,
borderLeftWidth: 10,
borderTopColor: 'black',
borderRightColor: 'transparent',
borderBottomColor: 'transparent',
borderLeftColor: 'transparent',
}} />
<View style={{ flexDirection: 'row' }}>
<View style={{ width: '80%' }}>
<View style={{ flexDirection: 'row', justifyContent: 'space-between' }}>
<Text style={{ alignSelf: 'center', fontSize: 16, fontWeight: 'bold' }}>{item.noKontrak}</Text>
<Text style={{ alignSelf: 'center', fontSize: 14 }}>{item.namaWerehouse}</Text>
</View>
<View style={{ flexDirection: 'row', justifyContent: 'space-between' }}>
<Text style={{ alignSelf: 'center', fontSize: 14 }}>{item.tglTerima}</Text>
<Text style={{ alignSelf: 'center', fontSize: 14 }}>{item.petugas}</Text>
</View>
</View>
<View style={{ justifyContent: 'center', width: '20%', alignItems: 'flex-end' }}>
<Next name="navigate-next" size={26} />
</View>
</View>
</TouchableOpacity> */}
)}
{this.state.loading && (
<SvgAnimatedLinearGradient
height={140}
borderRadius={200}
marginTop={-15}
width={'100%'}
duration={800}
primaryColor="#fff3c9"
secondaryColor="#e4b300"
>
<Rect x="0" y="30" rx="5" ry="1" width="1000" height="120" />
</SvgAnimatedLinearGradient>
)}
</View>
)
})}
......
import React, { Component } from 'react'
import { Text, View, ScrollView, TouchableOpacity } from 'react-native'
import { Container } from 'native-base'
import api from '../../../service/api'
import SvgAnimatedLinearGradient from 'react-native-svg-animated-linear-gradient'
import Svg, { Circle, Rect } from 'react-native-svg'
import Reactron from 'reactotron-react-native'
import Next from 'react-native-vector-icons/MaterialIcons'
export default class Approval extends Component {
constructor(props) {
super(props)
this.state = {
arrayDummy: [
{ noKontrak: 'K-2001920', namaWerehouse: 'Branch-2', petugas: 'Dadang Tukimin', tglTerima: '03-03-2020', status: 'Draft', brand: 'Honda', type: 'Revo', noPol: 'B 4203 PWK' },
{ 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: [],
loading: false
}
}
componentDidMount() {
this.getListApproval()
}
getListApproval() {
this.setState({ loading: true })
api.create().getListApproval({
warehouse_id: 2
}).then((response) => {
console.log(JSON.stringify(response.data))
if (response.data.status == "success") {
let listData = []
response.data.data.map((item, index) => {
if (item.appraisal_status != 'Rejected') {
listData.push(item)
}
})
this.setState({ listData }, () => {
setTimeout(() => {
this.setState({ loading: false })
}, 500);
})
}
})
}
render() {
return (
<Container style={{ flex: 1 }}>
<ScrollView style={{ paddingHorizontal: 20, backgroundColor: '#F5F5F5', paddingTop: 10 }} showsVerticalScrollIndicator={false} >
{this.state.listData.map((item, index) => {
return (
<View key={index} style={{ paddingHorizontal: 7 }}>
{!this.state.loading && (
<TouchableOpacity style={{ marginTop: 10, borderRadius: 20 }} onPress={() => this.props.navigation.navigate('MenuAppraisal', { data: item })}>
<View style={{ height: 60, backgroundColor: '#e4b300', justifyContent: 'space-between', paddingHorizontal: 20, flexDirection: 'row', borderTopRightRadius: 10, borderTopLeftRadius: 10 }}>
<View style={{ justifyContent: 'center' }}>
<Text style={{ color: 'white', fontSize: 16, fontWeight: '700' }}>{item.contract_number}</Text>
<Text style={{ color: 'white', fontSize: 14 }}>{item.nasabah_name}</Text>
</View>
<View style={{ justifyContent: 'center' }}>
<Text style={{ color: 'white', fontSize: 14, textAlign: 'center' }}>{item.warehouse_code}</Text>
</View>
</View>
<View style={{ height: 60, backgroundColor: '#E6E6E6', justifyContent: 'space-between', paddingHorizontal: 20, flexDirection: 'row', borderBottomRightRadius: 10, borderBottomLeftRadius: 10 }}>
<View style={{ justifyContent: 'center' }}>
<Text style={{ color: 'black', fontSize: 14 }}>{item.brand} - {item.model}</Text>
<Text style={{ color: 'black', fontSize: 14 }}>{item.police_number}</Text>
</View>
<View style={{ justifyContent: 'center' }}>
<Text style={{ color: 'black', fontSize: 14 }}>{item.appraisal_status}</Text>
<Text style={{ color: 'black', fontSize: 14 }}>{item.pull_officer}</Text>
</View>
</View>
</TouchableOpacity>
)}
{this.state.loading && (
<SvgAnimatedLinearGradient
height={140}
borderRadius={200}
marginTop={-15}
width={'100%'}
duration={800}
primaryColor="#fff3c9"
secondaryColor="#e4b300"
>
<Rect x="0" y="30" rx="5" ry="1" width="1000" height="120" />
</SvgAnimatedLinearGradient>
)}
</View>
)
})}
</ScrollView>
</Container>
)
}
}
......@@ -19,6 +19,7 @@ import Penerimaan from '../container/home/penerimaan/penerimaan'
import MenuPenerimaan from '../container/home/penerimaan/sampleMenuPenerimaan'
import MenuPenerimaan2 from '../container/home/penerimaan/sampleMenuPenerimaan2'
import MenuPenerimaan3 from '../container/home/penerimaan/sampleMenuPenerimaan3'
import Approval from '../container/home/approval/approval'
//IconBack
import IconBack from 'react-native-vector-icons/MaterialIcons'
......@@ -46,6 +47,7 @@ const MainNavigator = createStackNavigator({
MenuPenerimaan: { screen: MenuPenerimaan, navigationOptions: { title: 'Menu Penerimaan' } },
MenuPenerimaan2: { screen: MenuPenerimaan2, navigationOptions: { title: 'Menu Penerimaan' } },
MenuPenerimaan3: { screen: MenuPenerimaan3, navigationOptions: { title: 'Menu Penerimaan' } },
Approval: { screen: Approval, navigationOptions: { title: 'Approval' } },
// LatihanDragDrop: { screen: LatihanDragDrop, navigationOptions: { title: 'Latihan'}}
}, {
headerMode: 'screen',
......
......@@ -47,6 +47,8 @@ const create = () => {
const getWarehouse = () => GET('demo/get_user_warehouse')
const getPermission = () => GET('demo/get_permission')
const getUserWarehouse = () => GET('demo/get_user_warehouse')
const getListAppraisal = (value) => POST('demo/get_list_appraisal', value)
const getListApproval = (value) => POST('demo/get_list_approval', value)
return {
......@@ -54,7 +56,9 @@ const create = () => {
getListClar,
getWarehouse,
getPermission,
getUserWarehouse
getUserWarehouse,
getListAppraisal,
getListApproval
}
}
......
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