Commit 68f989c1 authored by Dida Adams Arizona's avatar Dida Adams Arizona

Merge branch 'didam' into 'master'

Didam

See merge request !41
parents 39d50581 a8098f1b
...@@ -15,6 +15,7 @@ import Api from '../Services/Api'; ...@@ -15,6 +15,7 @@ import Api from '../Services/Api';
import BaseButton from '../Components/BaseButton'; import BaseButton from '../Components/BaseButton';
import { formatRp, handlePhone } from '../Lib/Utils'; import { formatRp, handlePhone } from '../Lib/Utils';
import Constant from '../Lib/Constant'; import Constant from '../Lib/Constant';
import Toast from 'react-native-toast-message';
class CartScreen extends Component { class CartScreen extends Component {
constructor(props) { constructor(props) {
...@@ -25,7 +26,7 @@ class CartScreen extends Component { ...@@ -25,7 +26,7 @@ class CartScreen extends Component {
asal: [1,2,3,4,5,6,7], asal: [1,2,3,4,5,6,7],
listCart: [], listCart: [],
arrayDelete: [], arrayDelete: [],
currency: '' currency: '',
} }
} }
...@@ -68,6 +69,7 @@ class CartScreen extends Component { ...@@ -68,6 +69,7 @@ class CartScreen extends Component {
this.setState({listCart: dataKosong}) this.setState({listCart: dataKosong})
}, 1000); }, 1000);
} else { } else {
this.setState({listCart: []})
// console.log('inikah', response.data) // console.log('inikah', response.data)
} }
...@@ -78,19 +80,91 @@ class CartScreen extends Component { ...@@ -78,19 +80,91 @@ class CartScreen extends Component {
let arrayDelete = [] let arrayDelete = []
arrayDelete.push(item) arrayDelete.push(item)
Api.create().deleteCart({cart_id: arrayDelete}).then((response) => { Api.create().deleteCart({cart_id: arrayDelete}).then((response) => {
console.log(response) if (response.data.status == 'success') {
this.getCart() Toast.show({
type: 'success',
position: 'bottom',
text1: 'Success',
text2: response.data.message,
visibilityTime: 2500,
autoHide: true,
// topOffset: 100,
// bottomOffset: 40,
})
this.getCart()
}
}) })
} }
hanldeSize(item, value){
let indexId = this.state.listCart.findIndex((val) => val.cart_id == item.cart_id)
let listCartCopy = Object.assign([] , this.state.listCart)
listCartCopy[indexId].size_id = value
let payload = {
"cart_id": item.cart_id,
"product_id": item.product_id,
"size_id": listCartCopy[indexId].size_id,
"quantity": "",
"price": String(item.price),
"total_price": String(item.total_price)
}
Api.create().editCart(payload).then((response) => {
if (response.data.status == 'success') {
Toast.show({
type: 'success',
position: 'bottom',
text1: 'Success',
text2: response.data.message,
visibilityTime: 2500,
autoHide: true,
// topOffset: 100,
// bottomOffset: 40,
})
} else {
Toast.show({
type: 'failed',
position: 'bottom',
text1: 'Failed',
text2: response.data.message,
visibilityTime: 2500,
autoHide: true,
// topOffset: 100,
// bottomOffset: 40,
})
}
})
this.setState({listCart: listCartCopy})
}
handleQty(inputText, type, item) { handleQty(inputText, type, item) {
let indexId = this.state.listCart.findIndex((val) => val.cart_id == item.cart_id) let indexId = this.state.listCart.findIndex((val) => val.cart_id == item.cart_id)
let listCartCopy = Object.assign([] , this.state.listCart) let listCartCopy = Object.assign([] , this.state.listCart)
if (inputText) { if (inputText) {
listCartCopy[indexId].quantity = type listCartCopy[indexId].quantity = type
} else { } else {
listCartCopy[indexId].quantity = type == '-'? listCartCopy[indexId].quantity - 1 : listCartCopy[indexId].quantity + 1 listCartCopy[indexId].quantity = type == '-'? (listCartCopy[indexId].quantity <= 1? 1 : listCartCopy[indexId].quantity-1) : (listCartCopy[indexId].quantity >= 15 ? 15 : listCartCopy[indexId].quantity + 1)
}
listCartCopy[indexId].total_price = listCartCopy[indexId].quantity * item.price
let payload = {
"cart_id": item.cart_id,
"product_id": item.product_id,
"size_id": "",
"quantity": listCartCopy[indexId].quantity,
"price": String(item.price),
"total_price": String(listCartCopy[indexId].total_price)
} }
Api.create().editCart(payload).then((response) => {
console.log('ini bro',payload)
console.log('ini bro xxx',response.data)
})
this.setState({listCart: listCartCopy}) this.setState({listCart: listCartCopy})
} }
...@@ -108,6 +182,22 @@ class CartScreen extends Component { ...@@ -108,6 +182,22 @@ class CartScreen extends Component {
return String(formatRp(this.state.currency, total)) return String(formatRp(this.state.currency, total))
} }
handleDefaultSize(item) {
let defaultSize = item.default_size
let sizeId = item.size_id
let indexId = defaultSize.findIndex((val) => val.size_id == sizeId)
if (defaultSize.length > 0) {
if (indexId != -1) {
return sizeId
} else {
return defaultSize[0].value
}
} else {
return null
}
}
render () { render () {
return ( return (
<View style={{flex: 1, backgroundColor: '#4cc9f0'}}> <View style={{flex: 1, backgroundColor: '#4cc9f0'}}>
...@@ -139,7 +229,7 @@ class CartScreen extends Component { ...@@ -139,7 +229,7 @@ class CartScreen extends Component {
<BaseText text={item.product_name} type={"bold"} style={{opacity: .6}}/> <BaseText text={item.product_name} type={"bold"} style={{opacity: .6}}/>
</View> </View>
<View style={{alignItems: 'flex-end', width: '40%', flexGrow: 1}}> <View style={{alignItems: 'flex-end', width: '40%', flexGrow: 1}}>
<BaseText text={String(formatRp(this.state.currency, item.price))} type={"bold"} style={{opacity: .8, color: '#4cc9f0'}}/> <BaseText text={String(formatRp(this.state.currency, item.total_price))} type={"bold"} style={{opacity: .8, color: '#4cc9f0'}}/>
<BaseText text={"Grosir"} type={"bold"} style={{opacity: .5, fontSize: 12}}/> <BaseText text={"Grosir"} type={"bold"} style={{opacity: .5, fontSize: 12}}/>
</View> </View>
</View> </View>
...@@ -150,7 +240,7 @@ class CartScreen extends Component { ...@@ -150,7 +240,7 @@ class CartScreen extends Component {
</View> </View>
</View> </View>
<View style={{paddingHorizontal: 20, paddingBottom: 20}}> <View style={{paddingHorizontal: 20, paddingBottom: 20}}>
<View style={{flexDirection:'row'}}> <View style={{flexDirection:'row', alignItems: 'center',}}>
<BaseText text={"Jumlah"} type={"regular"} style={{opacity: .4, width: '20%'}}/> <BaseText text={"Jumlah"} type={"regular"} style={{opacity: .4, width: '20%'}}/>
<View style={{flexDirection:'row', marginLeft: 10}}> <View style={{flexDirection:'row', marginLeft: 10}}>
<TouchableOpacity onPress={() => this.handleQty(false, '-', item)} style={{backgroundColor:'#f1f1f1', width: 25, padding: 5, alignItems: 'center', justifyContent: 'center',}}> <TouchableOpacity onPress={() => this.handleQty(false, '-', item)} style={{backgroundColor:'#f1f1f1', width: 25, padding: 5, alignItems: 'center', justifyContent: 'center',}}>
...@@ -168,14 +258,14 @@ class CartScreen extends Component { ...@@ -168,14 +258,14 @@ class CartScreen extends Component {
</TouchableOpacity> </TouchableOpacity>
</View> </View>
</View> </View>
<View style={{flexDirection:'row', alignItems: 'center',}}> {item.default_size.length > 0 && <View style={{flexDirection:'row', alignItems: 'center',}}>
<BaseText text={"Ukuran"} type={"regular"} style={{opacity: .4, width: '20%'}}/> <BaseText text={"Ukuran"} type={"regular"} style={{opacity: .4, width: '20%'}}/>
<View style={{width: 100, marginLeft: 10}}> <View style={{width: 100, marginLeft: 10}}>
<DropDownPicker <DropDownPicker
items={item.default_size} items={item.default_size}
placeholder={"Pilih Ukuran"} placeholder={"Pilih Ukuran"}
placeholderStyle={{ margin: 0, padding: 0}} placeholderStyle={{ margin: 0, padding: 0}}
// defaultValue={item.size_id} defaultValue={this.handleDefaultSize(item)}
containerStyle={{ height: 40, alignItems: 'center',}} containerStyle={{ height: 40, alignItems: 'center',}}
style={{ marginHorizontal: 0, paddingHorizontal: 0, backgroundColor: '#fff', zIndex: 1, borderTopWidth: 0, borderLeftWidth: 0, borderRightWidth: 0,}} style={{ marginHorizontal: 0, paddingHorizontal: 0, backgroundColor: '#fff', zIndex: 1, borderTopWidth: 0, borderLeftWidth: 0, borderRightWidth: 0,}}
itemStyle={{ itemStyle={{
...@@ -186,12 +276,10 @@ class CartScreen extends Component { ...@@ -186,12 +276,10 @@ class CartScreen extends Component {
activeLabelStyle={{ color: '#4cc9f0' }} activeLabelStyle={{ color: '#4cc9f0' }}
dropDownMaxHeight={200} dropDownMaxHeight={200}
dropDownStyle={{ backgroundColor: '#fff', height: 200 }} dropDownStyle={{ backgroundColor: '#fff', height: 200 }}
onChangeItem={item => this.setState({ onChangeItem={items => this.hanldeSize(item, items.value)}
ukuran: item.value,
})}
/> />
</View> </View>
</View> </View>}
</View> </View>
<View style={{width: '100%', height: 10, backgroundColor: '#ececec'}}/> <View style={{width: '100%', height: 10, backgroundColor: '#ececec'}}/>
{index == this.state.listCart.length -1 && <View style={{height: 200, backgroundColor:'transparent', width: '100%'}}/>} {index == this.state.listCart.length -1 && <View style={{height: 200, backgroundColor:'transparent', width: '100%'}}/>}
......
...@@ -61,6 +61,7 @@ class CategoryScreen extends Component { ...@@ -61,6 +61,7 @@ class CategoryScreen extends Component {
{this.state.data.map((item, index) => { {this.state.data.map((item, index) => {
return ( return (
<TouchableOpacity <TouchableOpacity
key={index}
style={{ backgroundColor: index % 2 == 0 ? '#b89469' : index % 3 == 0 ? '#7a7a7d' : '#636066', borderRadius: 16, height: 90, width: '100%', marginBottom: 15, marginTop: index == 0 ? 20 : 0, justifyContent: 'space-between', paddingHorizontal: 20, flexDirection: 'row' }} style={{ backgroundColor: index % 2 == 0 ? '#b89469' : index % 3 == 0 ? '#7a7a7d' : '#636066', borderRadius: 16, height: 90, width: '100%', marginBottom: 15, marginTop: index == 0 ? 20 : 0, justifyContent: 'space-between', paddingHorizontal: 20, flexDirection: 'row' }}
onPress={() => this.props.navigation.navigate('ListSearchScreen', { catID: item.cat_id })} onPress={() => this.props.navigation.navigate('ListSearchScreen', { catID: item.cat_id })}
> >
......
...@@ -16,6 +16,7 @@ import Constant from '../Lib/Constant'; ...@@ -16,6 +16,7 @@ import Constant from '../Lib/Constant';
import { formatRp, titleCase } from '../Lib/Utils'; import { formatRp, titleCase } from '../Lib/Utils';
import BaseButton from '../Components/BaseButton'; import BaseButton from '../Components/BaseButton';
import Modal from 'react-native-modal'; import Modal from 'react-native-modal';
import Toast from 'react-native-toast-message';
class DetailProductScreen extends Component { class DetailProductScreen extends Component {
constructor(props) { constructor(props) {
...@@ -29,12 +30,14 @@ class DetailProductScreen extends Component { ...@@ -29,12 +30,14 @@ class DetailProductScreen extends Component {
varient: [], varient: [],
varientId: 0, varientId: 0,
opacity: 0, opacity: 0,
typeCart: '',
varientModal: false, varientModal: false,
auth: this.props.auth auth: this.props.auth
} }
} }
componentDidMount() { componentDidMount() {
console.log(this.state.productId)
this.getCurrency() this.getCurrency()
this.getProductDetail() this.getProductDetail()
BackHandler.addEventListener("hardwareBackPress", this.backAction); BackHandler.addEventListener("hardwareBackPress", this.backAction);
...@@ -85,13 +88,26 @@ class DetailProductScreen extends Component { ...@@ -85,13 +88,26 @@ class DetailProductScreen extends Component {
if (this.state.auth.user != null) { if (this.state.auth.user != null) {
let payload = { let payload = {
"product_id": item.product_id, "product_id": item.product_id,
"varient_id": item.varientId, "varient_id": item.varient_id,
"quantity": 1, "quantity": 1,
"price": this.state.dataProduct.price, "price": this.state.dataProduct.price,
"total_price": this.state.dataProduct.price "total_price": this.state.dataProduct.price
} }
Api.create().addCart(payload).then((response) => { Api.create().addCart(payload).then((response) => {
Toast.show({
type: 'success',
position: 'bottom',
text1: 'Success',
text2: response.data.message,
visibilityTime: 2500,
autoHide: true,
// topOffset: 100,
// bottomOffset: 40,
})
this.setState({varientModal: false}) this.setState({varientModal: false})
if (this.state.typeCart == 'beli') {
this.props.navigation.navigate('CartScreen')
}
}) })
} }
} }
...@@ -101,12 +117,30 @@ class DetailProductScreen extends Component { ...@@ -101,12 +117,30 @@ class DetailProductScreen extends Component {
if (this.state.auth.user != null) { if (this.state.auth.user != null) {
if (this.state.dataProduct.is_wishlist) { if (this.state.dataProduct.is_wishlist) {
Api.create().deleteWishlist(this.state.dataProduct.product_id).then((response) => { Api.create().deleteWishlist(this.state.dataProduct.product_id).then((response) => {
console.log(response) Toast.show({
type: 'success',
position: 'bottom',
text1: 'Success',
text2: response.data.message,
visibilityTime: 2500,
autoHide: true,
// topOffset: 100,
// bottomOffset: 40,
})
this.getProductDetail() this.getProductDetail()
}) })
} else { } else {
Api.create().addWishlist(payload).then((response) => { Api.create().addWishlist(payload).then((response) => {
console.log(response) Toast.show({
type: 'success',
position: 'bottom',
text1: 'Success',
text2: response.data.message,
visibilityTime: 2500,
autoHide: true,
// topOffset: 100,
// bottomOffset: 40,
})
this.getProductDetail() this.getProductDetail()
}) })
} }
...@@ -196,7 +230,7 @@ class DetailProductScreen extends Component { ...@@ -196,7 +230,7 @@ class DetailProductScreen extends Component {
<View style={{height: 1, width: '100%', backgroundColor: '#d8d8d8', marginVertical: 20}}/> <View style={{height: 1, width: '100%', backgroundColor: '#d8d8d8', marginVertical: 20}}/>
<View style={{paddingHorizontal: 25}}> <View style={{paddingHorizontal: 25}}>
<BaseText type={"bold"} text={'Deskripsi'} style={{fontSize: 16, color: '#4b4b4b', marginBottom: 10}}/> <BaseText type={"bold"} text={'Deskripsi'} style={{fontSize: 16, color: '#4b4b4b', marginBottom: 10}}/>
<BaseText type={"regular"} text={this.state.dataProduct.size_description}/> <BaseText type={"regular"} text={this.state.dataProduct.description != null? this.state.dataProduct.description : '-'}/>
</View> </View>
</View> </View>
</View> </View>
...@@ -216,10 +250,10 @@ class DetailProductScreen extends Component { ...@@ -216,10 +250,10 @@ class DetailProductScreen extends Component {
<Image source={Images.icon_chat} style={{width: 50, height: 50}}/> <Image source={Images.icon_chat} style={{width: 50, height: 50}}/>
</TouchableOpacity> </TouchableOpacity>
<View style={{width: '40%'}}> <View style={{width: '40%'}}>
<BaseButton text={'Beli'} onPress={() => null} fontSizeText={12}/> <BaseButton text={'Beli'} onPress={() => this.setState({varientModal: true, typeCart: 'beli'})} fontSizeText={12}/>
</View> </View>
<View style={{width: '40%'}}> <View style={{width: '40%'}}>
<BaseButton text={'+ Keranjang'} onPress={() => this.setState({varientModal: true})} fontSizeText={12} color={'white'} textColor={'#4cc9f0'} style={{borderWidth: 1, borderColor: '#4cc9f0'}}/> <BaseButton text={'+ Keranjang'} onPress={() => this.setState({varientModal: true, typeCart: 'keranjang'})} fontSizeText={12} color={'white'} textColor={'#4cc9f0'} style={{borderWidth: 1, borderColor: '#4cc9f0'}}/>
</View> </View>
</View> </View>
</View> </View>
......
...@@ -93,10 +93,11 @@ class ListAddressScreen extends Component { ...@@ -93,10 +93,11 @@ class ListAddressScreen extends Component {
</View> </View>
</Modal> </Modal>
<ModalBox <ModalBox
backButtonClose={() => this.setState({ other: false })} backButtonClose={true}
onClosed={() => this.setState({other: false})}
position="bottom" position="bottom"
isOpen={this.state.other} isOpen={this.state.other}
style={{ height: 60 }} style={{ height: 85 }}
coverScreen={true}> coverScreen={true}>
<View style={{ flex: 1, backgroundColor: 'white', width: '100%', paddingVertical: 10, paddingHorizontal: 20, justifyContent: 'center' }}> <View style={{ flex: 1, backgroundColor: 'white', width: '100%', paddingVertical: 10, paddingHorizontal: 20, justifyContent: 'center' }}>
<TouchableOpacity onPress={() => this.setState({ other: false }, () => this.changeStatus())}> <TouchableOpacity onPress={() => this.setState({ other: false }, () => this.changeStatus())}>
......
...@@ -41,14 +41,11 @@ class ListSearchScreen extends Component { ...@@ -41,14 +41,11 @@ class ListSearchScreen extends Component {
} }
componentDidMount() { componentDidMount() {
if (this.props.navigation.state) { let catID = this.props.navigation.state.params == undefined ? '' : this.props.navigation.state.params.catID
if (this.props.navigation.state.params.catID) { if (catID != '') {
let categoryId = [] let categoryId = []
categoryId.push(this.props.navigation.state.params.catID) categoryId.push(catID)
this.setState({ categoryId }, ()=> this.getAllProduct()) this.setState({ categoryId }, ()=> this.getAllProduct())
} else {
this.getAllProduct()
}
} else { } else {
this.getAllProduct() this.getAllProduct()
} }
...@@ -69,7 +66,7 @@ class ListSearchScreen extends Component { ...@@ -69,7 +66,7 @@ class ListSearchScreen extends Component {
} }
Api.create().getAllProduct(payload).then((response) => { Api.create().getAllProduct(payload).then((response) => {
console.log(payload) console.log(payload)
console.log(response.data) // console.log(response.data)
if (response.data.status == 'success') { if (response.data.status == 'success') {
this.setState({ listData: this.state.listData.concat(response.data.data) }) this.setState({ listData: this.state.listData.concat(response.data.data) })
} }
...@@ -131,19 +128,19 @@ class ListSearchScreen extends Component { ...@@ -131,19 +128,19 @@ class ListSearchScreen extends Component {
<View style={{ flex: 1 }}> <View style={{ flex: 1 }}>
<StatusBar backgroundColor={'transparent'} translucent={true} barStyle={'light-content'} /> <StatusBar backgroundColor={'transparent'} translucent={true} barStyle={'light-content'} />
<BaseHeader <BaseHeader
onSubmitEditing={() => { // onSubmitEditing={() => {
this.setState({ listData: [] }, () => { // this.setState({ listData: [] }, () => {
this.refreshState() // this.refreshState()
this.getAllProduct() // this.getAllProduct()
}) // })
}} // }}
onClose={() => { // onClose={() => {
this.setState({ listData: [], search: '' }, () => { // this.setState({ listData: [], search: '' }, () => {
this.refreshState() // this.refreshState()
this.getAllProduct() // this.getAllProduct()
}) // })
}} // }}
value={this.state.search} onChangeText={(search) => this.setState({ search })} placeholder={'Cari Product'} value={this.state.search} onChangeText={(search) => this.setState({ search }, () => this.getAllProduct())} placeholder={'Cari Product'}
typeSearch={true} onBackPress={() => this.props.navigation.goBack()} /> typeSearch={true} onBackPress={() => this.props.navigation.goBack()} />
<Modal <Modal
animationOut='slideOutDown' animationOut='slideOutDown'
......
...@@ -12,6 +12,7 @@ import BaseHeader from '../Components/BaseHeader'; ...@@ -12,6 +12,7 @@ import BaseHeader from '../Components/BaseHeader';
import { Images } from '../Themes'; import { Images } from '../Themes';
import BaseText from '../Components/BaseText'; import BaseText from '../Components/BaseText';
import Toast from 'react-native-toast-message' import Toast from 'react-native-toast-message'
import Api from '../Services/Api'
class MyAccountScreen extends Component { class MyAccountScreen extends Component {
constructor(props) { constructor(props) {
...@@ -66,6 +67,19 @@ class MyAccountScreen extends Component { ...@@ -66,6 +67,19 @@ class MyAccountScreen extends Component {
this.props.navigation.navigate('ChangePasswordScreen'); this.props.navigation.navigate('ChangePasswordScreen');
} else if (type == 'Keluar') { } else if (type == 'Keluar') {
this.props.authClearData() this.props.authClearData()
Api.create().logout(this.props.auth.user.data.user_id).then((response) => {
// console.log(response.data)
Toast.show({
type: 'success',
position: 'bottom',
text1: 'Success',
text2: `${response.data.message}👋`,
visibilityTime: 2500,
autoHide: true,
// topOffset: 100,
// bottomOffset: 40,
})
})
const resetAction = StackActions.reset({ const resetAction = StackActions.reset({
index: 0, index: 0,
actions: [ actions: [
......
import React, { Component } from 'react' import React, { Component } from 'react'
import { ScrollView, Text, KeyboardAvoidingView, View, Image, Alert, BackHandler, TextInput, FlatList, TouchableOpacity } from 'react-native' import { ScrollView, Text, KeyboardAvoidingView, View, Image, Alert, BackHandler, TextInput, FlatList, TouchableOpacity, AsyncStorage } from 'react-native'
import { connect } from 'react-redux' import { connect } from 'react-redux'
// Add Actions - replace 'Your' with whatever your reducer is called :) // Add Actions - replace 'Your' with whatever your reducer is called :)
// import YourActions from '../Redux/YourRedux' // import YourActions from '../Redux/YourRedux'
...@@ -12,6 +12,8 @@ import Ionicons from 'react-native-vector-icons/Ionicons' ...@@ -12,6 +12,8 @@ import Ionicons from 'react-native-vector-icons/Ionicons'
import FontAwesome from 'react-native-vector-icons/FontAwesome' import FontAwesome from 'react-native-vector-icons/FontAwesome'
import BaseText from '../Components/BaseText' import BaseText from '../Components/BaseText'
import Api from '../Services/Api' import Api from '../Services/Api'
import { formatRp } from '../Lib/Utils'
import Constant from '../Lib/Constant'
class WishlistScreen extends Component { class WishlistScreen extends Component {
constructor(props) { constructor(props) {
...@@ -26,7 +28,8 @@ class WishlistScreen extends Component { ...@@ -26,7 +28,8 @@ class WishlistScreen extends Component {
], ],
data: [], data: [],
text: "", text: "",
isSecondColumn: false isSecondColumn: false,
currency: ''
} }
} }
backAction = () => { backAction = () => {
...@@ -44,6 +47,7 @@ class WishlistScreen extends Component { ...@@ -44,6 +47,7 @@ class WishlistScreen extends Component {
componentDidMount() { componentDidMount() {
BackHandler.addEventListener("hardwareBackPress", this.backAction); BackHandler.addEventListener("hardwareBackPress", this.backAction);
this.getWhistlist() this.getWhistlist()
this.getCurrency()
let isSecondColumn = this.state.dummyList.length % 2 === 0 let isSecondColumn = this.state.dummyList.length % 2 === 0
this.setState({ isSecondColumn }) this.setState({ isSecondColumn })
} }
...@@ -52,6 +56,11 @@ class WishlistScreen extends Component { ...@@ -52,6 +56,11 @@ class WishlistScreen extends Component {
BackHandler.removeEventListener("hardwareBackPress", this.backAction); BackHandler.removeEventListener("hardwareBackPress", this.backAction);
} }
async getCurrency() {
let currency = await AsyncStorage.getItem(Constant.GLOBAL_CURRENCY)
this.setState({currency})
}
getWhistlist() { getWhistlist() {
let body = { let body = {
"offset": 0, "offset": 0,
...@@ -117,14 +126,14 @@ class WishlistScreen extends Component { ...@@ -117,14 +126,14 @@ class WishlistScreen extends Component {
renderItem={({ item, index }) => { renderItem={({ item, index }) => {
return ( return (
<View style={{ flex: 1 / 2, flexDirection: 'column', margin: 10, backgroundColor: '#fff', borderRadius: 15, elevation: 3, marginTop: index == 0 ? 20 : index == 1 ? 20 : 0, marginRight: index == this.state.dummyList.length - 1 && this.state.isSecondColumn == false ? 30 : 10 }}> <View style={{ flex: 1 / 2, flexDirection: 'column', margin: 10, backgroundColor: '#fff', borderRadius: 15, elevation: 3, marginTop: index == 0 ? 20 : index == 1 ? 20 : 0, marginRight: index == this.state.dummyList.length - 1 && this.state.isSecondColumn == false ? 30 : 10 }}>
<TouchableOpacity style={{ flex: 1 }} onPress={() => null}> <TouchableOpacity style={{ flex: 1 }} onPress={() => this.props.navigation.navigate('DetailProductScreen', {productId: item.product_id})}>
<View style={{ backgroundColor: item.color, width: '100%', height: 148, borderRadius: 10 }}> <View style={{ backgroundColor: item.color, width: '100%', height: 148, borderRadius: 10 }}>
<Image source={{ uri: item.product_image }} style={{ width: '100%', height: '100%' }} /> <Image source={{ uri: item.product_image }} style={{ width: '100%', height: '100%' }} />
<Image source={Images.wishlistBulat} style={{ width: 24, height: 24, alignSelf: 'flex-end', position: 'absolute', right: 10, top: 10 }} /> <Image source={Images.wishlistBulat} style={{ width: 24, height: 24, alignSelf: 'flex-end', position: 'absolute', right: 10, top: 10 }} />
</View> </View>
<View style={{ paddingHorizontal: 10, marginVertical: 10, justifyContent: 'space-between', flex: 1 }}> <View style={{ paddingHorizontal: 10, marginVertical: 10, justifyContent: 'space-between', flex: 1 }}>
<BaseText type={"regular"} text={item.product_name} style={{ fontSize: 14, color: 'black', textAlign: 'left', }} ellipsizeMode={"tail"} numberOfLines={2} /> <BaseText type={"regular"} text={item.product_name} style={{ fontSize: 14, color: 'black', textAlign: 'left', }} ellipsizeMode={"tail"} numberOfLines={2} />
<BaseText type={"regular"} text={item.price} style={{ fontSize: 10, color: 'black', textAlign: 'left', marginTop: 5 }} /> <BaseText type={"regular"} text={formatRp(this.state.currency, item.price)} style={{ fontSize: 10, color: 'black', textAlign: 'left', marginTop: 5 }} />
</View> </View>
</TouchableOpacity> </TouchableOpacity>
</View> </View>
......
...@@ -63,6 +63,7 @@ const create = (baseURL = 'https://apiecart.eksad.com/mobile/') => { ...@@ -63,6 +63,7 @@ const create = (baseURL = 'https://apiecart.eksad.com/mobile/') => {
const getRate = () => api.get('rate_limit') const getRate = () => api.get('rate_limit')
const getUser = (username) => api.get('search/users', { q: username }) const getUser = (username) => api.get('search/users', { q: username })
const login = (body) => api.post('login', body) const login = (body) => api.post('login', body)
const logout = (userId) => api.post(`logout/${userId}`)
const registerUser = (body) => api.post('register', body) const registerUser = (body) => api.post('register', body)
const changePassword = (body) => api.post('change_password', body) const changePassword = (body) => api.post('change_password', body)
const forgotPassword = (body) => api.post('forgot_password', body) const forgotPassword = (body) => api.post('forgot_password', body)
...@@ -133,6 +134,7 @@ const create = (baseURL = 'https://apiecart.eksad.com/mobile/') => { ...@@ -133,6 +134,7 @@ const create = (baseURL = 'https://apiecart.eksad.com/mobile/') => {
contactUs, contactUs,
getUser, getUser,
login, login,
logout,
registerUser, registerUser,
changePassword, changePassword,
forgotPassword, forgotPassword,
......
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