Commit 682a58f0 authored by Deni Rinaldi's avatar Deni Rinaldi

foto + tolak penerimaan

parent 6b1962f4
...@@ -24,12 +24,29 @@ export default class sampleMenuPenerimaan3 extends Component { ...@@ -24,12 +24,29 @@ export default class sampleMenuPenerimaan3 extends Component {
viewerMesin: false, viewerMesin: false,
imageRangka: '', imageRangka: '',
imageMesin: '', imageMesin: '',
mesinArray: [] mesinArray: [],
photo1: '',
photo2: '',
photo3: '',
photo4: '',
photo5: '',
photo6: '',
} }
} }
componentDidMount() { componentDidMount() {
if (this.state.data != "") {
this.setState({
photo1: this.props.navigation.state.params.data.photo_unit[0],
photo2: this.props.navigation.state.params.data.photo_unit[1],
photo3: this.props.navigation.state.params.data.photo_unit[2],
photo4: this.props.navigation.state.params.data.photo_unit[3],
photo5: this.props.navigation.state.params.data.photo_unit[4],
photo6: this.props.navigation.state.params.data.photo_unit[5]
})
}
// alert(JSON.stringify(this.state.data)) // alert(JSON.stringify(this.state.data))
} }
async requestCameraPermission(type) { async requestCameraPermission(type) {
...@@ -65,7 +82,31 @@ export default class sampleMenuPenerimaan3 extends Component { ...@@ -65,7 +82,31 @@ export default class sampleMenuPenerimaan3 extends Component {
try { try {
RNFetchBlob.fs.readFile(res.uri, 'base64') RNFetchBlob.fs.readFile(res.uri, 'base64')
.then((data) => { .then((data) => {
if (type == 'rangka') { if (type == '1') {
this.setState({
photo1: res.uri
})
} else if (type == '2') {
this.setState({
photo2: res.uri
})
} else if (type == '3') {
this.setState({
photo3: res.uri
})
} else if (type == '4') {
this.setState({
photo4: res.uri
})
} else if (type == '5') {
this.setState({
photo5: res.uri
})
} else if (type == '6') {
this.setState({
photo6: res.uri
})
} else if (type == 'rangka') {
this.setState({ this.setState({
data: { data: {
...this.state.data, ...this.state.data,
...@@ -92,13 +133,27 @@ export default class sampleMenuPenerimaan3 extends Component { ...@@ -92,13 +133,27 @@ export default class sampleMenuPenerimaan3 extends Component {
} }
} }
handlePenerimaan() { handlePenerimaan(type) {
api.create().postPenerimaan({ if (this.state.data == "") {
contract_id: this.state.data.contract_id this.props.navigation.navigate('Penerimaan')
}).then((Response) => { } else {
reactotron.log(Response) if (type == 'batal') {
}) api.create().postPenolakan({
this.props.navigation.navigate('Penerimaan') contract_id: this.state.data.contract_id
}).then((Response) => {
reactotron.log(Response)
this.props.navigation.navigate('Penerimaan')
})
} else {
api.create().postPenerimaan({
contract_id: this.state.data.contract_id
}).then((Response) => {
reactotron.log(Response)
this.props.navigation.navigate('Penerimaan')
})
}
}
} }
render() { render() {
...@@ -203,59 +258,146 @@ export default class sampleMenuPenerimaan3 extends Component { ...@@ -203,59 +258,146 @@ export default class sampleMenuPenerimaan3 extends Component {
<Text style={{ fontSize: 13 }}>Foto Unit (6 Foto)</Text> <Text style={{ fontSize: 13 }}>Foto Unit (6 Foto)</Text>
</View> </View>
<View style={styles.viewFotoUnit}> <View style={styles.viewFotoUnit}>
<View style={{ flexDirection: 'row', height: '45%', justifyContent: 'space-between' }}> <View style={{ flexDirection: 'row', height: '40%', justifyContent: 'space-between' }}>
<View <TouchableOpacity style={{ width: '30%', height: '80%', }} onPress={() => this.requestCameraPermission('1')}>
style={{ <View
width: '30%', height: '100%', borderColor: 'rgba(237, 57, 99, .5)', borderStyle: 'dotted', borderWidth: 2, borderRadius: 5 style={{
}} width: '100%', height: '100%', borderColor: 'rgba(237, 57, 99, .5)', borderStyle: 'dotted', borderWidth: 2, borderRadius: 5
> }}
>
</View> {this.state.photo1 == '' ?
<View <View style={{ width: '100%', height: '100%', justifyContent: 'center', alignContent: 'center' }}>
style={{ <Text style={{ color: 'rgba(237, 57, 99, .5)', textAlign: 'center', fontSize: 40 }}>+</Text>
width: '30%', height: '100%', borderColor: 'rgba(237, 57, 99, .5)', borderStyle: 'dotted', borderWidth: 2, borderRadius: 5 </View> :
}} <Image
> style={{ width: '100%', height: '100%', resizeMode: 'stretch' }}
source={{ uri: this.state.photo1 }}
</View> />
<View }
style={{ </View>
width: '30%', height: '100%', borderColor: 'rgba(237, 57, 99, .5)', borderStyle: 'dotted', borderWidth: 2, borderRadius: 5 <Text style={{ fontSize: 10 }}>Bag. Depan</Text>
}} </TouchableOpacity>
> <TouchableOpacity style={{ width: '30%', height: '80%', }} onPress={() => this.requestCameraPermission('2')}>
<View
</View> style={{
width: '100%', height: '100%', borderColor: 'rgba(237, 57, 99, .5)', borderStyle: 'dotted', borderWidth: 2, borderRadius: 5
}}
>
{this.state.photo2 == '' ?
<View style={{ width: '100%', height: '100%', justifyContent: 'center', alignContent: 'center' }}>
<Text style={{ color: 'rgba(237, 57, 99, .5)', textAlign: 'center', fontSize: 40 }}>+</Text>
</View> :
<Image
style={{ width: '100%', height: '100%', resizeMode: 'stretch' }}
source={{ uri: this.state.photo2 }}
/>
}
</View>
<Text style={{ fontSize: 10, flexWrap: 'nowrap' }}>Bag. Belakang</Text>
</TouchableOpacity>
<TouchableOpacity style={{ width: '30%', height: '80%', }} onPress={() => this.requestCameraPermission('3')}>
<View
style={{
width: '100%', height: '100%', borderColor: 'rgba(237, 57, 99, .5)', borderStyle: 'dotted', borderWidth: 2, borderRadius: 5
}}
>
{this.state.photo3 == '' ?
<View style={{ width: '100%', height: '100%', justifyContent: 'center', alignContent: 'center' }}>
<Text style={{ color: 'rgba(237, 57, 99, .5)', textAlign: 'center', fontSize: 40 }}>+</Text>
</View> :
<Image
style={{ width: '100%', height: '100%', resizeMode: 'stretch' }}
source={{ uri: this.state.photo3 }}
/>
}
</View>
<Text style={{ fontSize: 10 }}>Depan Kanan</Text>
</TouchableOpacity>
</View> </View>
<View style={{ flexDirection: 'row', height: '45%', justifyContent: 'space-between' }}> <View style={{ flexDirection: 'row', height: '40%', justifyContent: 'space-between' }}>
<View <TouchableOpacity style={{ width: '30%', height: '80%', }} onPress={() => this.requestCameraPermission('4')}>
style={{ <View
width: '30%', height: '100%', borderColor: 'rgba(237, 57, 99, .5)', borderStyle: 'dotted', borderWidth: 2, borderRadius: 5 style={{
}} width: '100%', height: '100%', borderColor: 'rgba(237, 57, 99, .5)', borderStyle: 'dotted', borderWidth: 2, borderRadius: 5
> }}
>
</View> {this.state.photo4 == '' ?
<View <View style={{ width: '100%', height: '100%', justifyContent: 'center', alignContent: 'center' }}>
style={{ <Text style={{ color: 'rgba(237, 57, 99, .5)', textAlign: 'center', fontSize: 40 }}>+</Text>
width: '30%', height: '100%', borderColor: 'rgba(237, 57, 99, .5)', borderStyle: 'dotted', borderWidth: 2, borderRadius: 5 </View> :
}} <Image
> style={{ width: '100%', height: '100%', resizeMode: 'stretch' }}
source={{ uri: this.state.photo4 }}
</View> />
<View }
style={{ </View>
width: '30%', height: '100%', borderColor: 'rgba(237, 57, 99, .5)', borderStyle: 'dotted', borderWidth: 2, borderRadius: 5 <Text style={{ fontSize: 10 }}>Sisi Kanan</Text>
}} </TouchableOpacity>
> <TouchableOpacity style={{ width: '30%', height: '80%', }} onPress={() => this.requestCameraPermission('5')}>
<View
</View> style={{
width: '100%', height: '100%', borderColor: 'rgba(237, 57, 99, .5)', borderStyle: 'dotted', borderWidth: 2, borderRadius: 5
}}
>
{this.state.photo5 == '' ?
<View style={{ width: '100%', height: '100%', justifyContent: 'center', alignContent: 'center' }}>
<Text style={{ color: 'rgba(237, 57, 99, .5)', textAlign: 'center', fontSize: 40 }}>+</Text>
</View> :
<Image
style={{ width: '100%', height: '100%', resizeMode: 'stretch' }}
source={{ uri: this.state.photo5 }}
/>
}
</View>
<Text style={{ fontSize: 11 }}>Sisi Kiri</Text>
</TouchableOpacity>
<TouchableOpacity style={{ width: '30%', height: '80%', }} onPress={() => this.requestCameraPermission('6')}>
<View
style={{
width: '100%', height: '100%', borderColor: 'rgba(237, 57, 99, .5)', borderStyle: 'dotted', borderWidth: 2, borderRadius: 5
}}
>
{this.state.photo6 == '' ?
<View style={{ width: '100%', height: '100%', justifyContent: 'center', alignContent: 'center' }}>
<Text style={{ color: 'rgba(237, 57, 99, .5)', textAlign: 'center', fontSize: 40 }}>+</Text>
</View> :
<Image
style={{ width: '100%', height: '100%', resizeMode: 'stretch' }}
source={{ uri: this.state.photo6 }}
/>
}
</View>
<Text style={{ fontSize: 10 }}>Belakang Kiri</Text>
</TouchableOpacity>
</View> </View>
</View> </View>
</View> </View>
</ScrollView> </ScrollView>
<View style={{ width: '100%', justifyContent: 'flex-end', marginTop: 20, alignSelf: 'center', alignContent: 'flex-end', alignItems: 'center' }}> <View style={{ width: '100%', justifyContent: 'space-evenly', marginTop: 20, alignSelf: 'center', alignContent: 'flex-end', alignItems: 'center', flexDirection: 'row' }}>
<AwesomeButton
backgroundColor={Colors.yellowBasic}
backgroundShadow={'#DBDBDB'}
backgroundPlaceholder={null}
backgroundDarker={'#FFED75'}
backgroundProgress={null}
width={120}
height={45}
raiseLevel={5}
borderRadius={10}
progressLoadingTime={1000}
progress={!this.state.progress}
onPress={next => {
setTimeout(() => {
this.handlePenerimaan('batal')
next()
}, 300);
}}
>
<Text style={{ color: 'black', fontWeight: '700' }}>Batal</Text>
</AwesomeButton>
<AwesomeButton <AwesomeButton
backgroundColor={Colors.yellowBasic} backgroundColor={Colors.yellowBasic}
backgroundShadow={'#DBDBDB'} backgroundShadow={'#DBDBDB'}
...@@ -287,6 +429,6 @@ const styles = StyleSheet.create({ ...@@ -287,6 +429,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, padding: 5, height: 150, justifyContent: 'space-between' }, viewFotoUnit: { width: '63%', borderColor: 'rgba(237, 57, 99, .5)', borderWidth: .8, borderRadius: 5, padding: 10, 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