Commit ddef6b0a by Giang Tran

update feature partner

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