Commit 4b207ce0 authored by Deni Rinaldi's avatar Deni Rinaldi

binding warehouse + list clar

parent 943d3f1d
......@@ -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,32 +11,58 @@ 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) {
super(props)
this.state = {
data: ['Penerimaan', 'Appraisal', 'Approval'],
dataNews: [Images.news1, Images.news2, Images.news3]
dataNews: [Images.news1, Images.news2, 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 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
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>
......@@ -58,26 +84,38 @@ class HomePageScreen extends Component {
</Menu>
</View>
</LinearGradient> */}
<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>
<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>
<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'}}>
{this.state.data.map((item,index) => {
<View style={{ padding: 10, paddingVertical: 20, flexDirection: 'row' }}>
{this.state.data.map((item, index) => {
return (
<TouchableOpacity onPress={() => this.handleNav(item)} activeOpacity={.5}>
<Image source={item == 'Penerimaan'? Images.IconPenerimaan : item == 'Appraisal'? Images.IconAppraisal : Images.IconApproval} style={{width: 125, height: 125, marginLeft: 0}}/>
<Image source={item == 'Penerimaan' ? Images.IconPenerimaan : item == 'Appraisal' ? Images.IconAppraisal : Images.IconApproval} style={{ width: 125, height: 125, marginLeft: 0 }} />
</TouchableOpacity>
)
})}
</View>
<View style={{width: '100%', backgroundColor:'#dbdbdb', height: 3, marginVertical: 10}}/>
<View style={{ width: '100%', backgroundColor: '#dbdbdb', height: 3, marginVertical: 10 }} />
<View style={{ paddingVertical: 10 }}>
<View style={{ flexDirection: 'row', alignItems: 'center', paddingHorizontal: 25 }}>
......@@ -92,7 +130,7 @@ class HomePageScreen extends Component {
ref={(scrollView) => { this.scrollView2 = scrollView; }}
pagingEnabled={true}
horizontal={true}
style={{backgroundColor:'#f8f8f8'}}
style={{ backgroundColor: '#f8f8f8' }}
decelerationRate={0}
snapToInterval={width - 60}
snapToAlignment={"center"}
......@@ -104,13 +142,13 @@ class HomePageScreen extends Component {
}}>
{this.state.dataNews.map((item, index) => {
return (
<View style={styles.view2, {padding: 10, backgroundColor:'transparent', elevation: 5, marginLeft: index == 0? 15 : 0, marginRight: index == this.state.dataNews.length - 1? 15 : 0}}>
<View style={{width:'100%', backgroundColor:'rgba(240, 240, 240, .8)', borderTopLeftRadius: 10, borderTopRightRadius: 10}}>
<Text style={{marginVertical: 5, marginLeft: 20}}>News Feed</Text>
<View style={styles.view2, { padding: 10, backgroundColor: 'transparent', elevation: 5, marginLeft: index == 0 ? 15 : 0, marginRight: index == this.state.dataNews.length - 1 ? 15 : 0 }}>
<View style={{ width: '100%', backgroundColor: 'rgba(240, 240, 240, .8)', borderTopLeftRadius: 10, borderTopRightRadius: 10 }}>
<Text style={{ marginVertical: 5, marginLeft: 20 }}>News Feed</Text>
</View>
{/* <View style={{}}> */}
<ImageBackground source={item} imageStyle={{borderBottomLeftRadius: 10, borderBottomRightRadius: 10}} style={{width: Dimensions.get('window').width - 100, height: 175}}>
<View style={{width: '100%', height: '100%', backgroundColor:'rgba(240, 240, 240, .3)', justifyContent: 'center', alignItems:'center'}}>
<ImageBackground source={item} imageStyle={{ borderBottomLeftRadius: 10, borderBottomRightRadius: 10 }} style={{ width: Dimensions.get('window').width - 100, height: 175 }}>
<View style={{ width: '100%', height: '100%', backgroundColor: 'rgba(240, 240, 240, .3)', justifyContent: 'center', alignItems: 'center' }}>
<Text numberOfLines={1} ellipsizeMode={'tail'}> Ini Judul </Text>
<Text numberOfLines={1} ellipsizeMode={'tail'}> Ini Judul </Text>
<Text numberOfLines={1} ellipsizeMode={'tail'}> Ini Judul </Text>
......
......@@ -2,6 +2,7 @@ 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 api from '../../../service/api'
export default class Penerimaan extends Component {
......@@ -14,6 +15,20 @@ export default class Penerimaan extends Component {
]
}
}
componentDidMount() {
this.getListData()
// alert(JSON.stringify(this.props))
}
getListData() {
api.create().getListClar({
warehouse_id: Number(this.props.navigation.state.params.data)
}).then((response) => {
alert(JSON.stringify(response.data.data))
})
}
render() {
return (
<Container style={{ flex: 1 }}>
......
const Constant = {
BASE_URL : 'https://103.44.149.207:8080/projectmanagement/public/mobile/',
BASE_URL : 'http://103.44.149.207: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