Commit 692c6cd3 authored by Deni Rinaldi's avatar Deni Rinaldi

tambahan buat demo katanya

parent 3a4d696a
import React, { Component } from 'react' import React, { Component } from 'react'
import { Text, View, TextInput, ScrollView, StyleSheet } from 'react-native' import { Text, View, TextInput, ScrollView, StyleSheet, BackHandler } from 'react-native'
import { Collapse, CollapseHeader, CollapseBody } from "accordion-collapse-react-native"; import { Collapse, CollapseHeader, CollapseBody } from "accordion-collapse-react-native";
import { Thumbnail, List, ListItem, Separator, Container } from 'native-base'; import { Thumbnail, List, ListItem, Separator, Container } from 'native-base';
import { RadioButton } from 'react-native-paper'; import { RadioButton } from 'react-native-paper';
...@@ -39,10 +39,31 @@ export default class sampleMenuAppraisal3 extends Component { ...@@ -39,10 +39,31 @@ export default class sampleMenuAppraisal3 extends Component {
} }
} }
validasi(){ componentDidMount() {
BackHandler.addEventListener('hardwareBackPress', this.handleBackButtonClick);
}
componentWillUnmount() {
BackHandler.removeEventListener('hardwareBackPress', this.handleBackButtonClick);
}
handleBackButtonClick = () => {
this.props.navigation.goBack()
return true;
}
validasi() {
api.create().postAppraisal({ api.create().postAppraisal({
contract_id: this.props.navigation.state.params.contract_id contract_id: this.props.navigation.state.params.contract_id
}).then((response) => { }).then((response) => {
this.props.navigation.navigate('Appraisal')
})
}
draftData() {
api.create().postDraftAppraisal({
contract_id: this.state.data.contract_id
}).then((response) => {
this.props.navigation.navigate('Appraisal') this.props.navigation.navigate('Appraisal')
}) })
} }
...@@ -239,7 +260,7 @@ export default class sampleMenuAppraisal3 extends Component { ...@@ -239,7 +260,7 @@ export default class sampleMenuAppraisal3 extends Component {
</View> </View>
</View> </View>
<View style={{ flexDirection: 'row', justifyContent: 'space-between', paddingVertical: 2.5 }}> <View style={{ flexDirection: 'row', justifyContent: 'space-between', paddingVertical: 2.5 }}>
<View style={{ height: 30, justifyContent: 'center', width: '50%' }}> <View style={{ height: 30, justifyContent: 'center', width: '50%' }}>
<Text style={{ fontSize: 13 }}>Shock Depan</Text> <Text style={{ fontSize: 13 }}>Shock Depan</Text>
</View> </View>
...@@ -645,7 +666,29 @@ export default class sampleMenuAppraisal3 extends Component { ...@@ -645,7 +666,29 @@ export default class sampleMenuAppraisal3 extends Component {
{/* <View style={{ flexDirection: 'row', justifyContent: 'space-between', paddingVertical: 2.5 }}> {/* <View style={{ flexDirection: 'row', justifyContent: 'space-between', paddingVertical: 2.5 }}>
</View> */} </View> */}
<View style={{ width: '100%', justifyContent: 'flex-end', marginTop: 20, alignSelf: 'center', alignContent: 'flex-end', alignItems: 'center', marginBottom: 20 }}> <View style={{ width: '100%', justifyContent: 'space-evenly', marginTop: 20, alignSelf: 'center', alignContent: 'flex-end', alignItems: 'center', marginBottom: 20, 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.draftData()
next()
}, 300);
}}
>
<Text style={{ color: 'black', fontWeight: '700' }}>Draft</Text>
</AwesomeButton>
<AwesomeButton <AwesomeButton
backgroundColor={Colors.yellowBasic} backgroundColor={Colors.yellowBasic}
backgroundShadow={'#DBDBDB'} backgroundShadow={'#DBDBDB'}
...@@ -660,7 +703,7 @@ export default class sampleMenuAppraisal3 extends Component { ...@@ -660,7 +703,7 @@ export default class sampleMenuAppraisal3 extends Component {
progress={!this.state.progress} progress={!this.state.progress}
onPress={next => { onPress={next => {
setTimeout(() => { setTimeout(() => {
this.validasi() this.validasi()
next() next()
}, 300); }, 300);
}} }}
......
...@@ -67,7 +67,7 @@ export default class Penerimaan extends Component { ...@@ -67,7 +67,7 @@ export default class Penerimaan extends Component {
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 })}> <TouchableOpacity style={{ 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>
...@@ -112,7 +112,7 @@ export default class Penerimaan extends Component { ...@@ -112,7 +112,7 @@ export default class Penerimaan extends Component {
containerStyle={{}} containerStyle={{}}
style={{ backgroundColor: '#e4b300' }} style={{ backgroundColor: '#e4b300' }}
position="bottomRight" position="bottomRight"
onPress={() => this.props.navigation.navigate('MenuPenerimaan', { data: "" })} onPress={() => this.props.navigation.navigate('MenuPenerimaan', { data: ""})}
> >
<Icon name="add" /> <Icon name="add" />
</Fab> </Fab>
......
import React, { Component } from 'react' import React, { Component } from 'react'
import { Text, View, TextInput, ScrollView, StyleSheet } from 'react-native' import { Text, View, TextInput, ScrollView, StyleSheet, BackHandler } from 'react-native'
import { Container } from 'native-base' import { Container } from 'native-base'
import { RadioButton } from 'react-native-paper'; import { RadioButton } from 'react-native-paper';
import StepIndicator from 'react-native-step-indicator'; import StepIndicator from 'react-native-step-indicator';
...@@ -25,7 +25,16 @@ export default class sampleMenuPenerimaan2 extends Component { ...@@ -25,7 +25,16 @@ export default class sampleMenuPenerimaan2 extends Component {
} }
componentDidMount(){ componentDidMount(){
// alert(JSON.stringify(this.state.data)) BackHandler.addEventListener('hardwareBackPress', this.handleBackButtonClick);
}
componentWillUnmount() {
BackHandler.removeEventListener('hardwareBackPress', this.handleBackButtonClick);
}
handleBackButtonClick = () => {
this.props.navigation.goBack()
return true;
} }
render() { render() {
......
import React, { Component } from 'react' import React, { Component } from 'react'
import { Text, View, TextInput, ScrollView, StyleSheet, TouchableOpacity, PermissionsAndroid, Image, Modal } from 'react-native' import { Text, View, TextInput, ScrollView, StyleSheet, TouchableOpacity, PermissionsAndroid, Image, Modal, BackHandler } from 'react-native'
import ImagePicker from 'react-native-image-picker'; import ImagePicker from 'react-native-image-picker';
import { Container } from 'native-base' import { Container } from 'native-base'
import { RadioButton } from 'react-native-paper'; import { RadioButton } from 'react-native-paper';
...@@ -45,8 +45,17 @@ export default class sampleMenuPenerimaan3 extends Component { ...@@ -45,8 +45,17 @@ export default class sampleMenuPenerimaan3 extends Component {
photo6: this.props.navigation.state.params.data.photo_unit[5] photo6: this.props.navigation.state.params.data.photo_unit[5]
}) })
} }
// alert(JSON.stringify(this.state.data)) // alert(JSON.stringify(this.state.data)) componentDidMount(){
BackHandler.addEventListener('hardwareBackPress', this.handleBackButtonClick);
}
componentWillUnmount() {
BackHandler.removeEventListener('hardwareBackPress', this.handleBackButtonClick);
}
handleBackButtonClick = () => {
this.props.navigation.goBack()
return true;
} }
async requestCameraPermission(type) { async requestCameraPermission(type) {
...@@ -119,8 +128,11 @@ export default class sampleMenuPenerimaan3 extends Component { ...@@ -119,8 +128,11 @@ export default class sampleMenuPenerimaan3 extends Component {
uri: res.uri uri: res.uri
}) })
this.setState({ this.setState({
imageMesin: res.uri, mesinArray data: {
}, () => alert(this.state.mesinArray)) ...this.state.data,
engine_number_photo: res.uri
}
})
} }
}) })
...@@ -169,12 +181,7 @@ export default class sampleMenuPenerimaan3 extends Component { ...@@ -169,12 +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}
// enableSwipeDown={true}
// index={this.state.Index}
// onSwipeDown={() => this.props.navigation.goBack()}
// onChange={(item) => this.next(item)}
// renderIndicator={() => (<View />)}
/> />
</View> </View>
</Modal> </Modal>
...@@ -234,7 +241,7 @@ export default class sampleMenuPenerimaan3 extends Component { ...@@ -234,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.state.imageMesin != '' ? this.setState({ viewerMesin: true }) : this.requestCameraPermission('mesin') }}> <TouchableOpacity style={styles.viewRangka} onPress={() => { this.requestCameraPermission('mesin') }}>
<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
...@@ -370,8 +377,7 @@ export default class sampleMenuPenerimaan3 extends Component { ...@@ -370,8 +377,7 @@ 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>
...@@ -456,6 +462,6 @@ const styles = StyleSheet.create({ ...@@ -456,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, padding: 10, 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' },
}) })
...@@ -57,6 +57,8 @@ const create = () => { ...@@ -57,6 +57,8 @@ const create = () => {
const postRejectApproval = (value) => POST('demo/rejecting_approval', value) const postRejectApproval = (value) => POST('demo/rejecting_approval', value)
const postApprovalDetail = (value) => POST('demo/approval_detail', value) const postApprovalDetail = (value) => POST('demo/approval_detail', value)
const getHistory = () => GET('demo/get_history') const getHistory = () => GET('demo/get_history')
const getBranch = () => GET('demo/get_branch')
const getListClarByBranch = (value) => POST('demo/get_clar_by_branch_code', value)
return { return {
...@@ -74,7 +76,9 @@ const create = () => { ...@@ -74,7 +76,9 @@ const create = () => {
postPenolakan, postPenolakan,
postDraftAppraisal, postDraftAppraisal,
postRejectApproval, postRejectApproval,
postApprovalDetail postApprovalDetail,
getBranch,
getListClarByBranch
} }
} }
......
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