Commit 43abb0b1 authored by didam's avatar didam
parents 47ade379 9c57ac87
......@@ -5,6 +5,7 @@ import M from 'moment'
import SvgAnimatedLinearGradient from 'react-native-svg-animated-linear-gradient'
import Svg, { Circle, Rect } from 'react-native-svg'
import Colors from '../../library/colors';
import MaterialIcons from 'react-native-vector-icons/MaterialIcons'
const dateNow = M().format('DD-MM-YYYY')
......@@ -13,24 +14,27 @@ class History extends Component {
super(props)
this.state = {
data: [
{ jam: '17.30', tanggal: M().format('DD-MM-YYYY') },
{ jam: '17.30', tanggal: '06-03-2020' },
{ jam: '17.30', tanggal: '05-03-2020' },
{ jam: '17.30', tanggal: '05-03-2020' },
{ jam: '17.30', tanggal: '05-03-2020' },
{ jam: '17.30', tanggal: '05-03-2020' },
{ jam: '17.30', tanggal: '04-03-2020' },
{ jam: '17.30', tanggal: '04-03-2020' },
{ jam: '17.30', tanggal: '04-03-2020' },
{ jam: '17.30', tanggal: '04-03-2020' },
{ jam: '17.30', tanggal: '04-03-2020' },
{ jam: '17.30', tanggal: '03-03-2020' },
{ jam: '17.30', tanggal: '03-03-2020' },
{ jam: '17.30', tanggal: M().format('DD-MM-YYYY'), noKontrak: 'K-01239912' },
{ jam: '17.30', tanggal: '06-03-2020', noKontrak: 'K-01239913' },
{ jam: '17.30', tanggal: '05-03-2020', noKontrak: 'K-01239914' },
{ jam: '17.30', tanggal: '05-03-2020', noKontrak: 'K-01239915' },
{ jam: '17.30', tanggal: '05-03-2020', noKontrak: 'K-01239916' },
{ jam: '17.30', tanggal: '05-03-2020', noKontrak: 'K-01239917' },
{ jam: '17.30', tanggal: '04-03-2020', noKontrak: 'K-01239918' },
{ jam: '17.30', tanggal: '04-03-2020', noKontrak: 'K-01239919' },
{ jam: '17.30', tanggal: '04-03-2020', noKontrak: 'K-01239920' },
{ jam: '17.30', tanggal: '04-03-2020', noKontrak: 'K-01239921' },
{ jam: '17.30', tanggal: '04-03-2020', noKontrak: 'K-01239922' },
{ jam: '17.30', tanggal: '03-03-2020', noKontrak: 'K-01239923' },
{ jam: '17.30', tanggal: '03-03-2020', noKontrak: 'K-01239924' },
],
date: new Date(),
yesterday: '',
loading: true,
dataLoad: false
dataLoad: false,
OrientationStatus : '',
Height_Layout : '',
Width_Layout : '',
}
}
......@@ -43,10 +47,28 @@ class History extends Component {
}, 2000);
}
DetectOrientation() {
if (this.state.Width_Layout > this.state.Height_Layout) {
this.setState({
OrientationStatus: 'Landscape'
});
}
else {
this.setState({
OrientationStatus: 'Portrait'
});
}
}
render() {
return (
<Container>
<View style={{ height: '10%', width: '100%', backgroundColor: '#e4b300', zIndex: 1 }}>
<Container
onLayout={(event) => this.setState({
Width_Layout: event.nativeEvent.layout.width,
Height_Layout: event.nativeEvent.layout.height
}, () => this.DetectOrientation())}>
<View style={this.state.OrientationStatus == 'Landscape'? { width: '100%', backgroundColor: '#e4b300', zIndex: 1, height: 80 } : { width: '100%', backgroundColor: '#e4b300', zIndex: 1, height: '10%'}}>
<View style={{ alignItems: 'center', justifyContent: 'center', marginTop: 20 }}>
<Text style={{ fontWeight: 'bold', fontSize: 20, fontStyle: 'italic' }}>My History</Text>
</View>
......@@ -57,13 +79,20 @@ class History extends Component {
<View style={{ backgroundColor: '#f5f5f5', paddingHorizontal: 20, zIndex: 3, height: '90%' }}>
<ScrollView style={{ flex: 1 }} showsVerticalScrollIndicator={false}>
<ScrollView style={this.state.OrientationStatus == 'Landscape'? { flex: 1, marginBottom: 40 } : {flex: 1}} showsVerticalScrollIndicator={false}>
{this.state.data.map((item, index) => {
return (
<View>
{this.state.dataLoad && (
<View style={{ marginTop: index == 0 ? 40 : 20, marginBottom: index == this.state.data.length - 1 ? 20 : 0, height: 120 }}>
<View style={{ width: '100%', height: 100, backgroundColor: '#fff', borderRadius: 10 }}>
<View style={{ width: '100%', height: 100, backgroundColor: '#fff', borderRadius: 10, padding: 10, flexDirection: 'row' }}>
<View style={{ width: '70%' }}>
<Text style={{ fontWeight: '700', fontSize: 16 }}>{item.noKontrak}</Text>
</View>
<View style={{ width: '30%', justifyContent: 'flex-end', alignSelf: 'center', flexDirection: 'row' }}>
<Text style={{ color: '#e4b300' }}>Detail</Text>
<MaterialIcons name="navigate-next" size={20} color={'#e4b300'} />
</View>
</View>
<Text style={{ textAlign: 'right', fontStyle: 'italic', fontSize: 12, marginTop: 5, color: '#cccccc' }}>{item.tanggal == String(dateNow) ? item.jam : item.tanggal == this.state.yesterday ? 'yesterday' : item.tanggal} </Text>
</View>
......@@ -74,11 +103,11 @@ class History extends Component {
borderRadius={200}
marginTop={10}
width={'100%'}
duration={800}
>
<Rect x="0" y="30" rx="5" ry="1" width="1000" height="100" />
</SvgAnimatedLinearGradient>
)
}
)}
</View>
)
})}
......
......@@ -9,8 +9,8 @@ export default class Appraisal extends Component {
super(props)
this.state = {
arrayDummy: [
{ noKontrak: 'K-2001920', namaWerehouse: 'Branch-2', petugas: 'Dadang', tglTerima: '03-03-2020', status: 'Draft' },
{ noKontrak: 'K-2001921', namaWerehouse: 'Branch-1', petugas: 'Dudung', tglTerima: '03-03-2020', status: 'Need Approval' },
{ noKontrak: 'K-2001920', namaWerehouse: 'Branch-2', petugas: 'Dadang Tukimin', tglTerima: '03-03-2020', status: 'Draft', brand: 'Honda', type: 'Revo', noPol: 'B 4203 PWK' },
{ noKontrak: 'K-2001921', namaWerehouse: 'Branch-1', petugas: 'Dudung Tukimin', tglTerima: '03-03-2020', status: 'Need Approval', brand: 'Honda', type: 'Beat', noPol: 'B 4203 STW' },
]
}
}
......@@ -21,7 +21,30 @@ export default class Appraisal extends Component {
{this.state.arrayDummy.map((item, index) => {
return (
<View key={index} style={{ paddingHorizontal: 7 }}>
<TouchableOpacity style={{ width: '100%', backgroundColor: '#FFFFFF', borderRadius: 15, paddingHorizontal: 10, shadowRadius: 80, paddingVertical: 10, marginTop: 10 }} onPress={() => this.props.navigation.navigate('MenuAppraisal')}>
<TouchableOpacity style={{ marginTop: 10, borderRadius: 20 }} onPress={() => this.props.navigation.navigate('MenuAppraisal')}>
<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.noKontrak}</Text>
<Text style={{ color: 'white', fontSize: 14 }}>{item.petugas}</Text>
</View>
<View style={{ justifyContent: 'center' }}>
<Text style={{ color: 'white', fontSize: 14, textAlign: 'center' }}>{item.namaWerehouse}</Text>
</View>
</View>
<View style={{ height: 60, backgroundColor: '#E6E6E6', justifyContent: 'space-between', paddingHorizontal: 20, flexDirection: 'row', borderBottomRightRadius: 10, borderBottomLeftRadius: 10 }}>
<View style={{ justifyContent: 'center' }}>
<Text style={{ color: 'black', fontSize: 14 }}>{item.brand} - {item.type}</Text>
<Text style={{ color: 'black', fontSize: 14 }}>{item.noPol}</Text>
</View>
<View style={{ justifyContent: 'center' }}>
<Text style={{ color: 'black', fontSize: 14, textAlign: 'center' }}>{item.status}</Text>
</View>
</View>
{/* <View style={{ backgroundColor: '#E6E6E6', borderBottomRightRadius: 10, borderBottomLeftRadius: 10, justifyContent: 'center', paddingHorizontal: 20, paddingVertical: 10, borderTopWidth: .7, borderTopColor: 'black' }}>
</View> */}
</TouchableOpacity>
{/* <TouchableOpacity style={{ width: '100%', backgroundColor: '#FFFFFF', borderRadius: 15, paddingHorizontal: 10, shadowRadius: 80, paddingVertical: 10, marginTop: 10 }} onPress={() => this.props.navigation.navigate('MenuAppraisal')}>
<View style={{ width: 120, height: 20, backgroundColor: 'black', marginLeft: -20, marginTop: 5, borderTopRightRadius: 5, borderBottomRightRadius: 5 }}>
<Text style={{ color: 'white', textAlign: 'center' }}>{item.status}</Text>
</View>
......@@ -40,25 +63,21 @@ export default class Appraisal extends Component {
borderLeftColor: 'transparent',
}} />
<View style={{ flexDirection: 'row' }}>
<View style={{ width: '80%' }}>
{/* <View style={{ flexDirection: 'row', width: '100%', backgroundColor: 'red' }}> */}
<View style={{ width: '80%' }}>
<View style={{ flexDirection: 'row', justifyContent: 'space-between' }}>
<Text style={{ alignSelf: 'center', fontSize: 16, fontWeight: 'bold' }}>{item.noKontrak}</Text>
<Text style={{ alignSelf: 'center', fontSize: 14 }}>{item.namaWerehouse}</Text>
</View>
{/* </View> */}
{/* <View style={{ flexDirection: 'row', justifyContent: 'space-between' }}> */}
</View>
<View style={{ flexDirection: 'row', justifyContent: 'space-between' }}>
<Text style={{ alignSelf: 'center', fontSize: 14 }}>{item.tglTerima}</Text>
<Text style={{ alignSelf: 'center', fontSize: 14 }}>{item.petugas}</Text>
</View>
{/* </View> */}
</View>
</View>
<View style={{ justifyContent: 'center', width: '20%', alignItems: 'flex-end' }}>
<Next name="navigate-next" size={26} />
</View>
</View>
</TouchableOpacity>
</TouchableOpacity> */}
</View>
)
})}
......
......@@ -808,19 +808,6 @@ export default class sampleMenuAppraisal extends Component {
/>
</View>
</View>
<View style={{ flexDirection: 'row', justifyContent: 'space-between', paddingVertical: 2.5 }}>
<View style={{ justifyContent: 'center', width: '45%' }}>
<Text style={{ fontSize: 13 }}>Nilai Pembanding Rekondisi</Text>
</View>
<View style={styles.viewInputEnable}>
<TextInput
onChangeText={(e) => this.setState({ namaRemote: e })}
style={styles.textInput}
value={this.state.namaRemote}
editable
/>
</View>
</View>
<View style={{ flexDirection: 'row', justifyContent: 'space-between', paddingVertical: 2.5 }}>
<View style={{ justifyContent: 'center', width: '45%' }}>
<Text style={{ fontSize: 13 }}>Pokok Pembiayaan</Text>
......
......@@ -2,7 +2,7 @@ import React, { Component } from 'react';
import { Container, Text, View } from 'native-base';
import LinearGradient from 'react-native-linear-gradient';
import Colors from '../../library/colors';
import { TouchableOpacity, ImageBackground, Image, ScrollView, StyleSheet, Dimensions} from 'react-native';
import { TouchableOpacity, ImageBackground, Image, ScrollView, StyleSheet, Dimensions } from 'react-native';
import FontAwesome5Icon from 'react-native-vector-icons/FontAwesome5';
import {
Menu,
......@@ -11,7 +11,9 @@ import {
MenuTrigger,
renderers
} from 'react-native-popup-menu';
import { Dropdown } from 'react-native-material-dropdown';
import Images from '../../library/images';
import api from '../../service/api';
class HomePageScreen extends Component {
constructor(props) {
......@@ -29,25 +31,51 @@ class HomePageScreen extends Component {
name: 'Merapi Datang Kembali',
image: Images.news3
},
]
],
arrayWarehouse: [],
selectedWarehouse: ''
}
}
handleNav(item) {
if (item == 'Penerimaan') {
this.props.navigation.navigate('Penerimaan')
} else if ( item == 'Appraisal') {
if (this.state.selectedWarehouse != "") {
this.props.navigation.navigate('Penerimaan', { data: this.state.selectedWarehouse })
} else {
alert('Select Warehouse First!')
}
} else if (item == 'Appraisal') {
this.props.navigation.navigate('Appraisal')
} else {
this.props.navigation.navigate('MenuPenerimaan')
}
}
componentDidMount() {
this.getWarehouse()
}
getWarehouse(){
api.create().getWarehouse().then((response) => {
// alert(JSON.stringify(response.data))
if (response.data.status == "success") {
let arrayWarehouse = []
response.data.data.map((item, index) => {
arrayWarehouse.push({
value: item.warehouse_id,
label: item.warehouse_name
})
})
this.setState({ arrayWarehouse })
}
})
}
render() {
const height = Dimensions.get('window').height
const width = Dimensions.get('window').width
const height = Dimensions.get('window').height
const width = Dimensions.get('window').width
return (
<Container style={{backgroundColor:'#f8f8f8'}}>
<Container style={{ backgroundColor: '#f8f8f8' }}>
{/* <LinearGradient style={{borderBottomLeftRadius: 25, height: 150, width: '100%', justifyContent:'flex-end', padding: 20}} colors={[Colors.blackBasic, Colors.yellowBasic]} start={{x: 0, y: .5}} end={{x: 0, y: .4}}>
<View style={{flexDirection:'row', justifyContent: 'space-between',}}>
<Text style={{color:'#fff'}}> Dadang Kuspriadi </Text>
......@@ -71,12 +99,24 @@ class HomePageScreen extends Component {
</LinearGradient> */}
<ScrollView style={{flex: 1}}>
<ImageBackground source={Images.background2} style={{width: '100%', height: 200, justifyContent:'center'}}>
<View style={{alignItems: 'center', justifyContent: 'center', marginTop: 100}}>
<Text style={{color:'#fff', fontSize: 20}}> DADANG TUKIMIN</Text>
<View style={{ alignItems: 'center', justifyContent: 'center', marginTop: 100 }}>
<Text style={{ color: '#fff', fontSize: 20 }}> DADANG TUKIMIN</Text>
</View>
<View style={{alignItems:'flex-end', justifyContent:'flex-end', marginTop: 20, paddingHorizontal: 20, flexDirection:'row'}}>
<Text style={{color:'#fff', fontSize: 14}}> Warehouse</Text>
<FontAwesome5Icon name={'angle-down'} color={'#fff'} size={20} style={{marginLeft: 10, marginBottom: -1}}/>
<View style={{ alignItems: 'flex-end', justifyContent: 'flex-end', marginTop: 20, paddingHorizontal: 20, flexDirection: 'row' }}>
<Dropdown
label='-- Warehouse --'
labelFontSize={12}
itemColor={'#e6e6e6'}
textColor={'#fff'}
baseColor={'#fff'}
selectedItemColor={'#black'}
containerStyle={{ width: '45%' }}
data={this.state.arrayWarehouse}
onChangeText={(e) => this.setState({ selectedWarehouse: e })}
value={this.state.selectedWarehouse}
/>
{/* <Text style={{color:'#fff', fontSize: 14}}> Warehouse</Text>
<FontAwesome5Icon name={'angle-down'} color={'#fff'} size={20} style={{marginLeft: 10, marginBottom: -1}}/> */}
</View>
</ImageBackground>
<View style={{padding: 10, paddingVertical: 20, flexDirection: 'row', width:'100%'}}>
......
import React, { Component } from 'react'
import { Text, View, ScrollView, TouchableOpacity } from 'react-native'
import { Container, Fab, Icon } from 'native-base'
import Next from 'react-native-vector-icons/MaterialIcons'
import SvgAnimatedLinearGradient from 'react-native-svg-animated-linear-gradient'
import Svg, { Circle, Rect } from 'react-native-svg'
import api from '../../../service/api'
export default class Penerimaan extends Component {
......@@ -11,55 +13,76 @@ export default class Penerimaan extends Component {
arrayDummy: [
{ noKontrak: 'K-2001920', namaWerehouse: 'Branch-1', petugas: 'Dadang', tglTerima: '03-03-2020' },
{ noKontrak: 'K-2001921', namaWerehouse: 'Branch-2', petugas: 'Dudung', tglTerima: '03-03-2020' },
]
],
loading: true,
listClar: []
}
}
componentDidMount() {
this.getListData()
// alert(JSON.stringify(this.props))
}
getListData() {
api.create().getListClar({
warehouse_id: Number(this.props.navigation.state.params.data)
}).then((response) => {
let listClar = []
response.data.data.map((item, index) => {
listClar.push(item)
})
this.setState({ listClar }, () => {
setTimeout(() => {
this.setState({ loading: false })
}, 500);
})
})
}
render() {
return (
<Container style={{ flex: 1 }}>
<ScrollView style={{ paddingHorizontal: 20, backgroundColor: '#F5F5F5', paddingTop: 10 }} showsVerticalScrollIndicator={false} >
{this.state.arrayDummy.map((item, index) => {
{this.state.listClar.map((item, index) => {
return (
<View key={index} style={{ paddingHorizontal: 7 }}>
<TouchableOpacity style={{ width: '100%', backgroundColor: '#FFFFFF', borderRadius: 15, paddingHorizontal: 10, shadowRadius: 80, paddingVertical: 10, marginTop: 10 }} onPress={() => this.props.navigation.navigate('MenuPenerimaan')}>
<View style={{ width: 80, height: 20, backgroundColor: 'black', marginLeft: -20, marginTop: 5, borderTopRightRadius: 5, borderBottomRightRadius: 5 }}>
<Text style={{ color: 'white', textAlign: 'center' }}>{item.namaWerehouse}</Text>
</View>
<View style={{
backgroundColor: '#E6E6E6', height: 10, width: 10,
marginLeft: -20,
backgroundColor: 'transparent',
borderStyle: 'solid',
borderTopWidth: 8,
borderRightWidth: 0,
borderBottomWidth: 0,
borderLeftWidth: 10,
borderTopColor: 'black',
borderRightColor: 'transparent',
borderBottomColor: 'transparent',
borderLeftColor: 'transparent',
}} />
<View style={{ flexDirection: 'row' }}>
<View style={{ width: '80%' }}>
{/* <View style={{ flexDirection: 'row', width: '100%', backgroundColor: 'red' }}> */}
<View style={{ flexDirection: 'row', justifyContent: 'space-between' }}>
<Text style={{ alignSelf: 'center', fontSize: 16, fontWeight: 'bold' }}>{item.noKontrak}</Text>
{/* <Text style={{ alignSelf: 'center', fontSize: 14 }}>{item.namaWerehouse}</Text> */}
{!this.state.loading && (
<TouchableOpacity style={{ marginTop: 10, borderRadius: 20 }} onPress={() => this.props.navigation.navigate('MenuPenerimaan', { 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>
<Text style={{ color: 'white', fontSize: 14 }}>{item.nasabah_name}</Text>
</View>
{/* </View> */}
{/* <View style={{ flexDirection: 'row', justifyContent: 'space-between' }}> */}
<View style={{ flexDirection: 'row', justifyContent: 'space-between' }}>
<Text style={{ alignSelf: 'center', fontSize: 14 }}>{item.tglTerima}</Text>
<Text style={{ alignSelf: 'center', fontSize: 14 }}>{item.petugas}</Text>
<View style={{ justifyContent: 'center' }}>
<Text style={{ color: 'white', fontSize: 14, textAlign: 'center' }}>{item.warehouse_code}</Text>
</View>
{/* </View> */}
</View>
<View style={{ justifyContent: 'center', width: '20%', alignItems: 'flex-end' }}>
<Next name="navigate-next" size={26} />
<View style={{ height: 60, backgroundColor: '#E6E6E6', justifyContent: 'space-between', paddingHorizontal: 20, flexDirection: 'row', borderBottomRightRadius: 10, borderBottomLeftRadius: 10 }}>
<View style={{ justifyContent: 'center' }}>
<Text style={{ color: 'black', fontSize: 14 }}>{item.brand} - {item.model}</Text>
<Text style={{ color: 'black', fontSize: 14 }}>{item.police_number}</Text>
</View>
<View style={{ justifyContent: 'center' }}>
<Text style={{ color: 'black', fontSize: 14, textAlign: 'center' }}>{item.collector}</Text>
</View>
</View>
</View>
</TouchableOpacity>
</TouchableOpacity>
)}
{this.state.loading && (
<SvgAnimatedLinearGradient
height={140}
borderRadius={200}
marginTop={-10}
width={'100%'}
duration={800}
primaryColor="#fff3c9"
secondaryColor="#e4b300"
>
<Rect x="0" y="30" rx="5" ry="1" width="1000" height="120" />
</SvgAnimatedLinearGradient>
)}
</View>
)
})}
......@@ -71,8 +94,8 @@ export default class Penerimaan extends Component {
containerStyle={{}}
style={{ backgroundColor: '#e4b300' }}
position="bottomRight"
onPress={() => this.props.navigation.navigate('MenuPenerimaan')}
>
onPress={() => this.props.navigation.navigate('MenuPenerimaan', { data: "" })}
>
<Icon name="add" />
</Fab>
</Container>
......
......@@ -13,12 +13,13 @@ export default class sampleMenuPenerimaan extends Component {
constructor(props) {
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'),
checked: 'first',
progress: false,
kodeWerehouse: '#daridepan',
namaWerehouse: '#daridepan',
warehouse_name: '',
kodeRemote: '',
namaRemote: '',
tanggalPenerimaan: '',
......@@ -29,7 +30,7 @@ export default class sampleMenuPenerimaan extends Component {
}
componentDidMount() {
// alert(this.state.date)
// alert(JSON.stringify(this.props))
}
handlePenerimaanDate(date) {
......@@ -43,6 +44,7 @@ export default class sampleMenuPenerimaan extends Component {
}
render() {
let { data } = this.state
return (
<Container style={{ flex: 1, paddingHorizontal: 20, paddingBottom: 20 }}>
<ScrollView
......@@ -82,11 +84,11 @@ export default class sampleMenuPenerimaan extends Component {
<View style={{ height: 30, justifyContent: 'center' }}>
<Text style={{ fontSize: 13 }}>Kode Cabang</Text>
</View>
<View style={styles.viewInputDisable}>
<View style={this.state.data == "" ? styles.viewInputEnable : styles.viewInputDisable}>
<TextInput
style={styles.textInput}
value={'#dropdown'}
editable={false}
value={this.state.data == "" ? null : String(data.branch_id)}
editable={this.state.data == "" ? true : false}
/>
</View>
</View>
......@@ -95,11 +97,11 @@ export default class sampleMenuPenerimaan extends Component {
<View style={{ height: 30, justifyContent: 'center' }}>
<Text style={{ fontSize: 13 }}>Nama Cabang</Text>
</View>
<View style={styles.viewInputDisable}>
<View style={this.state.data == "" ? styles.viewInputEnable : styles.viewInputDisable}>
<TextInput
style={styles.textInput}
value={'#autofill'}
editable={false}
value={this.state.data == "" ? null : String(data.warehouse_code)}
editable={this.state.data == "" ? true : false}
/>
</View>
</View>
......@@ -108,11 +110,11 @@ export default class sampleMenuPenerimaan extends Component {
<View style={{ height: 30, justifyContent: 'center' }}>
<Text style={{ fontSize: 13 }}>No Kontrak Payung</Text>
</View>
<View style={styles.viewInputDisable}>
<View style={this.state.data == "" ? styles.viewInputEnable : styles.viewInputDisable}>
<TextInput
style={styles.textInput}
value={'#livesearch'}
editable={false}
value={this.state.data == "" ? null : String(data.contract_number)}
editable={this.state.data == "" ? true : false}
/>
</View>
</View>
......@@ -124,8 +126,8 @@ export default class sampleMenuPenerimaan extends Component {
<View style={styles.viewInputDisable}>
<TextInput
style={styles.textInput}
value={'#autofill'}
editable={false}
value={this.state.data == "" ? null : String(data.sub_contract_number)}
editable={this.state.data == "" ? true : false}
/>
</View>
</View>
......@@ -137,8 +139,8 @@ export default class sampleMenuPenerimaan extends Component {
<View style={styles.viewInputDisable}>
<TextInput
style={styles.textInput}
value={'#autofill'}
editable={false}
value={this.state.data == "" ? null : String(data.nasabah_name)}
editable={this.state.data == "" ? true : false}
/>
</View>
</View>
......@@ -149,10 +151,10 @@ export default class sampleMenuPenerimaan extends Component {
</View>
<View style={styles.viewInputEnable}>
<TextInput
onChangeText={(e) => this.setState({ kodeWerehouse: e })}
onChangeText={(e) => this.setState({ warehouse_name: e })}
style={styles.textInput}
value={this.state.kodeWerehouse}
editable
value={this.state.data == "" ? null : String(data.warehouse_name)}
editable={this.state.data == "" ? true : false}
/>
</View>
</View>
......@@ -165,7 +167,7 @@ export default class sampleMenuPenerimaan extends Component {
<TextInput
onChangeText={(e) => this.setState({ namaWerehouse: e })}
style={styles.textInput}
value={this.state.namaWerehouse}
value={data.warehouse_code}
editable
/>
</View>
......@@ -179,7 +181,7 @@ export default class sampleMenuPenerimaan extends Component {
<TextInput
onChangeText={(e) => this.setState({ kodeRemote: e })}
style={styles.textInput}
value={this.state.kodeRemote}
value={data.remote_code}
editable
/>
</View>
......@@ -193,7 +195,7 @@ export default class sampleMenuPenerimaan extends Component {
<TextInput
onChangeText={(e) => this.setState({ namaRemote: e })}
style={styles.textInput}
value={this.state.namaRemote}
value={data.remote_name}
editable
/>
</View>
......@@ -216,7 +218,7 @@ export default class sampleMenuPenerimaan extends Component {
/>
<TextInput
style={styles.textInput}
value={this.state.datePenerimaan}
value={data.date_in}
editable={false}
/>
</TouchableOpacity>
......@@ -263,7 +265,7 @@ export default class sampleMenuPenerimaan extends Component {
progress={!this.state.progress}
onPress={next => {
setTimeout(() => {
this.props.navigation.navigate('MenuPenerimaan2')
this.props.navigation.navigate('MenuPenerimaan2', { data: this.state.data })
next()
}, 300);
}}
......
......@@ -11,6 +11,7 @@ export default class sampleMenuPenerimaan2 extends Component {
constructor(props) {
super(props)
this.state = {
data: this.props.navigation.state.params.data || "",
date: new Date(),
checked: 'first',
object: null,
......@@ -22,7 +23,13 @@ export default class sampleMenuPenerimaan2 extends Component {
kunci: null
}
}
componentDidMount(){
// alert(JSON.stringify(this.state.data))
}
render() {
let { data } = this.state
return (
<Container style={{ flex: 1, paddingHorizontal: 10, paddingBottom: 20 }}>
<ScrollView showsVerticalScrollIndicator={false}>
......@@ -97,7 +104,7 @@ export default class sampleMenuPenerimaan2 extends Component {
<View style={{ borderColor: 'rgba(237, 57, 99, .5)', borderWidth: .8, justifyContent: 'center', borderRadius: 5, width: '60%' }}>
<TextInput
style={{ paddingHorizontal: 10, paddingVertical: 0, color: '#999999' }}
value={'Test'}
value={this.state.data == "" ? "" : `${data.brand} - ${data.model}`}
/>
</View>
<View style={{ width: '40%', flexDirection: 'row', justifyContent: 'space-between', paddingHorizontal: 5 }}>
......@@ -128,7 +135,7 @@ export default class sampleMenuPenerimaan2 extends Component {
<View style={{ borderColor: 'rgba(237, 57, 99, .5)', borderWidth: .8, justifyContent: 'center', borderRadius: 5, width: '60%' }}>
<TextInput
style={{ paddingHorizontal: 10, paddingVertical: 0, color: '#999999' }}
value={'Test'}
value={data.chassis_number}
/>
</View>
<View style={{ width: '40%', flexDirection: 'row', justifyContent: 'space-between', paddingHorizontal: 5 }}>
......@@ -159,7 +166,7 @@ export default class sampleMenuPenerimaan2 extends Component {
<View style={{ borderColor: 'rgba(237, 57, 99, .5)', borderWidth: .8, justifyContent: 'center', borderRadius: 5, width: '60%' }}>
<TextInput
style={{ paddingHorizontal: 10, paddingVertical: 0, color: '#999999' }}
value={'Test'}
value={data.police_number}
/>
</View>
<View style={{ width: '40%', flexDirection: 'row', justifyContent: 'space-between', paddingHorizontal: 5 }}>
......@@ -190,7 +197,7 @@ export default class sampleMenuPenerimaan2 extends Component {
<View style={{ borderColor: 'rgba(237, 57, 99, .5)', borderWidth: .8, justifyContent: 'center', borderRadius: 5, width: '60%' }}>
<TextInput
style={{ paddingHorizontal: 10, paddingVertical: 0, color: '#999999' }}
value={'Test'}
value={data.engine_number}
/>
</View>
<View style={{ width: '40%', flexDirection: 'row', justifyContent: 'space-between', paddingHorizontal: 5 }}>
......@@ -231,16 +238,16 @@ export default class sampleMenuPenerimaan2 extends Component {
<View style={{ width: '40%', flexDirection: 'row', justifyContent: 'space-between', paddingHorizontal: 5 }}>
<View>
<RadioButton
value="true"
status={this.state.stnk === 'true' ? 'checked' : 'unchecked'}
onPress={() => { this.setState({ stnk: 'true' }); }}
value={data.stnk_recondition}
status={data.stnk_recondition === true ? 'checked' : 'unchecked'}
onPress={() => { this.setState({ stnk: true }); }}
/>
</View>
<View>
<RadioButton
value="false"
status={this.state.stnk === 'false' ? 'checked' : 'unchecked'}
onPress={() => { this.setState({ stnk: 'false' }); }}
value={data.stnk_recondition}
status={data.stnk_recondition === false ? 'checked' : 'unchecked'}
onPress={() => { this.setState({ stnk: false }); }}
/>
</View>
</View>
......@@ -262,15 +269,15 @@ export default class sampleMenuPenerimaan2 extends Component {
<View style={{ width: '40%', flexDirection: 'row', justifyContent: 'space-between', paddingHorizontal: 5 }}>
<View>
<RadioButton
value="true"
status={this.state.kunci === 'true' ? 'checked' : 'unchecked'}
value={data.unit_key}
status={data.unit_key === true ? 'checked' : 'unchecked'}
onPress={() => { this.setState({ kunci: 'true' }); }}
/>
</View>
<View>
<RadioButton
value="false"
status={this.state.kunci === 'false' ? 'checked' : 'unchecked'}
value={data.unit_key}
status={data.unit_key === false ? 'checked' : 'unchecked'}
onPress={() => { this.setState({ kunci: 'false' }); }}
/>
</View>
......@@ -296,7 +303,7 @@ export default class sampleMenuPenerimaan2 extends Component {
progress={!this.state.progress}
onPress={next => {
setTimeout(() => {
this.props.navigation.navigate('MenuPenerimaan3')
this.props.navigation.navigate('MenuPenerimaan3', {data: this.state.data})
next()
}, 300);
}}
......
......@@ -15,6 +15,7 @@ export default class sampleMenuPenerimaan3 extends Component {
constructor(props) {
super(props)
this.state = {
data: this.props.navigation.state.params.data || "",
date: new Date(),
checked: 'first',
progress: false,
......@@ -25,6 +26,10 @@ export default class sampleMenuPenerimaan3 extends Component {
}
}
componentDidMount() {
// alert(JSON.stringify(this.state.data))
}
async requestCameraPermission(type) {
try {
const granted = await PermissionsAndroid.request(
......@@ -59,7 +64,12 @@ export default class sampleMenuPenerimaan3 extends Component {
RNFetchBlob.fs.readFile(res.uri, 'base64')
.then((data) => {
if (type == 'rangka') {
this.setState({ imageRangka: res.uri }, () => alert(this.state.imageRangka))
this.setState({
data: {
...this.state.data,
chassis_number_photo: res.uri
}
})
} else {
let mesinArray = []
mesinArray.push({
......@@ -80,9 +90,8 @@ export default class sampleMenuPenerimaan3 extends Component {
}
}
render() {
let { data } = this.state
return (
<Container style={{ flex: 1, paddingHorizontal: 20, paddingBottom: 20 }}>
......@@ -142,13 +151,13 @@ export default class sampleMenuPenerimaan3 extends Component {
width: '100%', height: '100%', borderColor: 'rgba(237, 57, 99, .5)', borderStyle: 'dotted', borderWidth: 2, borderRadius: 5
}}
>
{this.state.imageRangka == '' ?
{data.chassis_number_photo == '' ?
<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: 'contain' }}
source={{ uri: this.state.imageRangka }}
style={{ width: '100%', height: '100%', resizeMode: 'cover' }}
source={{ uri: data.chassis_number_photo }}
/>
}
</View>
......@@ -165,13 +174,13 @@ export default class sampleMenuPenerimaan3 extends Component {
width: '100%', height: '100%', borderColor: 'rgba(237, 57, 99, .5)', borderStyle: 'dotted', borderWidth: 2, borderRadius: 5
}}
>
{this.state.imageMesin == '' ?
{data.engine_number_photo == '' ?
<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.imageMesin }}
source={{ uri: data.engine_number_photo }}
/>
}
</View>
......
const Constant = {
BASE_URL : 'https://103.44.149.207:8080/projectmanagement/public/mobile/',
BASE_URL : 'http:/103.44.149.215:8080/projectmanagement_dev/public/mobile/',
//USER
TOKEN: 'TOKEN',
......
......@@ -24,7 +24,7 @@ const create = () => {
// alert(url)
// api.setBaseURL(`${url}/api/`)
} else {
token = ""
token = "05ddbcb9f17bc952ed1c66fa2664e63710ed869a5bbb5079dcfec4424b9057a240b758b8b45fb7f617ffba0a966ebc2dd0e392491112ec8c64a2f311492dd0f0"
// url = Constant.BASE_URL.MASTER + '/api/'
// alert(url)
// api.setBaseURL(`${url}/api/`)
......@@ -43,9 +43,14 @@ const create = () => {
const methodPost = (value) => POST('something', value)
const login = (value) => POST('auth/login', value)
const getListClar = (value) => api.post('demo/get_list_clar', value)
const getWarehouse = () => GET('demo/get_user_warehouse')
return {
login
login,
getListClar,
getWarehouse
}
}
......
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