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 { ...@@ -70,13 +70,14 @@ export default class Appraisal extends Component {
<View style={{flex: 1, alignItems: 'center', justifyContent: 'center'}}> <View style={{flex: 1, alignItems: 'center', justifyContent: 'center'}}>
<Text style={{fontStyle: 'italic'}}>No data found ...</Text> <Text style={{fontStyle: 'italic'}}>No data found ...</Text>
</View>} </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) => { {this.state.listData.map((item, index) => {
return ( return (
<View key={index} style={{ paddingHorizontal: 7 }}> <View key={index} style={{ paddingHorizontal: 7 }}>
{!this.state.loading && ( {!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={{ 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>
......
...@@ -144,7 +144,7 @@ export default class Approval extends Component { ...@@ -144,7 +144,7 @@ export default class Approval extends Component {
</View> </View>
)} )}
{!this.state.loading && ( {!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={{ 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>
......
...@@ -62,12 +62,13 @@ export default class Penerimaan extends Component { ...@@ -62,12 +62,13 @@ export default class Penerimaan extends Component {
<View style={{flex: 1, alignItems: 'center', justifyContent: 'center'}}> <View style={{flex: 1, alignItems: 'center', justifyContent: 'center'}}>
<Text style={{fontStyle: 'italic'}}>No data found ...</Text> <Text style={{fontStyle: 'italic'}}>No data found ...</Text>
</View>} </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) => { {this.state.listClar.map((item, index) => {
return ( return (
<View key={index} style={{ paddingHorizontal: 7 }}> <View key={index} style={{ paddingHorizontal: 7 }}>
{!this.state.loading && ( {!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={{ 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>
......
...@@ -17,8 +17,8 @@ export default class sampleMenuPenerimaan extends Component { ...@@ -17,8 +17,8 @@ export default class sampleMenuPenerimaan extends Component {
super(props) super(props)
this.state = { this.state = {
data: this.props.navigation.state.params.data || "", data: this.props.navigation.state.params.data || "",
dateUpdate: M(new Date()).format('DD-MMM-YYYY'), dateUpdate: M(new Date()).format('YYYY-MM-DD'),
datePenerimaan: M(new Date()).format('DD-MMM-YYYY'), datePenerimaan: M(new Date()).format('YYYY-MM-DD'),
checked: 'first', checked: 'first',
progress: false, progress: false,
kodeWerehouse: '#daridepan', kodeWerehouse: '#daridepan',
...@@ -265,7 +265,7 @@ export default class sampleMenuPenerimaan extends Component { ...@@ -265,7 +265,7 @@ export default class sampleMenuPenerimaan extends Component {
<View style={{ height: 30, justifyContent: 'center' }}> <View style={{ height: 30, justifyContent: 'center' }}>
<Text style={{ fontSize: 13 }}>Kode Remote</Text> <Text style={{ fontSize: 13 }}>Kode Remote</Text>
</View> </View>
<View style={styles.viewInputEnable}> <View style={this.state.data == "" ? styles.viewInputEnable : styles.viewInputDisable}>
<TextInput <TextInput
onChangeText={(e) => this.setState({ kodeRemote: e })} onChangeText={(e) => this.setState({ kodeRemote: e })}
style={styles.textInput} style={styles.textInput}
...@@ -279,7 +279,7 @@ export default class sampleMenuPenerimaan extends Component { ...@@ -279,7 +279,7 @@ export default class sampleMenuPenerimaan extends Component {
<View style={{ height: 30, justifyContent: 'center' }}> <View style={{ height: 30, justifyContent: 'center' }}>
<Text style={{ fontSize: 13 }}>Nama Remote</Text> <Text style={{ fontSize: 13 }}>Nama Remote</Text>
</View> </View>
<View style={styles.viewInputEnable}> <View style={this.state.data == "" ? styles.viewInputEnable : styles.viewInputDisable}>
<TextInput <TextInput
onChangeText={(e) => this.setState({ namaRemote: e })} onChangeText={(e) => this.setState({ namaRemote: e })}
style={styles.textInput} style={styles.textInput}
...@@ -294,8 +294,7 @@ export default class sampleMenuPenerimaan extends Component { ...@@ -294,8 +294,7 @@ export default class sampleMenuPenerimaan extends Component {
<Text style={{ fontSize: 13 }}>Tanggal Penerimaan</Text> <Text style={{ fontSize: 13 }}>Tanggal Penerimaan</Text>
</View> </View>
<TouchableOpacity <TouchableOpacity
style={styles.viewInputEnable} style={this.state.data == "" ? styles.viewInputEnable : styles.viewInputDisable}
onPress={() => this.setState({ isDateTimePickerVisiblePenerimaan: true })} onPress={() => this.setState({ isDateTimePickerVisiblePenerimaan: true })}
> >
<DateTimePicker <DateTimePicker
...@@ -317,8 +316,7 @@ export default class sampleMenuPenerimaan extends Component { ...@@ -317,8 +316,7 @@ export default class sampleMenuPenerimaan extends Component {
<Text style={{ fontSize: 13 }}>Tanggal Update</Text> <Text style={{ fontSize: 13 }}>Tanggal Update</Text>
</View> </View>
<TouchableOpacity <TouchableOpacity
style={styles.viewInputEnable} style={this.state.data == "" ? styles.viewInputEnable : styles.viewInputDisable}
onPress={() => this.setState({ isDateTimePickerVisible: true })} onPress={() => this.setState({ isDateTimePickerVisible: true })}
> >
<DateTimePicker <DateTimePicker
......
...@@ -47,13 +47,13 @@ export default class sampleMenuPenerimaan3 extends Component { ...@@ -47,13 +47,13 @@ export default class sampleMenuPenerimaan3 extends Component {
} }
// alert(JSON.stringify(this.state.data)) componentDidMount(){ // alert(JSON.stringify(this.state.data)) componentDidMount(){
BackHandler.addEventListener('hardwareBackPress', this.handleBackButtonClick); BackHandler.addEventListener('hardwareBackPress', this.handleBackButtonClick);
} }
componentWillUnmount() { componentWillUnmount() {
BackHandler.removeEventListener('hardwareBackPress', this.handleBackButtonClick); BackHandler.removeEventListener('hardwareBackPress', this.handleBackButtonClick);
} }
handleBackButtonClick = () => { handleBackButtonClick = () => {
this.props.navigation.goBack() this.props.navigation.goBack()
return true; return true;
} }
...@@ -181,7 +181,7 @@ export default class sampleMenuPenerimaan3 extends Component { ...@@ -181,7 +181,7 @@ export default class sampleMenuPenerimaan3 extends Component {
> >
<View style={{ height: '85%' }}> <View style={{ height: '85%' }}>
<ImageViewer <ImageViewer
imageUrls={this.state.mesinArray} imageUrls={this.state.mesinArray}
/> />
</View> </View>
</Modal> </Modal>
...@@ -218,7 +218,7 @@ export default class sampleMenuPenerimaan3 extends Component { ...@@ -218,7 +218,7 @@ export default class sampleMenuPenerimaan3 extends Component {
<View style={{ height: 30, justifyContent: 'center' }}> <View style={{ height: 30, justifyContent: 'center' }}>
<Text style={{ fontSize: 13 }}>Foto No Rangka</Text> <Text style={{ fontSize: 13 }}>Foto No Rangka</Text>
</View> </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 <View
style={{ style={{
width: '100%', height: '100%', borderColor: 'rgba(237, 57, 99, .5)', borderStyle: 'dotted', borderWidth: 2, borderRadius: 5 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 { ...@@ -241,7 +241,7 @@ export default class sampleMenuPenerimaan3 extends Component {
<View style={{ height: 30, justifyContent: 'center' }}> <View style={{ height: 30, justifyContent: 'center' }}>
<Text style={{ fontSize: 13 }}>Foto No Mesin</Text> <Text style={{ fontSize: 13 }}>Foto No Mesin</Text>
</View> </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 <View
style={{ style={{
width: '100%', height: '100%', borderColor: 'rgba(237, 57, 99, .5)', borderStyle: 'dotted', borderWidth: 2, borderRadius: 5 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 { ...@@ -266,7 +266,7 @@ export default class sampleMenuPenerimaan3 extends Component {
</View> </View>
<View style={styles.viewFotoUnit}> <View style={styles.viewFotoUnit}>
<View style={{ flexDirection: 'row', height: '40%', justifyContent: 'space-between' }}> <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 <View
style={{ style={{
width: '100%', height: '100%', borderColor: 'rgba(237, 57, 99, .5)', borderStyle: 'dotted', borderWidth: 2, borderRadius: 5 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 { ...@@ -284,7 +284,7 @@ export default class sampleMenuPenerimaan3 extends Component {
</View> </View>
<Text style={{ fontSize: 10 }}>Bag. Depan</Text> <Text style={{ fontSize: 10 }}>Bag. Depan</Text>
</TouchableOpacity> </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 <View
style={{ style={{
width: '100%', height: '100%', borderColor: 'rgba(237, 57, 99, .5)', borderStyle: 'dotted', borderWidth: 2, borderRadius: 5 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 { ...@@ -302,7 +302,7 @@ export default class sampleMenuPenerimaan3 extends Component {
</View> </View>
<Text style={{ fontSize: 10, flexWrap: 'nowrap' }}>Bag. Belakang</Text> <Text style={{ fontSize: 10, flexWrap: 'nowrap' }}>Bag. Belakang</Text>
</TouchableOpacity> </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 <View
style={{ style={{
width: '100%', height: '100%', borderColor: 'rgba(237, 57, 99, .5)', borderStyle: 'dotted', borderWidth: 2, borderRadius: 5 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 { ...@@ -323,7 +323,7 @@ export default class sampleMenuPenerimaan3 extends Component {
</View> </View>
<View style={{ flexDirection: 'row', height: '40%', justifyContent: 'space-between' }}> <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 <View
style={{ style={{
width: '100%', height: '100%', borderColor: 'rgba(237, 57, 99, .5)', borderStyle: 'dotted', borderWidth: 2, borderRadius: 5 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 { ...@@ -341,7 +341,7 @@ export default class sampleMenuPenerimaan3 extends Component {
</View> </View>
<Text style={{ fontSize: 10 }}>Sisi Kanan</Text> <Text style={{ fontSize: 10 }}>Sisi Kanan</Text>
</TouchableOpacity> </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 <View
style={{ style={{
width: '100%', height: '100%', borderColor: 'rgba(237, 57, 99, .5)', borderStyle: 'dotted', borderWidth: 2, borderRadius: 5 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 { ...@@ -359,7 +359,7 @@ export default class sampleMenuPenerimaan3 extends Component {
</View> </View>
<Text style={{ fontSize: 11 }}>Sisi Kiri</Text> <Text style={{ fontSize: 11 }}>Sisi Kiri</Text>
</TouchableOpacity> </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 <View
style={{ style={{
width: '100%', height: '100%', borderColor: 'rgba(237, 57, 99, .5)', borderStyle: 'dotted', borderWidth: 2, borderRadius: 5 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 { ...@@ -377,11 +377,11 @@ export default class sampleMenuPenerimaan3 extends Component {
</View> </View>
<Text style={{ fontSize: 10 }}>Belakang Kiri</Text> <Text style={{ fontSize: 10 }}>Belakang Kiri</Text>
</TouchableOpacity> </TouchableOpacity>
</View> </View>
</View> </View>
</View> </View>
</ScrollView> </ScrollView>
{this.state.data == "" ? {this.state.data == "" ?
<View style={{ width: '100%', justifyContent: 'center', marginTop: 20, alignSelf: 'center', alignContent: 'flex-end', alignItems: 'center' }}> <View style={{ width: '100%', justifyContent: 'center', marginTop: 20, alignSelf: 'center', alignContent: 'flex-end', alignItems: 'center' }}>
<AwesomeButton <AwesomeButton
backgroundColor={Colors.yellowBasic} backgroundColor={Colors.yellowBasic}
...@@ -462,6 +462,6 @@ const styles = StyleSheet.create({ ...@@ -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 }, 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 }, 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' }, 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' }, 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