Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
I
InvestCustomer
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
1
Merge Requests
1
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Giang Tran
InvestCustomer
Commits
da99951b
Commit
da99951b
authored
May 06, 2021
by
Nguyễn Thị Thúy
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
integrate api:
- category list - price table list
parent
e4849df6
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
98 additions
and
60 deletions
+98
-60
RootView.js
src/RootView.js
+1
-1
Item.js
src/Screens/Transaction/PriceList/Item.js
+16
-24
PriceList.js
src/Screens/Transaction/PriceList/PriceList.js
+50
-20
PriceListView.js
src/Screens/Transaction/PriceList/PriceListView.js
+15
-15
Transaction.js
src/apis/Functions/Transaction.js
+13
-0
url.js
src/apis/url.js
+3
-0
No files found.
src/RootView.js
View file @
da99951b
...
@@ -31,7 +31,7 @@ const RootView = (props) => {
...
@@ -31,7 +31,7 @@ const RootView = (props) => {
<
StackNavigation
/>
<
StackNavigation
/>
<
/View
>
<
/View
>
<
VersionChecker
/>
{
/*<VersionChecker/>*/
}
<
NoInternetComponent
/>
<
NoInternetComponent
/>
<
/
>
<
/
>
);
);
...
...
src/Screens/Transaction/PriceList/Item.js
View file @
da99951b
...
@@ -17,27 +17,25 @@ import R from '../../../assets/R';
...
@@ -17,27 +17,25 @@ import R from '../../../assets/R';
import
Block
from
'../../../components/Block'
;
import
Block
from
'../../../components/Block'
;
const
Item
=
(
props
)
=>
{
const
Item
=
(
props
)
=>
{
const
{
item
}
=
props
;
const
{
item
,
isEndItem
}
=
props
;
return
(
return
(
<
View
style
=
{
styles
.
container
}
>
<
View
style
=
{
[
styles
.
container
,
isEndItem
&&
{
marginBottom
:
HEIGHTXD
(
100
)}]
}
>
<
TouchableOpacity
onPress
=
{()
=>
props
.
onPress
(
item
)}
>
<
TouchableOpacity
onPress
=
{()
=>
props
.
onPress
(
item
)}
>
<
Block
flex
=
{
1
}
row
>
<
Block
flex
=
{
1
}
row
>
<
View
style
=
{
styles
.
wrapDate
}
>
<
Image
source
=
{
R
.
images
.
iconRecharge
}
style
=
{
styles
.
imgIcon
}
/
>
<
Image
source
=
{
R
.
images
.
iconRecharge
}
style
=
{
styles
.
imgIcon
}
/
>
<
/View
>
<
Block
padding
=
{[
0
,
WIDTHXD
(
40
)]}
space
=
{
'between'
}
flex
=
{
1
}
>
<
Block
padding
=
{[
5
,
10
]}
space
=
{
'between'
}
flex
=
{
1
}
>
<
View
<
View
style
=
{{
style
=
{{
flex
:
1
,
flex
:
1
,
flexDirection
:
'row'
,
flexDirection
:
'row'
,
justifyContent
:
'space-between'
,
justifyContent
:
'space-between'
,
}}
>
}}
>
<
Text
numberOfLines
=
{
2
}
style
=
{
styles
.
txtBlack
}
>
<
Text
numberOfLines
=
{
2
}
style
=
{
[
styles
.
txtBlack
,
{
flexWrap
:
'wrap'
,
flex
:
1
}]}
numberOfLines
=
{
1
}
ellipsizeMode
=
'tail'
>
Ng
ô
CBOT
{
item
.
name
}
<
/Text
>
<
/Text
>
<
Text
style
=
{
styles
.
txtMoney
}
>
{
toPriceVnd
(
300000
)}
<
/Text
>
<
Text
style
=
{
styles
.
txtMoney
}
>
{
toPriceVnd
(
item
.
fee
)}
<
/Text
>
<
/View
>
<
/View
>
<
Text
style
=
{
styles
.
txt
}
>
ZCE
<
/Text
>
<
Text
style
=
{
styles
.
txt
}
>
{
item
.
code
}
<
/Text
>
<
/Block
>
<
/Block
>
<
/Block
>
<
/Block
>
<
/TouchableOpacity
>
<
/TouchableOpacity
>
...
@@ -49,8 +47,7 @@ export default Item;
...
@@ -49,8 +47,7 @@ export default Item;
const
styles
=
StyleSheet
.
create
({
const
styles
=
StyleSheet
.
create
({
container
:
{
container
:
{
marginTop
:
10
,
paddingVertical
:
HEIGHTXD
(
40
),
paddingVertical
:
10
,
shadowColor
:
'#000'
,
shadowColor
:
'#000'
,
shadowOffset
:
{
shadowOffset
:
{
width
:
0
,
width
:
0
,
...
@@ -59,10 +56,10 @@ const styles = StyleSheet.create({
...
@@ -59,10 +56,10 @@ const styles = StyleSheet.create({
shadowOpacity
:
0.25
,
shadowOpacity
:
0.25
,
shadowRadius
:
3.84
,
shadowRadius
:
3.84
,
elevation
:
5
,
elevation
:
5
,
marginHorizontal
:
10
,
backgroundColor
:
R
.
colors
.
white
,
backgroundColor
:
R
.
colors
.
white
,
marginBottom
:
10
,
borderRadius
:
HEIGHTXD
(
30
),
borderRadius
:
HEIGHTXD
(
30
),
marginVertical
:
HEIGHTXD
(
15
),
marginHorizontal
:
WIDTHXD
(
30
)
},
},
wrapLeft
:
{
wrapLeft
:
{
...
@@ -70,19 +67,14 @@ const styles = StyleSheet.create({
...
@@ -70,19 +67,14 @@ const styles = StyleSheet.create({
borderTopLeftRadius
:
HEIGHTXD
(
30
),
borderTopLeftRadius
:
HEIGHTXD
(
30
),
borderBottomStartRadius
:
HEIGHTXD
(
30
),
borderBottomStartRadius
:
HEIGHTXD
(
30
),
},
},
wrapDate
:
{
justifyContent
:
'center'
,
paddingHorizontal
:
10
,
},
txtTitle
:
{
txtTitle
:
{
fontSize
:
getFontXD
(
42
),
fontSize
:
getFontXD
(
42
),
color
:
R
.
colors
.
black
,
color
:
R
.
colors
.
black
,
fontWeight
:
'bold'
,
fontWeight
:
'bold'
,
},
},
txt
:
{
txt
:
{
fontSize
:
getFontXD
(
39
),
fontSize
:
getFontXD
(
36
),
color
:
'#929292'
,
color
:
'black'
,
fontStyle
:
'italic'
,
},
},
rowBet
:
{
rowBet
:
{
flexDirection
:
'row'
,
flexDirection
:
'row'
,
...
@@ -90,14 +82,14 @@ const styles = StyleSheet.create({
...
@@ -90,14 +82,14 @@ const styles = StyleSheet.create({
alignItems
:
'center'
,
alignItems
:
'center'
,
},
},
txtBlack
:
{
txtBlack
:
{
fontSize
:
getFontXD
(
42
),
fontSize
:
getFontXD
(
50
),
color
:
'black'
,
color
:
'black'
,
fontWeight
:
'bold'
,
},
},
imgIcon
:
{
imgIcon
:
{
width
:
WIDTHXD
(
1
78
),
width
:
WIDTHXD
(
1
50
),
height
:
HEIGHTXD
(
1
78
),
height
:
HEIGHTXD
(
1
50
),
resizeMode
:
'contain'
,
resizeMode
:
'contain'
,
marginLeft
:
WIDTHXD
(
35
)
},
},
txtMoney
:
{
txtMoney
:
{
fontSize
:
getFontXD
(
42
),
fontSize
:
getFontXD
(
42
),
...
...
src/Screens/Transaction/PriceList/PriceList.js
View file @
da99951b
import
React
,
{
useState
,
useEffect
}
from
'react'
;
import
React
,
{
useState
,
useEffect
}
from
'react'
;
import
{
getList
Notification
}
from
'../../../apis/Functions/users
'
;
import
{
getList
CategoryProduct
,
getTransactionListByCategory
}
from
'../../../apis/Functions/Transaction
'
;
import
PriceListView
from
'./PriceListView'
;
import
PriceListView
from
'./PriceListView'
;
import
I18n
from
'../../../helper/i18/i18n'
;
import
I18n
from
'../../../helper/i18/i18n'
;
import
{
Alert
,
Platform
}
from
'react-native'
;
const
PriceList
=
(
props
)
=>
{
const
PriceList
=
(
props
)
=>
{
const
[
selected
,
setSelected
]
=
useState
(
''
);
const
[
selected
,
setSelected
]
=
useState
(
''
);
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
);
const
[
fillter
,
setFillters
]
=
useState
(
'ALL'
);
const
[
filters
,
setFilters
]
=
useState
([]);
const
[
filterId
,
setFilterId
]
=
useState
(
-
1
);
useEffect
(()
=>
{
useEffect
(()
=>
{
getCategoryData
();
},
[]);
useEffect
(()
=>
{
setData
([])
getData
();
getData
();
},
[
fillter
]);
},
[
filterId
]);
const
getCategoryData
=
async
()
=>
{
// setIsRefresh(true);
const
res
=
await
getListCategoryProduct
({
keyword
:
''
,
platform
:
Platform
.
OS
,
page_size
:
20
,
page_index
:
1
,
type
:
'PRODUCT'
,
});
if
((
res
.
data
.
code
=
200
&&
res
.
data
.
data
))
{
let
data
=
[];
data
.
push
({
id
:
-
1
,
name
:
'All'
});
setFilters
(
data
.
concat
([...
res
.
data
.
data
]));
}
else
{
Alert
.
alert
(
I18n
.
t
(
'Notification'
),
res
.
data
.
message
);
}
};
const
onRefresh
=
()
=>
{
setPage
(
1
);
getData
();
};
const
getData
=
async
()
=>
{
const
getData
=
async
()
=>
{
seti
sRefresh
(
true
);
setI
sRefresh
(
true
);
setPage
(
1
);
setPage
(
1
);
const
res
=
await
getListNotification
({
const
res
=
await
getTransactionListByCategory
({
keyword
:
''
,
keyword
:
''
,
platform
:
Platform
.
OS
,
platform
:
Platform
.
OS
,
page_size
:
10
,
page_size
:
10
,
page_index
:
1
,
page_index
:
1
,
type
:
fillter
,
category_id
:
filterId
,
});
});
setisRefresh
(
false
);
setIsRefresh
(
false
);
console
.
log
(
'getData'
,
res
);
if
((
res
.
data
.
code
=
200
&&
res
.
data
.
data
))
{
if
((
res
.
data
.
code
=
200
&&
res
.
data
.
data
))
{
setData
(
res
.
data
.
data
);
setData
(
res
.
data
.
data
);
setTotalPage
(
res
.
data
.
meta
.
pages
);
setTotalPage
(
res
.
data
.
meta
.
pages
);
...
@@ -33,29 +64,27 @@ const PriceList = (props) => {
...
@@ -33,29 +64,27 @@ const PriceList = (props) => {
}
}
};
};
const
onRefresh
=
()
=>
{
getData
();
};
const
onLoadMore
=
()
=>
{
const
onLoadMore
=
()
=>
{
console
.
log
(
tottalPage
);
console
.
log
(
tottalPage
);
if
(
page
<
tottalPage
)
getDataLoadMore
();
if
(
page
<
tottalPage
)
{
getDataLoadMore
();
}
};
};
const
getDataLoadMore
=
async
()
=>
{
const
getDataLoadMore
=
async
()
=>
{
seti
sRefresh
(
true
);
setI
sRefresh
(
true
);
const
res
=
await
getListNotification
({
const
res
=
await
getTransactionListByCategory
({
keyword
:
''
,
keyword
:
''
,
platform
:
Platform
.
OS
,
platform
:
Platform
.
OS
,
page_size
:
10
,
page_size
:
10
,
page_index
:
1
,
page_index
:
page
+
1
,
type
:
fillter
,
category_id
:
filterId
,
});
});
setPage
(
page
+
1
);
setPage
(
page
+
1
);
if
(
res
.
data
.
code
==
200
)
{
if
(
res
.
data
.
code
==
200
)
{
setData
(
data
.
concat
(
res
.
data
.
data
));
setData
(
data
.
concat
(
res
.
data
.
data
));
}
}
seti
sRefresh
(
false
);
setI
sRefresh
(
false
);
};
};
return
(
return
(
...
@@ -63,8 +92,9 @@ const PriceList = (props) => {
...
@@ -63,8 +92,9 @@ const PriceList = (props) => {
onRefresh
=
{
onRefresh
}
onRefresh
=
{
onRefresh
}
isRefresh
=
{
isRefresh
}
isRefresh
=
{
isRefresh
}
onLoadMore
=
{
onLoadMore
}
onLoadMore
=
{
onLoadMore
}
setFillters
=
{
setFillters
}
setFilterId
=
{
setFilterId
}
fillter
=
{
fillter
}
filterId
=
{
filterId
}
filters
=
{
filters
}
data
=
{
data
}
data
=
{
data
}
/
>
/
>
);
);
...
...
src/Screens/Transaction/PriceList/PriceListView.js
View file @
da99951b
...
@@ -10,7 +10,7 @@ import {
...
@@ -10,7 +10,7 @@ import {
import
HeaderDrawer
from
'../../../components/Header/HeaderDrawer'
;
import
HeaderDrawer
from
'../../../components/Header/HeaderDrawer'
;
import
Item
from
'./Item'
;
import
Item
from
'./Item'
;
import
{
getFontXD
}
from
'../../../Config/Functions'
;
import
{
getFontXD
,
HEIGHTXD
}
from
'../../../Config/Functions'
;
import
AppText
from
'../../../components/AppText'
;
import
AppText
from
'../../../components/AppText'
;
import
{
PRODUCTDETAIL
}
from
'../../../routers/ScreenNames'
;
import
{
PRODUCTDETAIL
}
from
'../../../routers/ScreenNames'
;
import
{
useNavigation
}
from
'@react-navigation/native'
;
import
{
useNavigation
}
from
'@react-navigation/native'
;
...
@@ -38,34 +38,32 @@ const Fillters = [
...
@@ -38,34 +38,32 @@ const Fillters = [
},
},
];
];
const
Notificaiton
View
=
(
props
)
=>
{
const
PriceList
View
=
(
props
)
=>
{
const
{
onRefresh
,
isRefresh
,
onLoadMore
,
setFillters
,
fillter
,
data
}
=
props
;
const
{
onRefresh
,
isRefresh
,
onLoadMore
,
setFilterId
,
filters
,
data
,
filterId
}
=
props
;
const
navigate
=
useNavigation
();
const
navigate
=
useNavigation
();
return
(
return
(
<
View
style
=
{{
flex
:
1
}}
>
<
View
style
=
{{
flex
:
1
}}
>
<
View
style
=
{
styles
.
headerContainer
}
>
<
View
style
=
{
styles
.
headerContainer
}
>
<
ScrollView
horizontal
showsHorizontalScrollIndicator
=
{
false
}
>
<
ScrollView
horizontal
showsHorizontalScrollIndicator
=
{
false
}
>
{
Fil
lters
.
map
((
e
)
=>
(
{
fi
lters
.
map
((
e
)
=>
(
<
TouchableOpacity
<
TouchableOpacity
key
=
{
e
.
value
}
key
=
{
e
.
id
}
onPress
=
{()
=>
setFillters
(
e
.
value
)}
onPress
=
{()
=>
setFilterId
(
e
.
id
)}
style
=
{[
style
=
{[
styles
.
itemFillter
,
styles
.
itemFillter
,
fillter
==
e
.
value
?
{
borderColor
:
'#1473E6'
}
:
null
,
filterId
==
e
.
id
?
{
borderColor
:
'#1473E6'
}
:
null
,
]}
>
]}
>
<
AppText
<
Text
i18nKey
=
{
e
.
name
}
style
=
{[
style
=
{[
styles
.
txtFillter
,
styles
.
txtFillter
,
fillter
==
e
.
value
?
{
color
:
'#1473E6'
}
:
{},
filterId
==
e
.
id
?
{
color
:
'#1473E6'
}
:
{},
]}
><
/App
Text
>
]}
>
{
e
.
name
}
<
/
Text
>
<
/TouchableOpacity
>
<
/TouchableOpacity
>
))}
))}
<
/ScrollView
>
<
/ScrollView
>
<
/View
>
<
/View
>
{
data
.
length
==
0
?
(
{
data
.
length
==
0
&&
!
isRefresh
?
(
<
View
style
=
{{
justifyContent
:
'center'
,
alignItems
:
'center'
,
flex
:
1
}}
>
<
View
style
=
{{
justifyContent
:
'center'
,
alignItems
:
'center'
,
flex
:
1
}}
>
<
AppText
<
AppText
i18nKey
=
{
'NoData'
}
i18nKey
=
{
'NoData'
}
...
@@ -76,6 +74,7 @@ const NotificaitonView = (props) => {
...
@@ -76,6 +74,7 @@ const NotificaitonView = (props) => {
<
/View
>
<
/View
>
)
:
(
)
:
(
<
FlatList
<
FlatList
style
=
{{
paddingVertical
:
HEIGHTXD
(
15
)}}
keyExtractor
=
{(
item
)
=>
item
.
id
}
keyExtractor
=
{(
item
)
=>
item
.
id
}
data
=
{
data
}
data
=
{
data
}
refreshing
=
{
isRefresh
}
refreshing
=
{
isRefresh
}
...
@@ -84,7 +83,8 @@ const NotificaitonView = (props) => {
...
@@ -84,7 +83,8 @@ const NotificaitonView = (props) => {
onEndReached
=
{(
info
)
=>
{
onEndReached
=
{(
info
)
=>
{
onLoadMore
();
onLoadMore
();
}}
}}
renderItem
=
{({
item
})
=>
<
Item
item
=
{
item
}
renderItem
=
{({
item
,
index
})
=>
<
Item
item
=
{
item
}
isEndItem
=
{
index
==
data
.
length
-
1
}
onPress
=
{(
item
)
=>
navigate
.
navigate
(
PRODUCTDETAIL
)}
/>
}
onPress
=
{(
item
)
=>
navigate
.
navigate
(
PRODUCTDETAIL
)}
/>
}
/>
/>
)}
)}
...
@@ -121,4 +121,4 @@ const styles = StyleSheet.create({
...
@@ -121,4 +121,4 @@ const styles = StyleSheet.create({
},
},
});
});
export
default
Notificaiton
View
;
export
default
PriceList
View
;
src/apis/Functions/Transaction.js
0 → 100644
View file @
da99951b
import
{
GetData
}
from
'../helpers'
;
import
url
from
'../url'
;
export
const
getListCategoryProduct
=
async
(
body
)
=>
GetData
(
url
.
urlGetCategoryNew
,
body
)
.
then
((
res
)
=>
res
)
.
catch
((
err
)
=>
err
);
export
const
getTransactionListByCategory
=
async
(
body
)
=>
GetData
(
url
.
urlGetTransactionListByCategory
,
body
)
.
then
((
res
)
=>
res
)
.
catch
((
err
)
=>
err
);
src/apis/url.js
View file @
da99951b
...
@@ -38,4 +38,7 @@ export default {
...
@@ -38,4 +38,7 @@ export default {
urlUpdateLanguage
:
root
+
'api/v1/customers/update-language'
,
urlUpdateLanguage
:
root
+
'api/v1/customers/update-language'
,
urlGetNewestVersionInfo
:
root
+
'api/v1/settings/version'
,
urlGetNewestVersionInfo
:
root
+
'api/v1/settings/version'
,
//Transaction
urlGetTransactionListByCategory
:
`
${
root
}
api/v1/transactions/price-table`
,
};
};
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment