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 {
viewerMesin: false,
imageRangka: '',
imageMesin: '',
mesinArray: []
mesinArray: [],
photo1: '',
photo2: '',
photo3: '',
photo4: '',
photo5: '',
photo6: '',
}
}
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))
}
async requestCameraPermission(type) {
......@@ -65,7 +82,31 @@ export default class sampleMenuPenerimaan3 extends Component {
try {
RNFetchBlob.fs.readFile(res.uri, 'base64')
.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({
data: {
...this.state.data,
......@@ -92,13 +133,27 @@ export default class sampleMenuPenerimaan3 extends Component {
}
}
handlePenerimaan() {
api.create().postPenerimaan({
contract_id: this.state.data.contract_id
}).then((Response) => {
reactotron.log(Response)
})
this.props.navigation.navigate('Penerimaan')
handlePenerimaan(type) {
if (this.state.data == "") {
this.props.navigation.navigate('Penerimaan')
} else {
if (type == 'batal') {
api.create().postPenolakan({
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() {
......@@ -203,59 +258,146 @@ export default class sampleMenuPenerimaan3 extends Component {
<Text style={{ fontSize: 13 }}>Foto Unit (6 Foto)</Text>
</View>
<View style={styles.viewFotoUnit}>
<View style={{ flexDirection: 'row', height: '45%', justifyContent: 'space-between' }}>
<View
style={{
width: '30%', height: '100%', borderColor: 'rgba(237, 57, 99, .5)', borderStyle: 'dotted', borderWidth: 2, borderRadius: 5
}}
>
</View>
<View
style={{
width: '30%', height: '100%', borderColor: 'rgba(237, 57, 99, .5)', borderStyle: 'dotted', borderWidth: 2, borderRadius: 5
}}
>
</View>
<View
style={{
width: '30%', height: '100%', borderColor: 'rgba(237, 57, 99, .5)', borderStyle: 'dotted', borderWidth: 2, borderRadius: 5
}}
>
</View>
<View style={{ flexDirection: 'row', height: '40%', justifyContent: 'space-between' }}>
<TouchableOpacity style={{ width: '30%', height: '80%', }} onPress={() => this.requestCameraPermission('1')}>
<View
style={{
width: '100%', height: '100%', borderColor: 'rgba(237, 57, 99, .5)', borderStyle: 'dotted', borderWidth: 2, borderRadius: 5
}}
>
{this.state.photo1 == '' ?
<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.photo1 }}
/>
}
</View>
<Text style={{ fontSize: 10 }}>Bag. Depan</Text>
</TouchableOpacity>
<TouchableOpacity style={{ width: '30%', height: '80%', }} onPress={() => this.requestCameraPermission('2')}>
<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 style={{ flexDirection: 'row', height: '45%', justifyContent: 'space-between' }}>
<View
style={{
width: '30%', height: '100%', borderColor: 'rgba(237, 57, 99, .5)', borderStyle: 'dotted', borderWidth: 2, borderRadius: 5
}}
>
</View>
<View
style={{
width: '30%', height: '100%', borderColor: 'rgba(237, 57, 99, .5)', borderStyle: 'dotted', borderWidth: 2, borderRadius: 5
}}
>
</View>
<View
style={{
width: '30%', height: '100%', borderColor: 'rgba(237, 57, 99, .5)', borderStyle: 'dotted', borderWidth: 2, borderRadius: 5
}}
>
</View>
<View style={{ flexDirection: 'row', height: '40%', justifyContent: 'space-between' }}>
<TouchableOpacity style={{ width: '30%', height: '80%', }} onPress={() => this.requestCameraPermission('4')}>
<View
style={{
width: '100%', height: '100%', borderColor: 'rgba(237, 57, 99, .5)', borderStyle: 'dotted', borderWidth: 2, borderRadius: 5
}}
>
{this.state.photo4 == '' ?
<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.photo4 }}
/>
}
</View>
<Text style={{ fontSize: 10 }}>Sisi Kanan</Text>
</TouchableOpacity>
<TouchableOpacity style={{ width: '30%', height: '80%', }} onPress={() => this.requestCameraPermission('5')}>
<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>
</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
backgroundColor={Colors.yellowBasic}
backgroundShadow={'#DBDBDB'}
......@@ -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 },
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, 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' },
})
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