Commit e39c7918 authored by Deni Rinaldi's avatar Deni Rinaldi

Merge branch 'deni(lptp)' into 'master'

deal

See merge request !44
parents 6ee156d1 9f4cefb2
...@@ -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 Api from '../Services/Api'; import Api from '../Services/Api';
import M from 'moment'
class DealsOfTheDayScreen extends Component { class DealsOfTheDayScreen extends Component {
constructor(props) { constructor(props) {
...@@ -41,7 +42,8 @@ class DealsOfTheDayScreen extends Component { ...@@ -41,7 +42,8 @@ class DealsOfTheDayScreen extends Component {
componentDidMount() { componentDidMount() {
this.onAnimate(); this.onAnimate();
BackHandler.addEventListener("hardwareBackPress", this.backAction); BackHandler.addEventListener("hardwareBackPress", this.backAction);
this.getDOTD() // this.getDOTD()
this.getPeriode()
} }
componentWillUnmount() { componentWillUnmount() {
...@@ -57,6 +59,26 @@ class DealsOfTheDayScreen extends Component { ...@@ -57,6 +59,26 @@ class DealsOfTheDayScreen extends Component {
}).start(); }).start();
} }
getPeriode() {
let date = new Date
let timeNow = M(date).format('HH:mm')
let dateNow = M(date).format('YYYY-MM-DD')
let body = {
"date": dateNow,
"time": timeNow
}
Api.create().getPeriodeDeal(body).then(response => {
console.log(JSON.stringify(response))
if (response.data.status == "success") {
this.setState({
data: response.data.data.deal_product,
count: response.data.data.remaining,
countdown: true
})
}
})
}
getDOTD() { getDOTD() {
Api.create().getDealOfTheDay().then(response => { Api.create().getDealOfTheDay().then(response => {
if (response.data.status == "success") { if (response.data.status == "success") {
...@@ -79,13 +101,12 @@ class DealsOfTheDayScreen extends Component { ...@@ -79,13 +101,12 @@ class DealsOfTheDayScreen extends Component {
return ( return (
<View style={{ flex: 1, backgroundColor: '#4cc9f0' }}> <View style={{ flex: 1, backgroundColor: '#4cc9f0' }}>
<BaseHeader leftText={'Deals Of The Day'} onBackPress={() => this.props.navigation.goBack()} /> <BaseHeader leftText={'Deals Of The Day'} onBackPress={() => this.props.navigation.goBack()} />
<View style={{ flex: 1, backgroundColor: '#fff', borderTopLeftRadius: 30, borderTopRightRadius: 30, width: '100%', paddingTop: 20 }}> <View style={{ flex: 1, backgroundColor: '#fff', borderTopLeftRadius: 30, borderTopRightRadius: 30, width: '100%' }}>
<ScrollView> <ScrollView>
{this.state.countdown && ( {this.state.countdown && (
<View style={{ width: '90%', elevation: 5, alignSelf: 'center', backgroundColor: 'white', flexDirection: 'row', justifyContent: 'space-between', paddingLeft: 20, borderRadius: 10 }}> <View style={{ width: '90%', elevation: 5, alignSelf: 'center', backgroundColor: 'white', flexDirection: 'row', justifyContent: 'space-between', paddingLeft: 20, borderRadius: 10, marginTop: 20 }}>
<Image source={Images.flash} style={{ width: 58, height: 30, marginVertical: 5 }} /> <Image source={Images.flash} style={{ width: 58, height: 30, marginVertical: 5 }} />
<View style={{ width: 130, backgroundColor: '#4cc9f0', borderRadius: 10, justifyContent: 'center' }}> <View style={{ width: 130, backgroundColor: '#4cc9f0', borderRadius: 10, justifyContent: 'center' }}>
<CountDown <CountDown
size={13} size={13}
until={this.state.count} until={this.state.count}
...@@ -108,11 +129,22 @@ class DealsOfTheDayScreen extends Component { ...@@ -108,11 +129,22 @@ class DealsOfTheDayScreen extends Component {
data={this.state.data} data={this.state.data}
renderItem={({ item, index }) => ( renderItem={({ item, index }) => (
<View style={{ flex: 1, flexDirection: 'row', marginTop: index == 0 ? 0 : 0, borderRadius: 15, elevation: 5, backgroundColor: 'white', marginHorizontal: 10, marginBottom: 15 }}> <View style={{ flex: 1, flexDirection: 'row', marginTop: index == 0 ? 0 : 0, borderRadius: 15, elevation: 5, backgroundColor: 'white', marginHorizontal: 10, marginBottom: 15 }}>
<View style={{ width: '36%', backgroundColor: item.color, borderTopLeftRadius: 15, borderBottomLeftRadius: 15 }}> <View style={{ backgroundColor: 'blue', borderTopLeftRadius: 15, borderBottomLeftRadius: 15, flexDirection: 'row', }}>
<Image source={{ uri: item.product_image }} style={{ width: 110, height: 110, borderTopLeftRadius: 15, borderBottomLeftRadius: 15 }} /> <Image source={{ uri: item.product_image }} style={{ width: 110, height: 110, borderTopLeftRadius: 15, borderBottomLeftRadius: 15 }} />
<View style={{ backgroundColor: 'transparent', marginLeft: -40 }}>
<View style={{ height: 30, width: 30, backgroundColor: '#4cc9f0' }}>
<BaseText type={"bold"} text={String(parseInt(item.discount))} style={{ fontSize: 10, color: 'white', textAlign: 'center'}} />
<BaseText type={"regular"} text={`OFF`} style={{ fontSize: 10, color: 'white', textAlign: 'center' }} />
</View>
<View style={{ height: 25, width: 30, flexDirection: 'row' }}>
<View style={styles.triangleCorner} />
<View style={styles.triangleCornerRight} />
</View>
</View> </View>
<View style={{ width: '45%', justifyContent: 'flex-start', paddingHorizontal: 10, backgroundColor: 'white', borderTopRightRadius: 15, borderBottomRightRadius: 15, paddingVertical: 5 }}> </View>
<BaseText type={"regular"} text={item.product_name} style={{ fontSize: 10, color: 'black', textAlign: 'left', }} ellipsizeMode={"tail"} numberOfLines={2} /> <View style={{ width: '49%', justifyContent: 'flex-start', paddingHorizontal: 10, backgroundColor: 'white', borderTopRightRadius: 15, borderBottomRightRadius: 15, paddingVertical: 5 }}>
<BaseText type={"regular"} text={item.product_name} style={{ fontSize: 10, color: 'black', textAlign: 'left', }} ellipsizeMode={"tail"} numberOfLines={1} />
<BaseText type={"regular"} text={this.number(item.price)} style={{ fontSize: 10, color: '#d8d8d8', textAlign: 'left', textDecorationLine: 'line-through', marginTop: 10 }} /> <BaseText type={"regular"} text={this.number(item.price)} style={{ fontSize: 10, color: '#d8d8d8', textAlign: 'left', textDecorationLine: 'line-through', marginTop: 10 }} />
<BaseText type={"bold"} text={this.number(item.deal_price)} style={{ fontSize: 12, color: '#4cc9f0', textAlign: 'left', marginTop: 5 }} /> <BaseText type={"bold"} text={this.number(item.deal_price)} style={{ fontSize: 12, color: '#4cc9f0', textAlign: 'left', marginTop: 5 }} />
<BaseText type={"bold"} text={`20 TERJUAL`} style={{ fontSize: 10, color: 'black', textAlign: 'left', marginTop: 5 }} /> <BaseText type={"bold"} text={`20 TERJUAL`} style={{ fontSize: 10, color: 'black', textAlign: 'left', marginTop: 5 }} />
...@@ -127,29 +159,6 @@ class DealsOfTheDayScreen extends Component { ...@@ -127,29 +159,6 @@ class DealsOfTheDayScreen extends Component {
{this.state.progressStatus > 75 ? 'SEGERA HABIS' : ''} {this.state.progressStatus > 75 ? 'SEGERA HABIS' : ''}
</Animated.Text> </Animated.Text>
</Progress.Bar> </Progress.Bar>
{/* <View style={{
width: "100%",
backgroundColor: '#eaeaea',
height: 20,
borderRadius: 30,
justifyContent: "center",
}}>
<Animated.Text style={{
fontSize: 14,
color: "black",
position: "absolute",
zIndex: 1,
alignSelf: "center",
}}>
{this.state.progressStatus}%
</Animated.Text>
<Animated.View
style={{ height: this.state.progressStatus < 2 ? '20%' : this.state.progressStatus < 3 ? '30%' : this.state.progressStatus < 4 ? '40%' : this.state.progressStatus < 5 ? '50%' :this.state.progressStatus < 6 ? '60%' : this.state.progressStatus < 7 ? '70%' : this.state.progressStatus < 8 ? '80%' : this.state.progressStatus < 9 ? '90%' :'100%',
borderRadius: 15, backgroundColor: "green", width: this.state.progressStatus + "%" }}
/>
</View> */}
</View> </View>
<View style={{ justifyContent: 'flex-end', paddingVertical: 5 }}> <View style={{ justifyContent: 'flex-end', paddingVertical: 5 }}>
<TouchableOpacity style={{ backgroundColor: '#4cc9f0', width: 55, height: 35, borderRadius: 15, justifyContent: 'center' }}> <TouchableOpacity style={{ backgroundColor: '#4cc9f0', width: 55, height: 35, borderRadius: 15, justifyContent: 'center' }}>
......
...@@ -108,6 +108,7 @@ class RewardScreen extends Component { ...@@ -108,6 +108,7 @@ class RewardScreen extends Component {
this.getWallet() this.getWallet()
} else { } else {
this.setState({ intent: 'Rewards' }) this.setState({ intent: 'Rewards' })
this.getReward()
} }
} else { } else {
this.setState({ intent: 'Rewards' }) this.setState({ intent: 'Rewards' })
...@@ -119,6 +120,16 @@ class RewardScreen extends Component { ...@@ -119,6 +120,16 @@ class RewardScreen extends Component {
BackHandler.removeEventListener("hardwareBackPress", this.backAction); BackHandler.removeEventListener("hardwareBackPress", this.backAction);
} }
getReward(){
Api.create().getReward().then(response => {
if (response.data.status == "success") {
this.setState({
rewardPoint: response.data.data.reward
})
}
})
}
getWallet() { getWallet() {
Api.create().getWallet().then(response => { Api.create().getWallet().then(response => {
if (response.data.status == "success") { if (response.data.status == "success") {
......
...@@ -2,5 +2,25 @@ import { StyleSheet } from 'react-native' ...@@ -2,5 +2,25 @@ import { StyleSheet } from 'react-native'
import { ApplicationStyles } from '../../Themes/' import { ApplicationStyles } from '../../Themes/'
export default StyleSheet.create({ export default StyleSheet.create({
...ApplicationStyles.screen ...ApplicationStyles.screen,
triangleCorner: {
width: 0,
height: 0,
backgroundColor: 'transparent',
borderStyle: 'solid',
borderRightWidth: 15,
borderTopWidth: 15,
borderRightColor: 'transparent',
borderTopColor: '#4cc9f0'
},
triangleCornerRight: {
width: 0,
height: 0,
backgroundColor: 'transparent',
borderStyle: 'solid',
borderLeftWidth: 15,
borderTopWidth: 15,
borderRightColor: 'transparent',
borderTopColor: '#4cc9f0'
},
}) })
...@@ -71,10 +71,14 @@ const create = (baseURL = 'https://apiecart.eksad.com/mobile/') => { ...@@ -71,10 +71,14 @@ const create = (baseURL = 'https://apiecart.eksad.com/mobile/') => {
const verifikasiOtpEmail = (otp) => api.post('verify_otp_signup_email', otp) const verifikasiOtpEmail = (otp) => api.post('verify_otp_signup_email', otp)
const editProfile = (body) => api.post('edit_profile', body) const editProfile = (body) => api.post('edit_profile', body)
const editPhotoProfile = (body) => api.post('edit_photo', body) const editPhotoProfile = (body) => api.post('edit_photo', body)
const getDealOfTheDay = () => api.get('get_deal_of_the_day') const getReward = () => api.get('get_rewards')
const getWallet = () => api.get('get_wallet') const getWallet = () => api.get('get_wallet')
const topUpWallet = (body) => api.post('topup_wallet', body) const topUpWallet = (body) => api.post('topup_wallet', body)
// Deal Of The Day
const getPeriodeDeal = (body) => api.post('get_deal_product_per_periode', body)
const getDealOfTheDay = () => api.get('get_deal_of_the_day')
// Wishlist // Wishlist
const getWhislist = (body) => api.post('get_wishlist', body) const getWhislist = (body) => api.post('get_wishlist', body)
const searchWhislist = (body) => api.post('search_wishlist', body) const searchWhislist = (body) => api.post('search_wishlist', body)
...@@ -169,8 +173,10 @@ const create = (baseURL = 'https://apiecart.eksad.com/mobile/') => { ...@@ -169,8 +173,10 @@ const create = (baseURL = 'https://apiecart.eksad.com/mobile/') => {
getDealOfTheDay, getDealOfTheDay,
deleteAddress, deleteAddress,
selectAddress, selectAddress,
getReward,
getWallet, getWallet,
topUpWallet, topUpWallet,
getPeriodeDeal,
} }
} }
......
...@@ -37,6 +37,7 @@ ...@@ -37,6 +37,7 @@
"format-json": "^1.0.3", "format-json": "^1.0.3",
"identity-obj-proxy": "^3.0.0", "identity-obj-proxy": "^3.0.0",
"lodash": "^4.17.15", "lodash": "^4.17.15",
"moment": "^2.27.0",
"native-base": "^2.13.12", "native-base": "^2.13.12",
"prop-types": "^15.7.2", "prop-types": "^15.7.2",
"querystringify": "^2.1.1", "querystringify": "^2.1.1",
......
...@@ -9526,6 +9526,11 @@ mkdirp@~1.0.3: ...@@ -9526,6 +9526,11 @@ mkdirp@~1.0.3:
resolved "https://registry.yarnpkg.com/mkdirp/-/mkdirp-1.0.4.tgz#3eb5ed62622756d79a5f0e2a221dfebad75c2f7e" resolved "https://registry.yarnpkg.com/mkdirp/-/mkdirp-1.0.4.tgz#3eb5ed62622756d79a5f0e2a221dfebad75c2f7e"
integrity sha512-vVqVZQyf3WLx2Shd0qJ9xuvqgAyKPLAiqITEtqW0oIUjzo3PePDd6fW9iFz30ef7Ysp/oiWqbhszeGWW2T6Gzw== integrity sha512-vVqVZQyf3WLx2Shd0qJ9xuvqgAyKPLAiqITEtqW0oIUjzo3PePDd6fW9iFz30ef7Ysp/oiWqbhszeGWW2T6Gzw==
moment@^2.27.0:
version "2.27.0"
resolved "https://registry.yarnpkg.com/moment/-/moment-2.27.0.tgz#8bff4e3e26a236220dfe3e36de756b6ebaa0105d"
integrity sha512-al0MUK7cpIcglMv3YF13qSgdAIqxHTO7brRtaz3DlSULbqfazqkc5kEjNrLDOM7fsjshoFIihnU8snrP7zUvhQ==
morgan@^1.9.0: morgan@^1.9.0:
version "1.10.0" version "1.10.0"
resolved "https://registry.yarnpkg.com/morgan/-/morgan-1.10.0.tgz#091778abc1fc47cd3509824653dae1faab6b17d7" resolved "https://registry.yarnpkg.com/morgan/-/morgan-1.10.0.tgz#091778abc1fc47cd3509824653dae1faab6b17d7"
......
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