Commit ddef6b0a by Giang Tran

update feature partner

parent e19d8011
......@@ -12,10 +12,14 @@ const DetailPartner = (props) => {
status_name,
created,
email,
level,
sponsor_name,
commission,
partner_count,
} = props.route.params.data;
return (
<View style={{flex: 1}}>
<View style={{flex: 1, borderColor: 'white'}}>
<HeaderBack title={'Detail'} />
<View style={{flex: 1}}>
<View style={styles.containerTop}>
......@@ -27,7 +31,14 @@ const DetailPartner = (props) => {
<AppText style={styles.txtTitle} i18nKey={'Fullname'} />
</View>
<View style={styles.wrapRight}>
<Text style={{fontSize: getFontXD(42)}}>{fullname}</Text>
<Text
style={{
fontSize: getFontXD(46),
textTransform: 'uppercase',
fontWeight: '600',
}}>
{fullname}
</Text>
</View>
</View>
......@@ -36,7 +47,7 @@ const DetailPartner = (props) => {
<AppText style={styles.txtTitle} i18nKey={'level'} />
</View>
<View style={styles.wrapRight}>
<Text style={{fontSize: getFontXD(42)}}>{fullname}</Text>
<Text style={{fontSize: getFontXD(42)}}>{level}</Text>
</View>
</View>
......@@ -45,7 +56,7 @@ const DetailPartner = (props) => {
<AppText style={styles.txtTitle} i18nKey={'Sponsor'} />
</View>
<View style={styles.wrapRight}>
<Text style={{fontSize: getFontXD(42)}}>{fullname}</Text>
<Text style={{fontSize: getFontXD(42)}}>{sponsor_name}</Text>
</View>
</View>
......@@ -90,7 +101,7 @@ const DetailPartner = (props) => {
<AppText style={styles.txtTitle} i18nKey={'CountSponsors'} />
</View>
<View style={styles.wrapRight}>
<Text style={{fontSize: getFontXD(42)}}>{fullname}</Text>
<Text style={{fontSize: getFontXD(42)}}>{partner_count}</Text>
</View>
</View>
......@@ -99,7 +110,7 @@ const DetailPartner = (props) => {
<AppText style={styles.txtTitle} i18nKey={'TotalCommission'} />
</View>
<View style={styles.wrapRight}>
<Text style={{fontSize: getFontXD(42)}}>{fullname}</Text>
<Text style={{fontSize: getFontXD(42)}}>{commission}</Text>
</View>
</View>
</View>
......
......@@ -13,6 +13,7 @@ const Item = (props) => {
cqg_status_name,
status_name,
created,
sponsor_name,
} = props.item;
const navigation = useNavigation();
......@@ -24,20 +25,26 @@ const Item = (props) => {
<Image source={{uri: picture_url}} style={styles.img} />
<View style={styles.wrapRight}>
<Text style={styles.txtName}>{fullname}</Text>
<View style={{flexDirection: 'row', alignItems: 'center'}}>
<View style={styles.row}>
<AppText style={styles.txtTitle} i18nKey={'Status'} />
<Text style={{fontSize: getFontXD(42)}}>{status_name}</Text>
</View>
<View style={{flexDirection: 'row', alignItems: 'center'}}>
<View style={styles.row}>
<AppText style={styles.txtTitle} i18nKey={'DateJoin'} />
<Text style={{fontSize: getFontXD(42)}}>{created}</Text>
</View>
<View style={{flexDirection: 'row', alignItems: 'center'}}>
<View style={styles.row}>
<AppText style={styles.txtTitle} i18nKey={'OpenAccountExchange'} />
<Text style={{fontSize: getFontXD(42)}}>{cqg_status_name}</Text>
</View>
{props.level == 1 ? null : (
<View style={styles.row}>
<AppText style={styles.txtTitle} i18nKey={'Sponsor'} />
<Text style={{fontSize: getFontXD(42)}}>{sponsor_name}</Text>
</View>
)}
</View>
</TouchableOpacity>
);
......@@ -73,8 +80,6 @@ const styles = StyleSheet.create({
wrapRight: {
marginLeft: 5,
flex: 1,
height: 80,
justifyContent: 'space-between',
},
txtTitle: {
fontSize: getFontXD(42),
......@@ -84,5 +89,7 @@ const styles = StyleSheet.create({
txtName: {
fontSize: getFontXD(46),
color: R.colors.black,
textTransform: 'uppercase',
},
row: {flexDirection: 'row', alignItems: 'center', marginTop: 2},
});
......@@ -11,6 +11,7 @@ import {
Dimensions,
} from 'react-native';
import R from '../../../assets/R';
import {
HEIGHTXD,
WIDTHXD,
......@@ -148,7 +149,7 @@ const SearchProductCodeModal = (props) => {
<TouchableOpacity
onPress={() => {
props.toggleModal();
console.log(open);
setTextSearch('');
navigate.navigate(SEARCHPARTNER, {
keyword: textSearch,
level: level.value,
......
......@@ -4,13 +4,13 @@ import Item from './Item';
import {getListPartner} from '../../../apis/Functions/users';
import HeaderBack from '../../../components/Header/HeaderBack';
import {showAlert, TYPE} from '../../../components/DropdownAlert';
import AppText from '../../../components/AppText';
import I18n from '../../../helper/i18/i18n';
const Level1 = (props) => {
const [page, setPage] = useState(1);
const [data, setData] = useState([]);
const [tottalPage, setTotalPage] = useState(1);
const [isRefresh, setisRefresh] = useState(false);
console.log(props.route.params);
const {trader_account_status, level, keyword} = props.route.params;
......@@ -30,7 +30,7 @@ const Level1 = (props) => {
page_index: 1,
});
if ((res.data.code = 200 && res.data.data)) {
if ((res.data.code = 200 && res.data.data && res.data.data.length > 0)) {
setData(res.data.data);
setTotalPage(res.data.meta.pages);
} else {
......@@ -58,7 +58,7 @@ const Level1 = (props) => {
});
setPage(page + 1);
if (res.data.code == 200) {
if (res.data.code == 200 && res.data.data && res.data.data.length > 0) {
setData(data.concat(res.data.data));
}
setisRefresh(false);
......@@ -68,20 +68,31 @@ const Level1 = (props) => {
<View style={{flex: 1}}>
<HeaderBack title="SearchPartner" />
<FlatList
data={data}
showsVerticalScrollIndicator={false}
keyExtractor={(item) => item.id}
refreshing={isRefresh}
onRefresh={() => onRefresh()}
onEndReachedThreshold={0.01}
onEndReached={(info) => {
onLoadMore();
}}
renderItem={({item, index}) => (
<Item isEnd={data.length - 1 == index ? true : false} item={item} />
)}
/>
{data.length > 0 ? (
<FlatList
data={data}
showsVerticalScrollIndicator={false}
keyExtractor={(item) => item.id}
refreshing={isRefresh}
onRefresh={() => onRefresh()}
onEndReachedThreshold={0.01}
onEndReached={(info) => {
onLoadMore();
}}
renderItem={({item, index}) => (
<Item isEnd={data.length - 1 == index ? true : false} item={item} />
)}
/>
) : (
<View style={{justifyContent: 'center', alignItems: 'center', flex: 1}}>
<AppText
i18nKey={'NoData'}
style={{
fontSize: 18,
fontWeight: 'bold',
}}></AppText>
</View>
)}
</View>
);
};
......
......@@ -23,6 +23,7 @@ const Level1 = (props) => {
platform: Platform.OS,
page_size: 10,
page_index: 1,
trader_account_status: -1,
});
if ((res.data.code = 200 && res.data.data)) {
......@@ -44,15 +45,18 @@ const Level1 = (props) => {
const getDataLoadMore = async () => {
setisRefresh(true);
console.log('Chay vao day');
const res = await getListPartner({
keyword: '',
level: props.type,
platform: Platform.OS,
page_size: 10,
page_index: page + 1,
trader_account_status: -1,
});
setPage(page + 1);
console.log('rress', res);
if (res.data.code == 200) {
setData(data.concat(res.data.data));
}
......@@ -61,20 +65,36 @@ const Level1 = (props) => {
return (
<View style={{flex: 1}}>
<FlatList
data={data}
showsVerticalScrollIndicator={false}
keyExtractor={(item) => item.id}
refreshing={isRefresh}
onRefresh={() => onRefresh()}
onEndReachedThreshold={0.01}
onEndReached={(info) => {
onLoadMore();
}}
renderItem={({item, index}) => (
<Item isEnd={data.length - 1 == index ? true : false} item={item} />
)}
/>
{data.length > 0 ? (
<FlatList
data={data}
showsVerticalScrollIndicator={false}
keyExtractor={(item) => item.id}
refreshing={isRefresh}
onRefresh={() => onRefresh()}
onEndReachedThreshold={0.01}
onEndReached={(info) => {
console.log('Cham');
onLoadMore();
}}
renderItem={({item, index}) => (
<Item
level={props.type}
isEnd={data.length - 1 == index ? true : false}
item={item}
/>
)}
/>
) : (
<View style={{justifyContent: 'center', alignItems: 'center', flex: 1}}>
<AppText
i18nKey={'NoData'}
style={{
fontSize: 18,
fontWeight: 'bold',
}}></AppText>
</View>
)}
</View>
);
};
......
......@@ -345,7 +345,7 @@ export default {
NamePartner: 'Tên đối tác',
Opened: 'Đã mở',
Unopen: 'Chưa mở',
OpenAccountExchange: 'Mở tài khoản giao dịch:',
OpenAccountExchange: 'Mở TKGD:',
DateJoin: 'Ngày tham gia:',
Sponsor: 'Người giới thiệu',
CountSponsors: 'Số người giới thiệu',
......
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