Commit 88b6ca29 authored by Deni Rinaldi's avatar Deni Rinaldi

binding menuPenerimaan #1

parent 4b207ce0
......@@ -12,7 +12,8 @@ export default class Penerimaan extends Component {
arrayDummy: [
{ noKontrak: 'K-2001920', namaWerehouse: 'Branch-1', petugas: 'Dadang', tglTerima: '03-03-2020' },
{ noKontrak: 'K-2001921', namaWerehouse: 'Branch-2', petugas: 'Dudung', tglTerima: '03-03-2020' },
]
],
listClar: []
}
}
......@@ -25,7 +26,11 @@ export default class Penerimaan extends Component {
api.create().getListClar({
warehouse_id: Number(this.props.navigation.state.params.data)
}).then((response) => {
alert(JSON.stringify(response.data.data))
let listClar = []
response.data.data.map((item, index) => {
listClar.push(item)
})
this.setState({ listClar })
})
}
......@@ -34,47 +39,30 @@ export default class Penerimaan extends Component {
<Container style={{ flex: 1 }}>
<ScrollView style={{ paddingHorizontal: 20, backgroundColor: '#F5F5F5', paddingTop: 10 }} showsVerticalScrollIndicator={false} >
{this.state.arrayDummy.map((item, index) => {
{this.state.listClar.map((item, index) => {
return (
<View key={index} style={{ paddingHorizontal: 7 }}>
<TouchableOpacity style={{ width: '100%', backgroundColor: '#FFFFFF', borderRadius: 15, paddingHorizontal: 10, shadowRadius: 80, paddingVertical: 10, marginTop: 10 }} onPress={() => this.props.navigation.navigate('MenuPenerimaan')}>
<View style={{ width: 80, height: 20, backgroundColor: 'black', marginLeft: -20, marginTop: 5, borderTopRightRadius: 5, borderBottomRightRadius: 5 }}>
<Text style={{ color: 'white', textAlign: 'center' }}>{item.namaWerehouse}</Text>
<TouchableOpacity style={{ marginTop: 10, borderRadius: 20 }} onPress={() => this.props.navigation.navigate('MenuPenerimaan', {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={{
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', width: '100%', backgroundColor: 'red' }}> */}
<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> */}
{/* <View style={{ flexDirection: 'row', justifyContent: 'space-between' }}> */}
<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={{ 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', width: '20%', alignItems: 'flex-end' }}>
<Next name="navigate-next" size={26} />
<View style={{ justifyContent: 'center' }}>
<Text style={{ color: 'black', fontSize: 14, textAlign: 'center' }}>{item.collector}</Text>
</View>
</View>
</TouchableOpacity>
</TouchableOpacity>
</View>
)
})}
......
......@@ -13,6 +13,7 @@ export default class sampleMenuPenerimaan extends Component {
constructor(props) {
super(props)
this.state = {
data: this.props.navigation.state.params.data,
dateUpdate: M(new Date()).format('DD-MMM-YYYY'),
datePenerimaan: M(new Date()).format('DD-MMM-YYYY'),
checked: 'first',
......@@ -29,7 +30,7 @@ export default class sampleMenuPenerimaan extends Component {
}
componentDidMount() {
// alert(this.state.date)
// alert(JSON.stringify(this.state.data))
}
handlePenerimaanDate(date) {
......@@ -43,6 +44,7 @@ export default class sampleMenuPenerimaan extends Component {
}
render() {
let { data } = this.state
return (
<Container style={{ flex: 1, paddingHorizontal: 20, paddingBottom: 20 }}>
<ScrollView
......@@ -85,7 +87,7 @@ export default class sampleMenuPenerimaan extends Component {
<View style={styles.viewInputDisable}>
<TextInput
style={styles.textInput}
value={'#dropdown'}
value={String(data.branch_id)}
editable={false}
/>
</View>
......@@ -98,7 +100,7 @@ export default class sampleMenuPenerimaan extends Component {
<View style={styles.viewInputDisable}>
<TextInput
style={styles.textInput}
value={'#autofill'}
value={data.warehouse_code}
editable={false}
/>
</View>
......@@ -111,7 +113,7 @@ export default class sampleMenuPenerimaan extends Component {
<View style={styles.viewInputDisable}>
<TextInput
style={styles.textInput}
value={'#livesearch'}
value={data.contract_number}
editable={false}
/>
</View>
......@@ -124,7 +126,7 @@ export default class sampleMenuPenerimaan extends Component {
<View style={styles.viewInputDisable}>
<TextInput
style={styles.textInput}
value={'#autofill'}
value={data.sub_contract_number}
editable={false}
/>
</View>
......@@ -137,7 +139,7 @@ export default class sampleMenuPenerimaan extends Component {
<View style={styles.viewInputDisable}>
<TextInput
style={styles.textInput}
value={'#autofill'}
value={data.nasabah_name}
editable={false}
/>
</View>
......@@ -151,7 +153,7 @@ export default class sampleMenuPenerimaan extends Component {
<TextInput
onChangeText={(e) => this.setState({ kodeWerehouse: e })}
style={styles.textInput}
value={this.state.kodeWerehouse}
value={data.warehouse_name}
editable
/>
</View>
......@@ -165,7 +167,7 @@ export default class sampleMenuPenerimaan extends Component {
<TextInput
onChangeText={(e) => this.setState({ namaWerehouse: e })}
style={styles.textInput}
value={this.state.namaWerehouse}
value={data.warehouse_code}
editable
/>
</View>
......@@ -179,7 +181,7 @@ export default class sampleMenuPenerimaan extends Component {
<TextInput
onChangeText={(e) => this.setState({ kodeRemote: e })}
style={styles.textInput}
value={this.state.kodeRemote}
value={data.remote_code}
editable
/>
</View>
......@@ -193,7 +195,7 @@ export default class sampleMenuPenerimaan extends Component {
<TextInput
onChangeText={(e) => this.setState({ namaRemote: e })}
style={styles.textInput}
value={this.state.namaRemote}
value={data.remote_name}
editable
/>
</View>
......@@ -216,7 +218,7 @@ export default class sampleMenuPenerimaan extends Component {
/>
<TextInput
style={styles.textInput}
value={this.state.datePenerimaan}
value={data.date_in}
editable={false}
/>
</TouchableOpacity>
......@@ -263,7 +265,7 @@ export default class sampleMenuPenerimaan extends Component {
progress={!this.state.progress}
onPress={next => {
setTimeout(() => {
this.props.navigation.navigate('MenuPenerimaan2')
this.props.navigation.navigate('MenuPenerimaan2', { data: this.state.data })
next()
}, 300);
}}
......
......@@ -11,6 +11,7 @@ export default class sampleMenuPenerimaan2 extends Component {
constructor(props) {
super(props)
this.state = {
data: this.props.navigation.state.params.data,
date: new Date(),
checked: 'first',
object: null,
......@@ -22,7 +23,13 @@ export default class sampleMenuPenerimaan2 extends Component {
kunci: null
}
}
componentDidMount(){
// alert(JSON.stringify(this.state.data))
}
render() {
let { data } = this.state
return (
<Container style={{ flex: 1, paddingHorizontal: 10, paddingBottom: 20 }}>
<ScrollView showsVerticalScrollIndicator={false}>
......@@ -97,7 +104,7 @@ export default class sampleMenuPenerimaan2 extends Component {
<View style={{ borderColor: 'rgba(237, 57, 99, .5)', borderWidth: .8, justifyContent: 'center', borderRadius: 5, width: '60%' }}>
<TextInput
style={{ paddingHorizontal: 10, paddingVertical: 0, color: '#999999' }}
value={'Test'}
value={`${data.brand} - ${data.model}`}
/>
</View>
<View style={{ width: '40%', flexDirection: 'row', justifyContent: 'space-between', paddingHorizontal: 5 }}>
......@@ -128,7 +135,7 @@ export default class sampleMenuPenerimaan2 extends Component {
<View style={{ borderColor: 'rgba(237, 57, 99, .5)', borderWidth: .8, justifyContent: 'center', borderRadius: 5, width: '60%' }}>
<TextInput
style={{ paddingHorizontal: 10, paddingVertical: 0, color: '#999999' }}
value={'Test'}
value={data.chassis_number}
/>
</View>
<View style={{ width: '40%', flexDirection: 'row', justifyContent: 'space-between', paddingHorizontal: 5 }}>
......@@ -159,7 +166,7 @@ export default class sampleMenuPenerimaan2 extends Component {
<View style={{ borderColor: 'rgba(237, 57, 99, .5)', borderWidth: .8, justifyContent: 'center', borderRadius: 5, width: '60%' }}>
<TextInput
style={{ paddingHorizontal: 10, paddingVertical: 0, color: '#999999' }}
value={'Test'}
value={data.police_number}
/>
</View>
<View style={{ width: '40%', flexDirection: 'row', justifyContent: 'space-between', paddingHorizontal: 5 }}>
......@@ -190,7 +197,7 @@ export default class sampleMenuPenerimaan2 extends Component {
<View style={{ borderColor: 'rgba(237, 57, 99, .5)', borderWidth: .8, justifyContent: 'center', borderRadius: 5, width: '60%' }}>
<TextInput
style={{ paddingHorizontal: 10, paddingVertical: 0, color: '#999999' }}
value={'Test'}
value={data.engine_number}
/>
</View>
<View style={{ width: '40%', flexDirection: 'row', justifyContent: 'space-between', paddingHorizontal: 5 }}>
......@@ -231,16 +238,16 @@ export default class sampleMenuPenerimaan2 extends Component {
<View style={{ width: '40%', flexDirection: 'row', justifyContent: 'space-between', paddingHorizontal: 5 }}>
<View>
<RadioButton
value="true"
status={this.state.stnk === 'true' ? 'checked' : 'unchecked'}
onPress={() => { this.setState({ stnk: 'true' }); }}
value={data.stnk_recondition}
status={data.stnk_recondition === true ? 'checked' : 'unchecked'}
onPress={() => { this.setState({ stnk: true }); }}
/>
</View>
<View>
<RadioButton
value="false"
status={this.state.stnk === 'false' ? 'checked' : 'unchecked'}
onPress={() => { this.setState({ stnk: 'false' }); }}
value={data.stnk_recondition}
status={data.stnk_recondition === false ? 'checked' : 'unchecked'}
onPress={() => { this.setState({ stnk: false }); }}
/>
</View>
</View>
......@@ -262,15 +269,15 @@ export default class sampleMenuPenerimaan2 extends Component {
<View style={{ width: '40%', flexDirection: 'row', justifyContent: 'space-between', paddingHorizontal: 5 }}>
<View>
<RadioButton
value="true"
status={this.state.kunci === 'true' ? 'checked' : 'unchecked'}
value={data.unit_key}
status={data.unit_key === true ? 'checked' : 'unchecked'}
onPress={() => { this.setState({ kunci: 'true' }); }}
/>
</View>
<View>
<RadioButton
value="false"
status={this.state.kunci === 'false' ? 'checked' : 'unchecked'}
value={data.unit_key}
status={data.unit_key === false ? 'checked' : 'unchecked'}
onPress={() => { this.setState({ kunci: 'false' }); }}
/>
</View>
......
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