Commit 038fe3b7 authored by Deni Rinaldi's avatar Deni Rinaldi

fix data demo

parent 692c6cd3
......@@ -70,13 +70,14 @@ export default class Appraisal extends Component {
<View style={{flex: 1, alignItems: 'center', justifyContent: 'center'}}>
<Text style={{fontStyle: 'italic'}}>No data found ...</Text>
</View>}
{this.state.listData.length > 0 && <ScrollView style={{ paddingHorizontal: 20, backgroundColor: '#F5F5F5', paddingTop: 10 }} showsVerticalScrollIndicator={false} >
{this.state.listData.length > 0 &&
<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 })}>
<TouchableOpacity style={this.state.listData.length - 1 === index ? { marginTop: 10, borderRadius: 20, marginBottom: 20} : { 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>
......
......@@ -144,7 +144,7 @@ export default class Approval extends Component {
</View>
)}
{!this.state.loading && (
<TouchableOpacity style={{ marginLeft: this.state.longPress? 10 : 0, marginTop: 20, borderRadius: 20, width: this.state.longPress? '90%' : '100%'}} onLongPress={() => this.setState({longPress: true}, () => this.handleArrayContract(item.contract_id) )} delayLongPress={100} onPress={() => this.state.longPress? this.handleArrayContract(item.contract_id) : this.props.navigation.navigate('MenuApproval', { data: item })}>
<TouchableOpacity style={this.state.listData.length - 1 === index ? { marginLeft: this.state.longPress? 10 : 0, marginTop: 10, borderRadius: 20, width: this.state.longPress? '90%' : '100%', marginBottom: 20} : { marginLeft: this.state.longPress? 10 : 0, marginTop: 10, borderRadius: 20, width: this.state.longPress? '90%' : '100%'}} onLongPress={() => this.setState({longPress: true}, () => 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={{ justifyContent: 'center' }}>
<Text style={{ color: 'white', fontSize: 16, fontWeight: '700' }}>{item.contract_number}</Text>
......
......@@ -62,12 +62,13 @@ export default class Penerimaan extends Component {
<View style={{flex: 1, alignItems: 'center', justifyContent: 'center'}}>
<Text style={{fontStyle: 'italic'}}>No data found ...</Text>
</View>}
{this.state.listClar.length > 0 && <ScrollView style={{ paddingHorizontal: 20, backgroundColor: '#F5F5F5', paddingTop: 10 }} showsVerticalScrollIndicator={false} >
{this.state.listClar.length > 0 &&
<ScrollView style={{ paddingHorizontal: 20, backgroundColor: '#F5F5F5', paddingTop: 10 }} showsVerticalScrollIndicator={false} >
{this.state.listClar.map((item, index) => {
return (
<View key={index} style={{ paddingHorizontal: 7 }}>
{!this.state.loading && (
<TouchableOpacity style={{ marginTop: 10, borderRadius: 20 }} onPress={() => this.props.navigation.navigate('MenuPenerimaan', { data: item, type: 'clar' })}>
<TouchableOpacity style={this.state.listClar.length - 1 === index ? { marginTop: 10, borderRadius: 20, marginBottom: 20} : { marginTop: 10, borderRadius: 20 }} onPress={() => this.props.navigation.navigate('MenuPenerimaan', { data: item, type: 'clar' })}>
<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>
......
......@@ -17,8 +17,8 @@ export default class sampleMenuPenerimaan extends Component {
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'),
dateUpdate: M(new Date()).format('YYYY-MM-DD'),
datePenerimaan: M(new Date()).format('YYYY-MM-DD'),
checked: 'first',
progress: false,
kodeWerehouse: '#daridepan',
......@@ -265,7 +265,7 @@ export default class sampleMenuPenerimaan extends Component {
<View style={{ height: 30, justifyContent: 'center' }}>
<Text style={{ fontSize: 13 }}>Kode Remote</Text>
</View>
<View style={styles.viewInputEnable}>
<View style={this.state.data == "" ? styles.viewInputEnable : styles.viewInputDisable}>
<TextInput
onChangeText={(e) => this.setState({ kodeRemote: e })}
style={styles.textInput}
......@@ -279,7 +279,7 @@ export default class sampleMenuPenerimaan extends Component {
<View style={{ height: 30, justifyContent: 'center' }}>
<Text style={{ fontSize: 13 }}>Nama Remote</Text>
</View>
<View style={styles.viewInputEnable}>
<View style={this.state.data == "" ? styles.viewInputEnable : styles.viewInputDisable}>
<TextInput
onChangeText={(e) => this.setState({ namaRemote: e })}
style={styles.textInput}
......@@ -294,8 +294,7 @@ export default class sampleMenuPenerimaan extends Component {
<Text style={{ fontSize: 13 }}>Tanggal Penerimaan</Text>
</View>
<TouchableOpacity
style={styles.viewInputEnable}
style={this.state.data == "" ? styles.viewInputEnable : styles.viewInputDisable}
onPress={() => this.setState({ isDateTimePickerVisiblePenerimaan: true })}
>
<DateTimePicker
......@@ -317,8 +316,7 @@ export default class sampleMenuPenerimaan extends Component {
<Text style={{ fontSize: 13 }}>Tanggal Update</Text>
</View>
<TouchableOpacity
style={styles.viewInputEnable}
style={this.state.data == "" ? styles.viewInputEnable : styles.viewInputDisable}
onPress={() => this.setState({ isDateTimePickerVisible: true })}
>
<DateTimePicker
......
......@@ -20,7 +20,12 @@ export default class sampleMenuPenerimaan2 extends Component {
noPolisi: null,
noMesin: null,
stnk: null,
kunci: null
kunci: null,
model: '',
merk1: '',
rangka: '',
nopol: '',
mesin: ''
}
}
......@@ -82,7 +87,9 @@ 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={data.model}
value={this.state.data == "" ? this.state.model :data.model}
editable={this.state.data == "" ? true : false}
onChangeText={e => this.setState({ model: e }) }
/>
</View>
<View style={{ width: '40%', flexDirection: 'row', justifyContent: 'space-between', paddingHorizontal: 5 }}>
......@@ -90,14 +97,14 @@ export default class sampleMenuPenerimaan2 extends Component {
<RadioButton
value="true"
status={this.state.object === 'true' ? 'checked' : 'unchecked'}
onPress={() => { this.setState({ object: 'true' }); }}
onPress={() => { this.setState({ object: 'true' }); }}
/>
</View>
<View>
<RadioButton
value="false"
status={this.state.object === 'false' ? 'checked' : 'unchecked'}
onPress={() => { this.setState({ object: 'false' }); }}
onPress={() => { this.setState({ object: 'false' }); }}
/>
</View>
</View>
......@@ -113,7 +120,9 @@ 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={this.state.data == "" ? "" : `${data.brand}`}
value={this.state.data == "" ? this.state.merk1 : `${data.brand}`}
editable={this.state.data == "" ? true : false}
onChangeText={e => this.setState({ merk1: e }) }
/>
</View>
<View style={{ width: '40%', flexDirection: 'row', justifyContent: 'space-between', paddingHorizontal: 5 }}>
......@@ -144,7 +153,9 @@ 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={data.chassis_number}
value={this.state.data == "" ? this.state.rangka :data.chassis_number}
editable={this.state.data == "" ? true : false}
onChangeText={e => this.setState({ rangka: e }) }
/>
</View>
<View style={{ width: '40%', flexDirection: 'row', justifyContent: 'space-between', paddingHorizontal: 5 }}>
......@@ -175,7 +186,9 @@ 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={data.police_number}
value={this.state.data == "" ? this.state.nopol :data.police_number}
editable={this.state.data == "" ? true : false}
onChangeText={e => this.setState({ nopol: e }) }
/>
</View>
<View style={{ width: '40%', flexDirection: 'row', justifyContent: 'space-between', paddingHorizontal: 5 }}>
......@@ -206,7 +219,9 @@ 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={data.engine_number}
value={this.state.data == "" ? this.state.mesin :data.engine_number}
editable={this.state.data == "" ? true : false}
onChangeText={e => this.setState({ mesin: e }) }
/>
</View>
<View style={{ width: '40%', flexDirection: 'row', justifyContent: 'space-between', paddingHorizontal: 5 }}>
......@@ -247,16 +262,16 @@ export default class sampleMenuPenerimaan2 extends Component {
<View style={{ width: '40%', flexDirection: 'row', justifyContent: 'space-between', paddingHorizontal: 5 }}>
<View>
<RadioButton
value={data.stnk_recondition}
status={data.stnk_recondition === true ? 'checked' : 'unchecked'}
onPress={() => { this.setState({ stnk: true }); }}
value={this.state.data == "" ? this.state.stnk : data.stnk_recondition}
status={this.state.data == "" ? this.state.stnk == true ? 'checked' : 'unchecked' : data.stnk_recondition === true ? 'checked' : 'unchecked'}
onPress={() => { this.state.data == "" ? this.setState({ stnk: true }) : this.setState({ data: { ...data, stnk_recondition: true }}) }}
/>
</View>
<View>
<RadioButton
value={data.stnk_recondition}
status={data.stnk_recondition === false ? 'checked' : 'unchecked'}
onPress={() => { this.setState({ stnk: false }); }}
value={this.state.data == "" ? this.state.stnk : data.stnk_recondition}
status={this.state.data == "" ? this.state.stnk == false ? 'checked' : 'unchecked' : data.stnk_recondition === false ? 'checked' : 'unchecked'}
onPress={() => { this.state.data == "" ? this.setState({ stnk: false }) : this.setState({ data: { ...data, stnk_recondition: false }}) }}
/>
</View>
</View>
......@@ -276,18 +291,18 @@ export default class sampleMenuPenerimaan2 extends Component {
/>
</View> */}
<View style={{ width: '40%', flexDirection: 'row', justifyContent: 'space-between', paddingHorizontal: 5 }}>
<View>
<View>
<RadioButton
value={data.unit_key}
status={data.unit_key === true ? 'checked' : 'unchecked'}
onPress={() => { this.setState({ kunci: 'true' }); }}
value={this.state.data == "" ? this.state.kunci : data.unit_key}
status={this.state.data == "" ? this.state.kunci == true ? 'checked' : 'unchecked' : data.unit_key === true ? 'checked' : 'unchecked'}
onPress={() => { this.state.data == "" ? this.setState({ kunci: true }) : this.setState({ data: { ...data, unit_key: true }}) }}
/>
</View>
<View>
<RadioButton
value={data.unit_key}
status={data.unit_key === false ? 'checked' : 'unchecked'}
onPress={() => { this.setState({ kunci: 'false' }); }}
value={this.state.data == "" ? this.state.kunci : data.unit_key}
status={this.state.data == "" ? this.state.kunci == false ? 'checked' : 'unchecked' : data.unit_key === false ? 'checked' : 'unchecked'}
onPress={() => { this.state.data == "" ? this.setState({ kunci: false }) : this.setState({ data: { ...data, unit_key: false }}) }}
/>
</View>
</View>
......
......@@ -47,13 +47,13 @@ export default class sampleMenuPenerimaan3 extends Component {
}
// alert(JSON.stringify(this.state.data)) componentDidMount(){
BackHandler.addEventListener('hardwareBackPress', this.handleBackButtonClick);
}
}
componentWillUnmount() {
BackHandler.removeEventListener('hardwareBackPress', this.handleBackButtonClick);
}
handleBackButtonClick = () => {
handleBackButtonClick = () => {
this.props.navigation.goBack()
return true;
}
......@@ -181,7 +181,7 @@ export default class sampleMenuPenerimaan3 extends Component {
>
<View style={{ height: '85%' }}>
<ImageViewer
imageUrls={this.state.mesinArray}
imageUrls={this.state.mesinArray}
/>
</View>
</Modal>
......@@ -218,7 +218,7 @@ export default class sampleMenuPenerimaan3 extends Component {
<View style={{ height: 30, justifyContent: 'center' }}>
<Text style={{ fontSize: 13 }}>Foto No Rangka</Text>
</View>
<TouchableOpacity style={styles.viewRangka} onPress={() => this.requestCameraPermission('rangka')}>
<TouchableOpacity activeOpacity={this.state.data == "" ? .7 : 1 } style={styles.viewRangka} onPress={() => { this.state.data == "" ? this.requestCameraPermission('rangka') : null }}>
<View
style={{
width: '100%', height: '100%', borderColor: 'rgba(237, 57, 99, .5)', borderStyle: 'dotted', borderWidth: 2, borderRadius: 5
......@@ -241,7 +241,7 @@ export default class sampleMenuPenerimaan3 extends Component {
<View style={{ height: 30, justifyContent: 'center' }}>
<Text style={{ fontSize: 13 }}>Foto No Mesin</Text>
</View>
<TouchableOpacity style={styles.viewRangka} onPress={() => { this.requestCameraPermission('mesin') }}>
<TouchableOpacity activeOpacity={this.state.data == "" ? .7 : 1 } style={styles.viewRangka} onPress={() => { this.state.data == "" ? this.requestCameraPermission('mesin') : null }}>
<View
style={{
width: '100%', height: '100%', borderColor: 'rgba(237, 57, 99, .5)', borderStyle: 'dotted', borderWidth: 2, borderRadius: 5
......@@ -266,7 +266,7 @@ export default class sampleMenuPenerimaan3 extends Component {
</View>
<View style={styles.viewFotoUnit}>
<View style={{ flexDirection: 'row', height: '40%', justifyContent: 'space-between' }}>
<TouchableOpacity style={{ width: '30%', height: '80%', }} onPress={() => this.requestCameraPermission('1')}>
<TouchableOpacity activeOpacity={this.state.data == "" ? .7 : 1 } style={{ width: '30%', height: '80%', }} onPress={() => { this.state.data == "" ? this.requestCameraPermission('1') : null }}>
<View
style={{
width: '100%', height: '100%', borderColor: 'rgba(237, 57, 99, .5)', borderStyle: 'dotted', borderWidth: 2, borderRadius: 5
......@@ -284,7 +284,7 @@ export default class sampleMenuPenerimaan3 extends Component {
</View>
<Text style={{ fontSize: 10 }}>Bag. Depan</Text>
</TouchableOpacity>
<TouchableOpacity style={{ width: '30%', height: '80%', }} onPress={() => this.requestCameraPermission('2')}>
<TouchableOpacity activeOpacity={this.state.data == "" ? .7 : 1 } style={{ width: '30%', height: '80%', }} onPress={() => { this.state.data == "" ? this.requestCameraPermission('2') : null }}>
<View
style={{
width: '100%', height: '100%', borderColor: 'rgba(237, 57, 99, .5)', borderStyle: 'dotted', borderWidth: 2, borderRadius: 5
......@@ -302,7 +302,7 @@ export default class sampleMenuPenerimaan3 extends Component {
</View>
<Text style={{ fontSize: 10, flexWrap: 'nowrap' }}>Bag. Belakang</Text>
</TouchableOpacity>
<TouchableOpacity style={{ width: '30%', height: '80%', }} onPress={() => this.requestCameraPermission('3')}>
<TouchableOpacity activeOpacity={this.state.data == "" ? .7 : 1 } style={{ width: '30%', height: '80%', }} onPress={() => { this.state.data == "" ? this.requestCameraPermission('3') : null }}>
<View
style={{
width: '100%', height: '100%', borderColor: 'rgba(237, 57, 99, .5)', borderStyle: 'dotted', borderWidth: 2, borderRadius: 5
......@@ -323,7 +323,7 @@ export default class sampleMenuPenerimaan3 extends Component {
</View>
<View style={{ flexDirection: 'row', height: '40%', justifyContent: 'space-between' }}>
<TouchableOpacity style={{ width: '30%', height: '80%', }} onPress={() => this.requestCameraPermission('4')}>
<TouchableOpacity activeOpacity={this.state.data == "" ? .7 : 1 } style={{ width: '30%', height: '80%', }} onPress={() => { this.state.data == "" ? this.requestCameraPermission('4') : null }}>
<View
style={{
width: '100%', height: '100%', borderColor: 'rgba(237, 57, 99, .5)', borderStyle: 'dotted', borderWidth: 2, borderRadius: 5
......@@ -341,7 +341,7 @@ export default class sampleMenuPenerimaan3 extends Component {
</View>
<Text style={{ fontSize: 10 }}>Sisi Kanan</Text>
</TouchableOpacity>
<TouchableOpacity style={{ width: '30%', height: '80%', }} onPress={() => this.requestCameraPermission('5')}>
<TouchableOpacity activeOpacity={this.state.data == "" ? .7 : 1 } style={{ width: '30%', height: '80%', }} onPress={() => { this.state.data == "" ? this.requestCameraPermission('5') : null }}>
<View
style={{
width: '100%', height: '100%', borderColor: 'rgba(237, 57, 99, .5)', borderStyle: 'dotted', borderWidth: 2, borderRadius: 5
......@@ -359,7 +359,7 @@ export default class sampleMenuPenerimaan3 extends Component {
</View>
<Text style={{ fontSize: 11 }}>Sisi Kiri</Text>
</TouchableOpacity>
<TouchableOpacity style={{ width: '30%', height: '80%', }} onPress={() => this.requestCameraPermission('6')}>
<TouchableOpacity activeOpacity={this.state.data == "" ? .7 : 1 } style={{ width: '30%', height: '80%', }} onPress={() => { this.state.data == "" ? this.requestCameraPermission('6') : null }}>
<View
style={{
width: '100%', height: '100%', borderColor: 'rgba(237, 57, 99, .5)', borderStyle: 'dotted', borderWidth: 2, borderRadius: 5
......@@ -377,11 +377,11 @@ export default class sampleMenuPenerimaan3 extends Component {
</View>
<Text style={{ fontSize: 10 }}>Belakang Kiri</Text>
</TouchableOpacity>
</View>
</View>
</View>
</View>
</ScrollView>
{this.state.data == "" ?
{this.state.data == "" ?
<View style={{ width: '100%', justifyContent: 'center', marginTop: 20, alignSelf: 'center', alignContent: 'flex-end', alignItems: 'center' }}>
<AwesomeButton
backgroundColor={Colors.yellowBasic}
......@@ -462,6 +462,6 @@ const styles = StyleSheet.create({
viewInputEnable: { width: '63%', borderColor: 'rgba(237, 57, 99, .5)', borderWidth: .8, justifyContent: 'center', height: 30, borderRadius: 5 },
viewInputDisable: { width: '63%', backgroundColor: '#E6E6E6', justifyContent: 'center', height: 30, borderRadius: 5 },
viewRangka: { width: '63%', borderColor: 'rgba(237, 57, 99, .5)', borderWidth: .8, borderRadius: 5, padding: 10, height: 100, justifyContent: 'space-between' },
viewFotoUnit: { width: '63%', borderColor: 'rgba(237, 57, 99, .5)', borderWidth: .8, borderRadius: 5, paddingHorizontal: 10, paddingVertical:20, height: 150, justifyContent: 'space-between' },
viewFotoUnit: { width: '63%', borderColor: 'rgba(237, 57, 99, .5)', borderWidth: .8, borderRadius: 5, paddingHorizontal: 10, paddingVertical: 20, height: 150, justifyContent: 'space-between' },
textInput: { paddingHorizontal: 10, paddingVertical: 0, color: '#999999' },
})
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