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
......
......@@ -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